Client Exports
Misc
GetConfig
---@return table
local config = exports["lb-phone"]:GetConfig()
GetCellTowers
---@return vector3[]
local cellTowers = exports["lb-phone"]:GetCellTowers()
FormatNumber
---@param number string # The number to format
---@return string # The formatted number
local formattedNumber = exports["lb-phone"]:FormatNumber(number)
SaveToGallery
Saves an image or video to the gallery.
---@param link string # The link to the image/video
exports["lb-phone"]:SaveToGallery(link)
HasPhoneItem
Check if the player has a phone item in their inventory.
---@return boolean
local hasPhone = exports["lb-phone"]:HasPhoneItem()
Handle phone
GetEquippedPhoneNumber
---@return string?
local phoneNumber = exports["lb-phone"]:GetEquippedPhoneNumber()
ToggleOpen
---@param open? boolean # If true, the phone is opened, if false, the phone is closed. If nil, the phone it toggles.
---@param noFocus? boolean # If true, the cursor is hidden when opening the phone.
exports["lb-phone"]:ToggleOpen(open, noFocus)
IsOpen
---@return boolean
local isOpen = exports["lb-phone"]:IsOpen()
IsPhoneOnScreen
---@return boolean
local isPhoneOnScreen = exports["lb-phone"]:IsPhoneOnScreen()
IsDisabled
---@return boolean
local isDisabled = exports["lb-phone"]:IsDisabled()
ToggleDisabled
---@param disabled boolean
exports["lb-phone"]:ToggleDisabled(disabled)
ToggleHomeIndicator
---@param show boolean
exports["lb-phone"]:ToggleHomeIndicator(show)
ToggleLandscape
---@param landscape boolean
exports["lb-phone"]:ToggleLandscape(landscape)
SendNotification
---@class NotificationData
---@field app? string # Identifier of the app that sent the notification, optional
---@field title string # Title of the notification
---@field content? string # Content of the notification, optional
---@field thumbnail? string # Thumbnail URL, optional
---@field avatar? string # Avatar URL, optional
---@field showAvatar? boolean # Whether to show an avatar placeholder if no avatar was sent, optional
---@param data NotificationData
exports["lb-phone"]:SendNotification({
app = "Settings",
title = "Test",
content = "This is a test notification",
})
ToggleFlashlight
---@param flashlight boolean
exports["lb-phone"]:ToggleFlashlight(flashlight)
GetFlashlight
---@return boolean
local flashlightEnabled = exports["lb-phone"]:GetFlashlight()
SetServiceBars
---@param bars number # 0-4
exports["lb-phone"]:SetServiceBars(bars)
ReloadPhone
Refresh the data of the player's phone. Useful if you have changed phone number or something in the database.
exports["lb-phone"]:ReloadPhone()
SetPhoneVariation
---@param variation number # The variation of the phone, has to be configured in `Config.Item.Names`
exports["lb-phone"]:SetPhoneVariation(variation)
Camera
EnableWalkableCam
---@param selfieMode? boolean
exports["lb-phone"]:EnableWalkableCam(selfieMode)
DisableWalkableCam
exports["lb-phone"]:DisableWalkableCam()
IsWalkingCamEnabled
---@return boolean
local enabled = exports["lb-phone"]:IsWalkingCamEnabled()
ToggleSelfieCam
---@param selfieMode boolean
exports["lb-phone"]:ToggleSelfieCam(selfieMode)
ToggleCameraFrozen
exports["lb-phone"]:ToggleCameraFrozen()
IsSelfieCam
---@return boolean
local selfieCam = exports["lb-phone"]:IsSelfieCam()
Settings
GetSettings
---@return table
local settings = exports["lb-phone"]:GetSettings()
GetAirplaneMode
---@return boolean
local airplaneMode = exports["lb-phone"]:GetAirplaneMode()
GetStreamerMode
---@return boolean
local streamerMode = exports["lb-phone"]:GetStreamerMode()
Apps
IsLive
Used to check if the player is live on InstaPic.
---@return boolean
local isLive = exports["lb-phone"]:IsLive()
PostBirdy
---@class BirdyPostData
---@field content string # The content of the post
---@field attachments? string[] # URLs of the attachments
---@field replyTo? string # The ID of the post to reply to
---@field hashtags? string[] # Hashtags used in the post
---@param data BirdyPostData
---@return boolean # Whether the post was successful
exports["lb-phone"]:PostBirdy(data)
AddContact
---@class ContactData
---@field number string
---@field firstname string
---@field lastname? string
---@field avatar? string
---@field email? string
---@field address? string
---@param data ContactData
exports["lb-phone"]:AddContact({
number = "01234567890",
firstname = "John",
lastname = "Doe",
avatar = "https://example.com/avatar",
email = "[email protected]",
address = "Eclipse Towers, Penthouse Suite 1",
})
OpenApp
---@param app string # The app (identifier) to open
---@param data? table # Data to pass to the app
exports["lb-phone"]:OpenApp(app, data)
CloseApp
---@param options? { app?: string, closeCompletely?: boolean }
exports["lb-phone"]:CloseApp(options)
Custom apps
We strongly recommend using our template (opens in a new tab). See custom apps for more info.
AddCustomApp
Add a custom app. Make sure to wait for lb-phone to be started, and then wait a bit more (e.g. 500ms) to make sure the export exists.
---@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 onDelete? function # Called when the app is uninstalled
---@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? function # Called when the app is closed
---@field onOpen? function # 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"
})
RemoveCustomApp
---@param identifier string
---@return boolean success
---@return string? errorMessage
local success, errorMessage = exports["lb-phone"]:RemoveCustomApp(identifier)
SendCustomAppMessage
Used to send a UI message to a custom app (replacement for SendNUIMessage
).
---@param identifier string
---@param data any
exports["lb-phone"]:SendCustomAppMessage(identifier, data)
Components
SetPopUp
Used to show a popup, see popups for more info.
SetContextMenu
Used to show a context menu, see context menus for more info.
ShowComponent
Used to show a component. Valid components are gallery
, gif
, emoji
, camera
, and colorpicker
.
---@param options { component: string, ... } # The component to show and its options
---@param cb function # Callback function with the result
exports["lb-phone"]:ShowComponent({
component = "gallery", # component to show
# other options
}, function(...)
print("Result:", ...)
end)
SetCameraComponent
Opens the camera component. See camera component for more info.
---@return string
local url = exports["lb-phone"]:SetCameraComponent()
SetContactModal
Shows the contact modal. See setContactModal for more information.
---@param phoneNumber string
exports["lb-phone"]:SetContactModal(phoneNumber)
Battery
IsPhoneDead
---@return boolean # If the phone has 0% battery
local dead = exports["lb-phone"]:IsPhoneDead()
GetBattery
---@return number # The battery percentage, 0-100
local battery = exports["lb-phone"]:GetBattery()
SetBattery
---@param battery number # The battery percentage, 0-100
exports["lb-phone"]:SetBattery(battery)
ToggleCharging
---@param charging boolean
exports["lb-phone"]:ToggleCharging(charging)
IsCharging
---@return boolean
local charging = exports["lb-phone"]:IsCharging()
Services/companies
SendCompanyMessage
---@param company string # The company to send the message to
---@param message string
---@param anonymous? boolean # Whether the message should be sent anonymously
exports["lb-phone"]:SendCompanyMessage(company, message, anonymous)
SendCompanyCoords
---@param company string # The company to send the message to
---@param coords? vector3 # The coordinates to send, if not provided it will send the player's current location
---@param anonymous? boolean # Whether the message should be sent anonymously
exports["lb-phone"]:SendCompanyCoords(company, coords, anonymous)
GetCompanyCallsStatus
---@return boolean
local callsEnabled = exports["lb-phone"]:GetCompanyCallsStatus()
ToggleCompanyCalls
---@param enabled boolean
exports["lb-phone"]:ToggleCompanyCalls(enabled)
Crypto
GetCoinValue
---@param coin string
---@return number
local value = exports["lb-phone"]:GetCoinValue(coin)
GetCryptoWallet
---@class CryptoWalletEntry
---@field change_24h number
---@field current_price number
---@field id string
---@field image string
---@field name string
---@field prices number[]
---@field symbol string
---@field owned number
---@return CryptoWalletEntry[]
local wallet = exports["lb-phone"]:GetCryptoWallet()
GetOwnedCoin
---@param coin string
---@return CryptoWalletEntry | false
local coinData = exports["lb-phone"]:GetOwnedCoin(coin)
Calls
CreateCall
Calls a number/company, and shows it on the phone UI.
---@class CallOptions
---@field number? string
---@field company? string
---@field videoCall? boolean
---@field hideNumber? boolean
---@param options CallOptions
exports["lb-phone"]:CreateCall(options)
IsInCall
---@return boolean
local inCall = exports["lb-phone"]:IsInCall()
CreateCustomNumber
Create a number that players can call.
---@class IncomingCall
---@field id string
---@field accept fun()
---@field deny fun() # Declines/ends the call without triggering onEnd
---@field setName fun(name: string)
---@field hasEnded fun(): boolean
---@class CustomNumberData
---@field onCall fun(incomingCall: IncomingCall)
---@field onEnd? fun()
---@field onAction? fun(action: "mute" | "unmute" | "enable_speaker" | "disable_speaker")
---@field onKeypad? fun(key: string)
---@param number string
---@param data CustomNumberData
---@return boolean success
---@return string? reason
local success, reason = exports["lb-phone"]:CreateCustomNumber(number, data)
RemoveCustomNumber
Remove a custom number. You have to remove it from the same resource that created it.
---@param number string
---@return boolean success
---@return string? reason
local success, reason = exports["lb-phone"]:RemoveCustomNumber(number)
EndCustomCall
End the current custom call. Returns false if there is no call.
---@return boolean
local success = exports["lb-phone"]:EndCustomCall()
Callbacks
RegisterClientCallback
Registers a client callback that can be called from the server.
---@param event string
---@param handler fun(...) : ...any
exports["lb-phone"]:RegisterClientCallback(event, handler)
AwaitCallback
---@param event string
---@param ... any
local data = exports["lb-phone"]:AwaitCallback(event, ...)
TriggerCallback
---@param event string
---@param handler fun(...): any
---@param ... any
local data = exports["lb-phone"]:TriggerCallback(event, handler, ...)