### SetAppInstalled Source: https://docs.lbscripts.com/tablet/script-integration/client-exports Sets the installation status of a specific application. ```lua ---@param app string ---@param installed boolean exports["lb-tablet"]:SetAppInstalled(app, installed) ``` -------------------------------- ### Set application installation status Source: https://docs.lbscripts.com/phone/exports/client-exports Installs or uninstalls an application from the phone. ```lua ---@param app string ---@param installed boolean exports["lb-phone"]:SetAppInstalled(app, installed) ``` -------------------------------- ### SetAppInstalled Source: https://docs.lbscripts.com/tablet/script-integration/client-exports Sets the installation status of an application. ```APIDOC ## SetAppInstalled ### Description Sets whether an application is installed. ### Signature `exports["lb-tablet"]:SetAppInstalled(app, installed)` ### Parameters - **app** (string) - Required - The identifier of the app. - **installed** (boolean) - Required - Whether the app should be installed. ``` -------------------------------- ### Add lookup app to server configuration Source: https://docs.lbscripts.com/lookup/installation Add this line to your server.cfg file to ensure the resource starts correctly after lb-phone. ```text start lb-lookupapp ``` -------------------------------- ### Add Resource to server.cfg Source: https://docs.lbscripts.com/racing/installation Include the racing script in the server configuration file to ensure it starts on server boot. ```text start lb-racing ``` -------------------------------- ### Add PicChat to server configuration Source: https://docs.lbscripts.com/picchat/installation Add this line to your server.cfg file to ensure the resource starts with the server. ```text start lb-picchat ``` -------------------------------- ### Configure loaf_bcrypt in server.cfg Source: https://docs.lbscripts.com/phone/installation Add these lines to your server.cfg file before starting the phone resource to enable asynchronous password hashing. ```text add_unsafe_worker_permission loaf_bcrypt start loaf_bcrypt ``` -------------------------------- ### Check MariaDB Version Source: https://docs.lbscripts.com/phone/installation Run this query in HeidiSQL to verify the installed MariaDB version. ```sql SELECT VERSION() ``` -------------------------------- ### Get MDT User Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves user information from the MDT. ```lua ---@param mdt string ---@param target number | string # Player source or identifier ---@return table | false exports["lb-tablet"]:GetMDTUser(mdt, target) ``` -------------------------------- ### Inherit MDT settings Source: https://docs.lbscripts.com/tablet/mdt Example of using the copy property to inherit settings from an existing MDT configuration while overriding specific values. ```json { "Sheriff": { "copy": "Police", "name": "Sheriff", "department": "Blaine County Sheriff's Office", "deviceName": "Mobile Database Terminal", "appIcon": "./assets/img/icons/apps/Police.png", "icon": "./assets/img/icons/mdt/police.webp", "colorTheme": "#b68b2c", "defaultPermissions": { "sheriff": { "view": 0, "create": 2, "edit": 3, "delete": 4, "stash": 3, "fine": 2, "pin": 3, "kick": 3, "invite": 2, "private": 3, "triangulate": 2, "unlock": 2, "callHistory": 1, "createWiretap": 2, "listenWiretap": 1, "messageWiretap": 1, "removeWiretap": 2 } }, "disabledTabs": ["phone", "warrants"], "tabs": [] } } ``` -------------------------------- ### Get MDT Data Export Source: https://docs.lbscripts.com/tablet/script-integration/shared-exports Retrieve MDT configuration data by name using the lb-tablet export. ```lua ---@param mdtName string ---@return MDT? exports["lb-tablet"]:GetMDT(mdtName) ``` -------------------------------- ### Prevent Tablet Opening While Dead Source: https://docs.lbscripts.com/racing/script-integration/shared-exports Example implementation of AddCheck to restrict the tablet interface based on player health status. ```lua local checkId = exports["lb-racing"]:AddCheck("openTablet", function() return not IsEntityDead(PlayerPedId()) end) ``` -------------------------------- ### Configure Licenses for QBCore/QBox Source: https://docs.lbscripts.com/tablet/configuration Define the list of enabled licenses in the framework-specific configuration file. ```lua local licenses = { { label = "Driver's License", type = "driver" }, { label = "Weapon License", type = "weapon" } } ``` -------------------------------- ### Listen for settings changes Source: https://docs.lbscripts.com/phone/custom-apps Use onSettingsChange to react to configuration updates. ```javascript onSettingsChange((newSettings) => { console.log(newSettings) }) ``` -------------------------------- ### Get Units Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves all units associated with a specific MDT. ```lua ---@param mdt string ---@return { [string] : Unit } exports["lb-tablet"]:GetUnits(mdt) ``` -------------------------------- ### GetSettings Source: https://docs.lbscripts.com/phone/exports/client-exports Retrieves the current phone settings as a table. ```lua ---@return table local settings = exports["lb-phone"]:GetSettings() ``` -------------------------------- ### Get MDT Report Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves a specific report from the MDT. ```lua ---@param mdt string ---@param tabId string ---@param reportId number ---@return table | false exports["lb-tablet"]:GetMDTReport(mdt, tabId, reportId) ``` -------------------------------- ### Get MDT Property Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves property information from the MDT. ```lua ---@param mdt string ---@param propertyId string ---@return table | false exports["lb-tablet"]:GetMDTProperty(mdt, propertyId) ``` -------------------------------- ### GetSettings Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves the settings table for a specific tablet. ```lua ---@param tabletId string ---@return table? exports["lb-tablet"]:GetSettings(tabletId) ``` -------------------------------- ### Get MDT Vehicle Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves vehicle information from the MDT by plate. ```lua ---@param mdt string ---@param plate string ---@return table | false exports["lb-tablet"]:GetMDTVehicle(mdt, plate) ``` -------------------------------- ### Implement Framework Configuration Check Source: https://docs.lbscripts.com/phone/custom-framework/server Add this check at the top of the file to prevent execution if the framework does not match the configuration. ```lua if Config.Framework ~= "your-framework" then return end ``` -------------------------------- ### Get Player Units Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves a list of all players and their assigned units. ```lua ---@return { [number]: { unit: string, mdt: string } } # Key: source exports["lb-tablet"]:GetPlayerUnits() ``` -------------------------------- ### Get MDT Avatar Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves the avatar URL for a specific player. ```lua ---@param mdt string ---@param target number | string # Player source or identifier ---@return string? avatar exports["lb-tablet"]:GetMDTAvatar(mdt, target) ``` -------------------------------- ### Get MDT Callsign Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves the callsign for a specific player in the MDT. ```lua ---@param mdt string ---@param target number | string # Player source or identifier ---@return string? callsign exports["lb-tablet"]:GetMDTCallsign(mdt, target) ``` -------------------------------- ### Add resource to server.cfg Source: https://docs.lbscripts.com/payphone/installation Add this line to your server configuration file to ensure the script loads after the phone dependency. ```text start lb-payphone ``` -------------------------------- ### Get MDT Account Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves an MDT account for a specific player. ```lua ---@param mdt string ---@param target number | string # Player source or identifier ---@return MDTAccount? exports["lb-tablet"]:GetMDTAccount(mdt, target) ``` -------------------------------- ### Get Crypto Wallet Source: https://docs.lbscripts.com/phone/exports/client-exports Retrieves the list of all cryptocurrency coins owned by the player. ```lua ---@return OwnedCryptoCoin[] local wallet = exports["lb-phone"]:GetCryptoWallet() ``` -------------------------------- ### Add a Custom App Source: https://docs.lbscripts.com/phone/exports/client-exports Registers a new custom application. Ensure the phone resource is fully initialized before calling this export. ```lua ---@class CustomApp ---@field identifier string # A unique identifier of the app ---@field ui string # The path to the HTML file ---@field name string ---@field description string ---@field images? string[] # An array of images for the app on the app store ---@field developer? string # The developer of the app ---@field defaultApp? boolean # If set to true, the app will be added automatically ---@field size? number # Size in kB ---@field icon? string # A url to the icon of the app ---@field price? number # Require players to purchase the app with in-game money ---@field landscape? boolean ---@field game? boolean ---@field disableInAppNotifications? boolean ---@field onDelete? fun() # Called when the app is uninstalled ---@field onInstall? fun() # Called when the app is installed ---@field onUse? fun() # Called when the app is opened ---@field fixBlur? boolean # If set to true, the app will not be blurry. This requires you to use the em/rem units in your CSS ---@field onClose? fun() # Called when the app is closed ---@field onOpen? fun() # Called when the app is opened ---@param appData CustomApp ---@return boolean success ---@return string? errorMessage local success, errorMessage = exports["lb-phone"]:AddCustomApp({ identifier = "custom-app", name = "Custom App", description = "This is a custom app", ui = "ui/index.html" }) ``` -------------------------------- ### Show Live Tray Source: https://docs.lbscripts.com/phone/exports/client-exports Displays a live activity tray in the phone. Embeds require either a URL or HTML content. ```lua ---@class LiveTrayButton ---@field id string ---@field label? string ---@field icon? string ---@field color? "red" | "green" | "blue" | "black" | string ---@field click? fun() ---@class LiveTrayEmbed ---@field url? string # Provide either url or html ---@field html? string # Provide either html or url ---@field size 3 | 4 | 5 ---@class LiveTrayHandlers ---@field action? fun(action: string, data?: any) ---@field tap? fun() ---@field remove? fun() ---@field autoHide? fun() ---@field update? fun(patch: table) ---@class LiveTrayOptions ---@field icon? string ---@field title string ---@field text? string ---@field color? string ---@field progress? number ---@field badge? string ---@field expandable? boolean ---@field buttons? LiveTrayButton[] ---@field duration? number ---@field removable? boolean ---@field embed? LiveTrayEmbed ---@field handlers? LiveTrayHandlers ---@type LiveTrayOptions local options = { icon = "https://example.com/icon.png", title = "Delivery in progress", text = "2 minutes away", progress = 0.75, removable = true, buttons = { { id = "cancel", label = "Cancel", color = "red", click = function() -- Cancel the delivery end } } } ---@return string id local id = exports["lb-phone"]:ShowLiveTray(options) ``` -------------------------------- ### Get Coin Value Source: https://docs.lbscripts.com/phone/exports/client-exports Retrieves the current price of a specific cryptocurrency coin. ```lua ---@param coin string ---@return number? local value = exports["lb-phone"]:GetCoinValue(coin) ``` -------------------------------- ### Wait for Player Load Source: https://docs.lbscripts.com/phone/custom-framework/client Ensure the framework is fully initialized before setting the loaded state to true. ```lua while not ESX.PlayerLoaded do Wait(500) end loaded = true ``` -------------------------------- ### Get Coin Data Source: https://docs.lbscripts.com/phone/exports/server-exports Retrieves the base data for a specific coin by its ID. ```lua ---@param id string ---@return CryptoCoin? local coinData = exports["lb-phone"]:GetCoin(id) ``` -------------------------------- ### Get Security PIN Source: https://docs.lbscripts.com/phone/exports/server-exports Retrieves the security PIN associated with a phone number. ```lua ---@param phoneNumber string ---@return string local pin = exports["lb-phone"]:GetPin(phoneNumber) ``` -------------------------------- ### Register an artist in music.lua Source: https://docs.lbscripts.com/phone/configuration/music Add new artists to the Music.Artists table in the configuration file. ```lua ["Artist Name"] = { -- The name of the artist Avatar = "avatar.jpg" -- optional. a link to the artist's avatar } ``` -------------------------------- ### Configure Default Units Source: https://docs.lbscripts.com/tablet/mdt Initializes units and their statuses upon resource startup, requiring unique names and matching status keys. ```json { "type": "units", "label": "Units", "icon": "IoGrid", "default": { "status": "available", "units": [ { "name": "Dispatch", "status": "available" }, { "name": "Supervisor", "status": "busy" } ] }, "statuses": { "available": { "label": "Available", "color": "green" }, "busy": { "label": "Busy", "color": "orange" } } } ``` -------------------------------- ### Get Player Unit Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves the unit name for a specific player source. ```lua ---@param source number ---@return string? unit exports["lb-tablet"]:GetPlayerUnit(source) ``` -------------------------------- ### onSettingsChange(callback) Source: https://docs.lbscripts.com/phone/custom-apps Registers a listener for settings changes. ```APIDOC ## onSettingsChange(callback) ### Description Registers a listener for settings changes. ### Parameters - **callback** (function) - Required - Function to execute when settings change. ``` -------------------------------- ### Get Jailed Data Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves jail information for a player by identifier or ID. ```lua ---@param identifier string ---@overload fun(id: number): JailedData | false ---@return JailedData | false exports["lb-tablet"]:GetJailed(identifier) ``` -------------------------------- ### components.setGallery(options) Source: https://docs.lbscripts.com/phone/custom-apps Opens a media gallery interface. ```APIDOC ## components.setGallery(options) ### Description Opens a media gallery interface. ### Parameters - **options** (object) - Required - Configuration object for gallery settings and onSelect callback. ``` -------------------------------- ### Get Dispatch Notification Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves details of a specific dispatch notification by its ID. ```lua ---@class DispatchNotification ---@field id number ---@field mdt string ---@field priority 'high' | 'medium' | 'low' ---@field code string ---@field title string ---@field description string ---@field location { label: string, coords: { x: number, y: number } | vector2 } ---@field image? string ---@field fields? { icon: string, label: string, value?: string }[] ---@field timestamp? number ---@field endTime? number ---@field notificationTime? number # Seconds the notification stays on screen ---@field sound? string | false # Set to false to disable the notification sound ---@field blip? DispatchBlip ---@field responders? string[] ---@class DispatchBlip ---@field type? "default" | "radius" ---@field handle? number ---@field sprite? number ---@field color? number ---@field size? number ---@field shortRange? boolean ---@field label? string ---@field radius? number ---@field randomCoords? boolean ``` ```lua ---@param id number ---@return DispatchNotification? exports["lb-tablet"]:GetDispatch(id) ``` -------------------------------- ### Get Single MDT Tag Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves a specific MDT tag by its ID. ```lua ---@class MDTTag ---@field id number ---@field title string ---@field color string ---@field type MDTTagType ---@alias MDTTagType "employee" | "profile" | "weapon" | "vehicle" | "property" | string ``` ```lua ---@param mdt string ---@param tagId number ---@return MDTTag? exports["lb-tablet"]:GetMDTTag(mdt, tagId) ``` -------------------------------- ### Configure Cloudflare TURN Credentials Source: https://docs.lbscripts.com/phone/configuration/webrtc Set the TokenID and APIToken in the WEBRTC table within the server API keys configuration file. ```lua WEBRTC = { TokenID = "6tixd89deru5dn3in1la93am7yhhbq3g", APIToken = "becst6d09fk3q6wumib9jf4zou6ppcn9mecr7a1ne2povhu4tedwyuu49q8bqn6y", } ``` -------------------------------- ### Create Mail Account Source: https://docs.lbscripts.com/phone/exports/server-exports Registers a new email account with the provided address and password. ```lua ---@param address string ---@param password string ---@param cb? function ---@return boolean success ---@return string? reason local result = exports["lb-phone"]:CreateMailAccount(address, password) ``` -------------------------------- ### Get Owned Coin Source: https://docs.lbscripts.com/phone/exports/client-exports Retrieves data for a specific cryptocurrency coin owned by the player. ```lua ---@param coin string ---@return OwnedCryptoCoin? local coinData = exports["lb-phone"]:GetOwnedCoin(coin) ``` -------------------------------- ### Implement Client NUI Callback Source: https://docs.lbscripts.com/phone/configuration/housing Register the Home NUI callback to handle house-related actions like fetching homes, managing keyholders, and toggling locks. ```lua RegisterNUICallback("Home", function(data, cb) local action, houseData = data.action, data.houseData if action == "getHomes" then cb({}) elseif action == "removeKeyholder" then cb({}) elseif action == "addKeyholder" then cb({}) elseif action == "toggleLocked" then cb(locked == true) elseif action == "setWaypoint" then cb("ok") end end) ``` -------------------------------- ### Get Company Calls Status Source: https://docs.lbscripts.com/phone/exports/client-exports Retrieves the current enabled status for company calls. ```lua ---@return boolean local callsEnabled = exports["lb-phone"]:GetCompanyCallsStatus() ``` -------------------------------- ### Enable Custom Housing Script Source: https://docs.lbscripts.com/phone/configuration/housing Add this check to the top of your custom housing files to ensure they only execute when configured. ```lua if Config.HouseScript ~= "housing-name" then return end ``` -------------------------------- ### Get Battery Percentage Source: https://docs.lbscripts.com/phone/exports/client-exports Retrieves the current battery level as a number between 0 and 100. ```lua ---@return number # The battery percentage, 0-100 local battery = exports["lb-phone"]:GetBattery() ``` -------------------------------- ### Create a Call Source: https://docs.lbscripts.com/phone/exports/client-exports Initiates a call to a specific number or company, displaying it on the phone UI. ```lua ---@class CallOptions ---@field number? string ---@field company? string ---@field videoCall? boolean ---@field hideNumber? boolean ---@param options CallOptions exports["lb-phone"]:CreateCall(options) ``` -------------------------------- ### Get Email Address Source: https://docs.lbscripts.com/phone/exports/server-exports Retrieves the email address linked to a specific phone number. ```lua ---@param phoneNumber string ---@return string? local email = exports["lb-phone"]:GetEmailAddress(phoneNumber) ``` -------------------------------- ### globalThis.createGameRender Source: https://docs.lbscripts.com/tablet/script-integration/custom-apps Initializes a game rendering context on a canvas. ```APIDOC ## globalThis.createGameRender(canvas: HTMLCanvasElement): GameRender | undefined ### Description Creates a GameRender instance bound to the provided HTMLCanvasElement for rendering game content. ### Parameters - **canvas** (HTMLCanvasElement) - The canvas element to use for rendering. ``` -------------------------------- ### Get Birdy Post Source: https://docs.lbscripts.com/phone/exports/server-exports Retrieves the data for a specific Birdy post by its unique ID. ```lua ---@param id string ---@return table? local post = exports["lb-phone"]:GetBirdyPost(id) ``` -------------------------------- ### Implement CreateFrameworkVehicle Source: https://docs.lbscripts.com/phone/custom-framework/client Spawns a vehicle at specified coordinates and applies modifications using the framework's vehicle data. ```lua --- ---@param vehicleData table ---@param coords vector3 ---@return number? vehicle function CreateFrameworkVehicle(vehicleData, coords) local model = LoadModel(vehicleData.model) local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z, 0.0, true, false) ApplyVehicleMods(vehicle, vehicleData) return vehicle end ``` -------------------------------- ### Get MDT Weapon Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves weapon information from the MDT by ID or serial number. ```lua ---@param mdt string ---@param idOrSerialNumber number | string ---@return table | false exports["lb-tablet"]:GetMDTWeapon(mdt, idOrSerialNumber) ``` -------------------------------- ### Get MDT Tags Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves all MDT tags associated with a specific MDT identifier. ```lua ---@class MDTTag ---@field id number ---@field title string ---@field color string ---@field type MDTTagType ---@alias MDTTagType "employee" | "profile" | "weapon" | "vehicle" | "property" | string ``` ```lua ---@param mdt string ---@return { [number]: MDTTag } exports["lb-tablet"]:GetMDTTags(mdt) ``` -------------------------------- ### GetSettings Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Retrieves the settings configuration for a specific tablet. ```APIDOC ## GetSettings ### Signature `exports["lb-tablet"]:GetSettings(tabletId)` ### Parameters - **tabletId** (string) - The unique ID of the tablet. ### Returns - **settings** (table | nil) - The tablet settings table. ``` -------------------------------- ### HireEmployee Function Source: https://docs.lbscripts.com/phone/custom-framework/client Hires a new employee and returns their player data. ```lua ---@param source number ---@param cb fun(employee: Employee) function HireEmployee(source, cb) -- Implement your hire function here return { name = "John Doe", id = "license:1234567890" } end ``` -------------------------------- ### Get Race Status Source: https://docs.lbscripts.com/racing/script-integration/client-exports Retrieves the current race status and ID for the local player. ```lua ---@return boolean isInRace ---@return number? raceId local isInRace, raceId = exports["lb-racing"]:IsInRace() ``` -------------------------------- ### Show Music Tray Source: https://docs.lbscripts.com/phone/exports/client-exports Displays media playback controls in the phone's music tray using the provided options table. ```lua ---@class MusicTrayHandlers ---@field action? fun(action: string, data?: any) ---@field play? fun() ---@field pause? fun() ---@field next? fun() ---@field previous? fun() ---@field seek? fun(position: number) ---@class MusicTrayPermissions ---@field seek? boolean ---@field next? boolean ---@field previous? boolean ---@class MusicTrayOptions ---@field id? string ---@field title string ---@field artist? string ---@field album? string ---@field cover? string ---@field duration? number ---@field position? number ---@field playing? boolean ---@field color? string ---@field permissions? MusicTrayPermissions ---@field handlers? MusicTrayHandlers ---@type MusicTrayOptions local options = { title = "Track name", artist = "Artist", duration = 180, position = 0, playing = true, permissions = { seek = true, next = true, previous = true }, handlers = { pause = function() -- Pause playback end, seek = function(position) -- Seek to position in seconds end } } ---@type string | false local id, errorReason = exports["lb-phone"]:ShowMusicTray(options) ``` -------------------------------- ### Get Owned Coin Data Source: https://docs.lbscripts.com/phone/exports/server-exports Retrieves a player’s balance and investment data for a specific coin. ```lua ---@param target string | number # The player identifier or source ---@param coin string ---@return OwnedCryptoCoin | false local coinData = exports["lb-phone"]:GetOwnedCoin(target, coin) ``` -------------------------------- ### AddCustomApp Source: https://docs.lbscripts.com/tablet/script-integration/client-exports Registers a new custom application with the tablet. ```lua ---@param appData NewCustomAppData ---@return boolean success ---@return "APP_ALREADY_EXISTS" | nil reason exports["lb-tablet"]:AddCustomApp(appData) ``` -------------------------------- ### Get Social Media Username Source: https://docs.lbscripts.com/phone/exports/server-exports Retrieves the username associated with a specific phone number for a given application. ```lua ---@param phoneNumber string ---@param app "instapic" | "birdy" | "trendy" | "darkchat" | "mail" ---@return string? local username = exports["lb-phone"]:GetSocialMediaUsername(phoneNumber, app) ``` -------------------------------- ### Display a media gallery Source: https://docs.lbscripts.com/phone/custom-apps Use setGallery to open a media selection interface for images and videos. ```javascript components.setGallery({ includeVideos: true, includeImages: true, allowExternal: true, multiSelect: false, onSelect(data) { components.setPopUp({ title: 'Selected media', attachment: { src: Array.isArray(data) ? data[0].src : data.src }, buttons: [ { title: 'OK' } ] }) } }) ``` -------------------------------- ### GetSettings Source: https://docs.lbscripts.com/phone/exports/server-exports Retrieves the settings table for a given phone number. ```lua ---@param phoneNumber string ---@return table? local settings = exports["lb-phone"]:GetSettings(phoneNumber) ``` -------------------------------- ### Get Checkpoint Information Source: https://docs.lbscripts.com/racing/script-integration/client-exports Functions to retrieve current checkpoint index, all checkpoints, or the center of a specific checkpoint. ```lua ---@return number? checkpointIndex local checkpointIndex = exports["lb-racing"]:GetCurrentCheckpoint() ``` ```lua ---@return ([vector3, vector3] | vector3)[]? checkpoints local checkpoints = exports["lb-racing"]:GetCheckpoints() ``` ```lua ---@param checkpointIndex number ---@return vector3? center local center = exports["lb-racing"]:GetCheckpointCenter(checkpointIndex) ``` -------------------------------- ### components.setPopUp(options) Source: https://docs.lbscripts.com/phone/custom-apps Displays a popup menu with a title, description, and a list of buttons. ```APIDOC ## components.setPopUp(options) ### Description Displays a popup menu with a title, description, and a list of buttons. ### Parameters - **options** (object) - Required - Configuration object containing title, description, and buttons array. ``` -------------------------------- ### Register a song in music.lua Source: https://docs.lbscripts.com/phone/configuration/music Add song metadata to the Music.Songs table, linking it to an artist and optional album. ```lua ["filename.mp3"] = { -- The name of the song Title = "Song Name", -- The name of the song Artist = "Artist Name", -- The name of the artist Album = "Album Name" -- optional. The name of the album the song belongs to Cover = "cover.jpg" -- optional. a link to the song's cover } ``` -------------------------------- ### Define Metered ICE Servers Source: https://docs.lbscripts.com/phone/configuration/webrtc Example of the iceServers array structure provided by Metered for use in the phone configuration. ```lua { urls: "stun:stun.relay.metered.ca:80", }, { urls: "turn:global.relay.metered.ca:80", username: "", credential: "", }, { urls: "turn:global.relay.metered.ca:80?transport=tcp", username: "", credential: "", }, { urls: "turn:global.relay.metered.ca:443", username: "", credential: "", }, { urls: "turns:global.relay.metered.ca:443?transport=tcp", username: "", credential: "", }, ``` -------------------------------- ### Registering a Custom App in Config Source: https://docs.lbscripts.com/phone/custom-apps Add new applications to the Config.CustomApps table in lb-phone/config/config.lua to define their properties, UI, and trigger functions. ```lua Config.CustomApps = { ["app_identifier"] = { -- A unique identifier for the app, not shown to the user name = "App Name", -- The name of the app, shown to the user description = "App Description", -- The description of the app, shown to the user developer = "LB Phone", -- OPTIONAL the developer of the app defaultApp = true, -- OPTIONAL if set to true, app should be added without having to download it, game = false, -- OPTIONAL if set to true, app will be added to the game section size = 59812, -- OPTIONAL in kB images = { "https://example.com/photo.jpg" }, -- OPTIONAL array of images for the app on the app store ui = "resource-name/ui/index.html", -- OPTIONAL icon = "https://cfx-nui-" .. GetCurrentResourceName() .. "/ui/icon.png", -- OPTIONAL app icon price = 0, -- OPTIONAL, Make players pay with in-game money to download the app landscape = false, -- OPTIONAL, if set to true, the app will be displayed in landscape mode keepOpen = true, -- OPTIONAL, if set to true, the app will not close when the player opens the app (only works if ui is not defined) onUse = function() -- OPTIONAL function to be called when the app is opened -- do something end, onServerUse = function(source) -- OPTIONAL server side function to be called when the app is opened -- do something end } } ``` -------------------------------- ### Configure color picker Source: https://docs.lbscripts.com/phone/custom-apps Sets up callbacks for color selection and picker closure. ```typescript components.setColorPicker({ onSelect(color) {}, onClose(color) {} }) ``` -------------------------------- ### Implement CreateUsableItem Source: https://docs.lbscripts.com/phone/custom-framework/server Registers a usable item for the phone within the framework. ```lua ---@param item string ---@param cb function function CreateUsableItem(item, cb) -- This is an example from the lb-phone esx.lua file ESX.RegisterUsableItem(item, cb) end ``` -------------------------------- ### Open an application Source: https://docs.lbscripts.com/phone/exports/client-exports Triggers the phone to open a specific application, optionally passing data. ```lua ---@param app string # The app (identifier) to open ---@param data? table # Data to pass to the app exports["lb-phone"]:OpenApp(app, data) ``` -------------------------------- ### Register an album in music.lua Source: https://docs.lbscripts.com/phone/configuration/music Categorize songs by adding album definitions to the Music.Albums table. ```lua ["Album Name"] = { -- The name of the album Artist = "Artist Name", -- The name of the artist Cover = "cover.jpg" -- a link to the album's cover } ``` -------------------------------- ### Set application visibility Source: https://docs.lbscripts.com/phone/exports/client-exports Hides or shows an application in the app browser. ```lua ---@param app string ---@param hidden boolean exports["lb-phone"]:SetAppHidden(app, hidden) ``` -------------------------------- ### Invoke SetContextMenu Export Source: https://docs.lbscripts.com/tablet/script-integration/client-exports Displays a context menu on the tablet using the provided data structure. ```lua ---@param data ContextMenu exports["lb-tablet"]:SetContextMenu(data) ``` -------------------------------- ### Register tablet item in QBCore Source: https://docs.lbscripts.com/tablet/installation Add this entry to the qb-core/shared/items.lua file to define the tablet item. ```lua tablet = { name = 'tablet', label = 'Tablet', weight = 1000, type = 'item', image = 'tablet.png', unique = true, useable = true, shouldClose = true, description = 'Work-related tablet' }, ``` -------------------------------- ### Retrieve All MDTs Source: https://docs.lbscripts.com/tablet/script-integration/shared-exports Returns a table containing all registered MDT configurations. ```lua ---@return { [string]: MDT } exports["lb-tablet"]:GetMDTs() ``` -------------------------------- ### Implement GiveItemWithMetadata Source: https://docs.lbscripts.com/tablet/configuration Required for custom inventories to support exporting MDT reports as items with metadata. ```lua ---@param source number ---@param item string ---@param metadata { [string]: any } ---@return boolean success function GiveItemWithMetadata(source, item, metadata) -- Give one item with the supplied metadata end ``` -------------------------------- ### Invoke Gallery Export Source: https://docs.lbscripts.com/tablet/script-integration/client-exports Opens the gallery interface on the tablet with the specified configuration. ```lua ---@param data GalleryData exports["lb-tablet"]:Gallery(data) ``` -------------------------------- ### Retrieve Tablet Configuration Source: https://docs.lbscripts.com/tablet/script-integration/shared-exports Fetches the tablet configuration. Optionally accepts a key or array of keys to retrieve specific configuration values. ```lua ---@param key? string | string[] exports["lb-tablet"]:GetConfig(key?) ``` -------------------------------- ### GetSettings Source: https://docs.lbscripts.com/phone/exports/client-exports Retrieves the current phone settings. ```APIDOC ## GetSettings ### Signature `exports["lb-phone"]:GetSettings()` ### Returns - **table** - The current settings configuration. ``` -------------------------------- ### AddCustomApp Source: https://docs.lbscripts.com/tablet/script-integration/client-exports Registers a new custom application. ```APIDOC ## AddCustomApp ### Description Adds a custom application to the tablet. ### Signature `exports["lb-tablet"]:AddCustomApp(appData)` ### Parameters - **appData** (NewCustomAppData) - Required - The application configuration object. ### Returns - **success** (boolean) - Whether the operation succeeded. - **reason** ("APP_ALREADY_EXISTS" | nil) - The error reason if failed. ``` -------------------------------- ### globalThis.setGallery Source: https://docs.lbscripts.com/tablet/script-integration/custom-apps Opens the gallery interface for media selection. ```APIDOC ## globalThis.setGallery(data: GalleryData) ### Description Opens the tablet gallery to allow the user to select images or videos based on the provided configuration. ### Parameters - **data** (GalleryData) - Configuration for the gallery, including selection filters and the onSelect callback. ``` -------------------------------- ### CreateFrameworkVehicle Source: https://docs.lbscripts.com/phone/custom-framework/client Spawns a vehicle and applies the necessary modifications. ```APIDOC ## CreateFrameworkVehicle ### Description Creates a new vehicle at the specified coordinates and applies mods using the provided vehicle data. ### Parameters - **vehicleData** (table) - The data containing vehicle model and modification details. - **coords** (vector3) - The coordinates where the vehicle should be spawned. ### Returns - **number?** - The entity ID of the created vehicle. ``` -------------------------------- ### Configure LB Phone and Tablet App Source: https://docs.lbscripts.com/racing/configuration Defines the application settings for LB Phone and LB Tablet integration. ```lua Config.App.Default = true Config.App.Name = "LB Racing" Config.App.Description = "Participate in races and win money." Config.App.RequireItem = false Config.App.BlacklistedJobs = {} Config.App.LBPhone = true Config.App.LBTablet = true ``` -------------------------------- ### Configure Standalone Tablet Settings Source: https://docs.lbscripts.com/racing/configuration Defines the behavior, item requirements, and key bindings for the standalone racing tablet. ```lua Config.Standalone.Enabled = "auto" -- true, false, or "auto" Config.Standalone.RequireItem = "racing_tablet" -- false to disable the item requirement Config.Standalone.Command = "racingtablet" Config.Standalone.Bind = "F4" Config.Standalone.AllowAvatar = true ``` -------------------------------- ### Create and manage a game render Source: https://docs.lbscripts.com/phone/custom-apps Initializes a game render on a canvas and provides methods for aspect ratio control, recording, and cleanup. ```typescript const gameRender = components.createGameRender(canvas) // set the aspect ratio gameRender.resizeByAspect(9 / 16) // pause the rendering gameRender.pause() // unpause the rendering gameRender.resume() // take a photo const blob: Blob = await gameRender.takePhoto() // take a video const recorder = gameRender.startRecording((blob: Blob) => { const video = URL.createObjectURL(blob) }) await new Promise((resolve) => setTimeout(resolve, 5000)) recorder.stop() // destroy the game render gameRender.destroy() ``` -------------------------------- ### ShowLiveTray Source: https://docs.lbscripts.com/phone/exports/client-exports Displays a live activity notification in the phone's live tray. ```APIDOC ## ShowLiveTray ### Description Shows a live activity in the phone’s live tray. ### Signature `exports["lb-phone"]:ShowLiveTray(options: LiveTrayOptions)` ### Parameters - **options** (LiveTrayOptions) - Required - Configuration object for the live tray including title, text, progress, and buttons. ``` -------------------------------- ### Implement AddMoney Source: https://docs.lbscripts.com/phone/custom-framework/server Adds a specified amount of money to the player's bank account. ```lua ---@param source any ---@param amount integer ---@return boolean success function AddMoney(source, amount) return true end ``` -------------------------------- ### Create MDT Tag Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Creates a new MDT tag with the specified title, color, and type. ```lua ---@alias MDTTagType "employee" | "profile" | "weapon" | "vehicle" | "property" | string ---@class MDTTag ---@field id number ---@field title string ---@field color string ---@field type MDTTagType ``` ```lua ---@param mdt string ---@param title string ---@param color string # the color name, or hex ---@param tagType MDTTagType ---@return MDTTag? exports["lb-tablet"]:CreateMDTTag(mdt, title, color, tagType) ``` -------------------------------- ### Display a popup menu Source: https://docs.lbscripts.com/phone/custom-apps Use setPopUp to display a modal dialog with custom buttons and callbacks. ```javascript components.setPopUp({ title: 'Popup Menu', description: 'Confirm your choice', buttons: [ { title: 'Cancel', color: 'red', cb: () => { console.log('Cancel') } }, { title: 'Confirm', color: 'blue', cb: () => { console.log('Confirm') } } ] }) ``` -------------------------------- ### Invoke SetPopUp Export Source: https://docs.lbscripts.com/tablet/script-integration/client-exports Displays a popup on the tablet using the provided data structure. ```lua ---@param data PopUpData ---@return boolean exports["lb-tablet"]:SetPopUp(data) ``` -------------------------------- ### Handle unit creation Source: https://docs.lbscripts.com/tablet/script-integration/server-events Triggered when a new unit is created. ```lua ---@param mdt string ---@param name string ---@param status string AddEventHandler("lb-tablet:unitCreated", function(mdt, name, status) print("New unit created:", mdt, name, status) end) ``` -------------------------------- ### Create MDT Report Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Creates a new report in the MDT. ```lua ---@param mdt string ---@param tabId string ---@param creator string ---@param data MDTNewReportData ---@return number | false reportId exports["lb-tablet"]:CreateMDTReport(mdt, tabId, creator, data) ``` -------------------------------- ### IsOpen Source: https://docs.lbscripts.com/tablet/script-integration/client-exports Checks if the tablet is currently open. ```lua ---@return boolean exports["lb-tablet"]:IsOpen() ``` -------------------------------- ### IsOpen Source: https://docs.lbscripts.com/phone/exports/client-exports Checks if the phone interface is currently open. ```lua ---@return boolean local isOpen = exports["lb-phone"]:IsOpen() ``` -------------------------------- ### GetConfig Source: https://docs.lbscripts.com/phone/exports/server-exports Retrieves the current phone configuration table. ```lua ---@return table local config = exports["lb-phone"]:GetConfig() ``` -------------------------------- ### Register Custom Wallpaper in config.json Source: https://docs.lbscripts.com/phone/configuration/wallpapers Add new wallpaper entries to the wallpapers object in the configuration file. Ensure no trailing comma is added to the final entry. ```json "wallpapers": { "default": "default.jpg", "cloud": "cloud.jpg", "cloud2": "cloud2.jpg", "your_custom_wallpaper": "wallpaper-name.extension" } ``` -------------------------------- ### Create Unit Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Creates a new unit in the specified MDT. ```lua ---@param mdt string ---@param name string ---@param status? string ---@return boolean exports["lb-tablet"]:CreateUnit(mdt, name, status?) ``` -------------------------------- ### Implement Money Functions Source: https://docs.lbscripts.com/racing/custom-framework/server Functions for managing player bank balances, including offline support. ```lua ---@param source number ---@return number function GetMoney(source) return 0 end ``` ```lua ---@param source number ---@param amount number ---@return boolean function RemoveMoney(source, amount) return true end ``` ```lua ---@param identifier string ---@param amount number ---@return boolean function RemoveMoneyOffline(identifier, amount) return true end ``` ```lua ---@param source number ---@param amount number ---@return boolean function AddMoney(source, amount) return true end ``` ```lua ---@param identifier string ---@param amount number ---@return boolean function AddMoneyOffline(identifier, amount) return true end ``` -------------------------------- ### Configure Track Creator Settings Source: https://docs.lbscripts.com/racing/configuration Defines environment and vehicle settings for the track creator. Ensure weather sync resources do not conflict with these settings. ```lua Config.Creator.Bucket = true Config.Creator.Vehicle = `tenf2` -- false to disable the creator vehicle Config.Creator.Weather.Freeze = true Config.Creator.Weather.Type = "EXTRASUNNY" Config.Creator.Weather.Hour = 12 Config.Creator.Weather.Minute = 0 ``` -------------------------------- ### Handle lb-phone:factoryReset event Source: https://docs.lbscripts.com/phone/exports/server-events Triggered when a player factory resets their phone. ```lua ---@param source number ---@param phoneNumber string AddEventHandler("lb-phone:factoryReset", function(source, phoneNumber) print("Player", GetPlayerName(source) .." (" .. source .. ") factory reset their phone with number:", phoneNumber) end) ``` -------------------------------- ### Set Camera Component Source: https://docs.lbscripts.com/phone/exports/client-exports Opens the camera interface with specified configuration data. ```lua ---@class CameraComponentData ---@field default { type: "Photo" | "Video" | "Landscape", flash: boolean, camera: "rear" | "front" } ---@field permissions { toggleFlash: boolean, flipCamera: boolean, takePhoto: boolean, takeVideo: boolean, takeLandscapePhoto: boolean } ---@field saveToGallery boolean ---@field cb fun(src: string) ---@param data CameraComponentData ---@return string local url = exports["lb-phone"]:SetCameraComponent(data) ``` -------------------------------- ### Handle lb-phone:settingsUpdated Event Source: https://docs.lbscripts.com/phone/exports/client-events Triggered when the phone settings are updated. ```lua RegisterNetEvent("lb-phone:settingsUpdated", function(newSettings) print(json.encode(newSettings, { indent = true })) end) ``` -------------------------------- ### Add Custom Coin Source: https://docs.lbscripts.com/phone/exports/server-exports Registers a new custom cryptocurrency into the system. ```lua ---@param id string ---@param name string ---@param symbol string ---@param image string ---@param currentPrice number ---@param prices number[] ---@param change24h number ---@param permissions? CryptoCoinPermissions exports["lb-phone"]:AddCustomCoin(id, name, symbol, image, currentPrice, prices, change24h, permissions) ``` -------------------------------- ### Display a share component Source: https://docs.lbscripts.com/phone/custom-apps Use setShareComponent to initiate a sharing action for media content. ```javascript components.setShareComponent({ type: 'image', data: { isVideo: false, src: 'https://docs.lbscripts.com/images/icons/icon.png' } }) ``` -------------------------------- ### createCall(options) Source: https://docs.lbscripts.com/phone/custom-apps Initiates a phone call. ```APIDOC ## createCall(options) ### Description Initiates a phone call. ### Parameters - **options** (object) - Required - Configuration object containing number/company, videoCall, and hideNumber. ``` -------------------------------- ### Handle lb-phone:newCompanyMessage event Source: https://docs.lbscripts.com/phone/exports/server-events Triggered when a new company message is sent. ```lua ---@param message { company: string, sender: string, sentByEmployee: boolean, message: string, coords?: vector2, anonymous: boolean } AddEventHandler("lb-phone:newCompanyMessage", function(message) print("New company message:", json.encode(message, { indent = true })) end) ``` -------------------------------- ### Implement GetBalance Source: https://docs.lbscripts.com/phone/custom-framework/server Retrieves the bank balance for a specific player. ```lua ---@param source any ---@return integer function GetBalance(source) return 0 end ``` -------------------------------- ### ToggleOpen Source: https://docs.lbscripts.com/tablet/script-integration/client-exports Opens or closes the tablet. If no arguments are provided, it toggles the current state. ```lua ---@param open? boolean # Whether to open or close the tablet. If nil, it will toggle. ---@param unlock? boolean # Whether to unlock the tablet after toggling it open. exports["lb-tablet"]:ToggleOpen(open?, unlock?) ``` -------------------------------- ### Await a client callback Source: https://docs.lbscripts.com/tablet/script-integration/server-exports Synchronously awaits a callback response from the client. ```lua ---@param event string ---@param source number ---@return ... exports["lb-tablet"]:AwaitClientCallback(event, source) ``` -------------------------------- ### components.setContextMenu(options) Source: https://docs.lbscripts.com/phone/custom-apps Displays a context menu with a title and a list of buttons. ```APIDOC ## components.setContextMenu(options) ### Description Displays a context menu with a title and a list of buttons. ### Parameters - **options** (object) - Required - Configuration object containing title and buttons array. ``` -------------------------------- ### EnableWalkableCam Source: https://docs.lbscripts.com/tablet/script-integration/client-exports Enables the walkable camera mode. ```APIDOC ## EnableWalkableCam ### Description Enables the walkable camera mode for the tablet. ### Signature `exports["lb-tablet"]:EnableWalkableCam(selfieMode?)` ### Parameters - **selfieMode** (boolean) - Optional - Whether to enable selfie mode. ``` -------------------------------- ### ToggleOpen Source: https://docs.lbscripts.com/phone/exports/client-exports Opens or closes the phone interface. ```APIDOC ## ToggleOpen ### Description Opens or closes the phone UI. If no arguments are provided, it toggles the current state. ### Signature `exports["lb-phone"]:ToggleOpen(open, noFocus)` ### Parameters - **open** (boolean, optional) - If true, opens the phone; if false, closes it. - **noFocus** (boolean, optional) - If true, hides the cursor when opening. ``` -------------------------------- ### Gallery Source: https://docs.lbscripts.com/tablet/script-integration/client-exports Opens the gallery interface for selecting images or videos. ```APIDOC ## Gallery ### Description Opens the gallery interface to allow users to select media files. ### Signature `exports["lb-tablet"]:Gallery(data: GalleryData)` ### Parameters - **data** (GalleryData) - Required - The configuration object for the gallery. ```