Client Exports

Misc

GetConfig

local config = exports["lb-phone"]:GetConfig()

FormatNumber

-- 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

-- link: string - The link to the image/video
exports["lb-phone"]:SaveToGallery(link)

Handle phone

GetEquippedPhoneNumber

-- return: string?
local phoneNumber = exports["lb-phone"]:GetEquippedPhoneNumber()

ToggleOpen

-- open: boolean
-- 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()

IsDisabled

-- return: boolean
local isDisabled = exports["lb-phone"]:IsDisabled()

ToggleDisabled

-- disabled: boolean
exports["lb-phone"]:ToggleDisabled(disabled)

ToggleHomeIndicator

-- show: boolean
exports["lb-phone"]:ToggleHomeIndicator(show)

ToggleLandscape

-- landscape: boolean
exports["lb-phone"]:ToggleLandscape(landscape)

SendNotification

-- data: { app?: string, title: string, content?: string, thumbnail?: string, avatar?: string, showAvatar?: boolean }
-- app: string - Identifier of the app that sent the notification, optional
-- title: string - Title of the notification
-- content: string - Content of the notification, optional
-- thumbnail: string - Thumbnail URL, optional
-- avatar: string - Avatar URL, optional
-- showAvatar: boolean - Whether to show an avatar placeholder if no avatar was sent, optional
exports["lb-phone"]:SendNotification({
    app = "Settings",
    title = "Test",
    content = "This is a test notification",
})

ToggleFlashlight

-- flashlight: boolean
exports["lb-phone"]:ToggleFlashlight(flashlight)

GetFlashlight

local flashlightEnabled = exports["lb-phone"]:GetFlashlight()

Settings

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

-- data: { content: string, attachments?: string[], replyTo?: string, hashtags?: string[] }
-- content: string - The content of the post
-- attachments: string[] - URLs of the attachments, optional
-- replyTo: string - The ID of the post to reply to, optional
-- hashtags: string[] - Hashtags used in the post, optional
-- returns: boolean - Whether the post was successful
exports["lb-phone"]:PostBirdy(data)

AddContact

-- data: { number: string, firstname: string, lastname?: string, avatar?: string, email?: string, address?: string }
exports["lb-phone"]:AddContact({
    number = "01234567890",
    firstname = "John",
    lastname = "Doe", -- optional
    avatar = "https://example.com/avatar", -- optional
    email =  "[email protected]", -- optional
    address = "Eclipse Towers, Penthouse Suite 1", -- optional
})

OpenApp

-- app: string - The app (identifier) to open
-- data: table? - Data to pass to the app
exports["lb-phone"]:OpenApp(app, 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 - returns selected image / video
  • gif - returns selected gif
  • emoji - returns selected emoji
  • camera - returns a url to the photo / video
  • colorpicker - returns selected color
exports["lb-phone"]:ShowComponent({
    component = "gallery", -- component to show
    -- options
}, function(...)
    print("Result:", ...)
end)

SetCameraComponent

Opens the camera component. See camera component for more info

local url = exports["lb-phone"]:SetCameraComponent()

SetContactModal

Shows the contact modal. See setContactModal for more information.

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

-- battery: number - The battery percentage, 0-100
exports["lb-phone"]:SetBattery(battery)

ToggleCharging

-- charging: boolean
exports["lb-phone"]:ToggleCharging(charging)

IsCharging

-- return: boolean
local charging = exports["lb-phone"]:IsCharging()

Services/companies

SendCompanyMessage

-- company: string - The company to send the message to
-- message: string
-- anonymous: boolean - Whether the message should be sent anonymously
exports["lb-phone"]:SendCompanyMessage(company, message, anonymous?)

SendCompanyCoords

-- company: string - The company to send the message to
-- coords: vector3 - The coordinates to send, if not provided it will send the player's current location
-- anonymous: boolean - Whether the message should be sent anonymously
exports["lb-phone"]:SendCompanyCoords(company, coords?, anonymous?)

Crypto

GetCoinValue

-- coin: string
-- return: number
local value = exports["lb-phone"]:GetCoinValue(coin)

GetCryptoWallet

-- return: { change_24: number, current_price: number, id: string, image: string, name: string, pices: number[], symbol: string, owned: number }[]
local wallet = exports["lb-phone"]:GetCryptoWallet()

GetOwnedCoin

-- coin: string
-- return: false | { change_24: number, current_price: number, id: string, image: string, name: string, pices: number[], symbol: string, owned: number }
local coinData = exports["lb-phone"]:GetOwnedCoin(coin)

Calls

CreateCall

Calls a number/company, and shows it on the phone UI

-- options: { number?: string, company?: string, videoCall?: string, hideNumber?: string }
exports["lb-phone"]:CreateCall(options)

IsInCall

-- return: boolean
local inCall = exports["lb-phone"]:IsInCall()

CreateCustomNumber

Create a number that players can call.

-- number: string
-- data: table
local success, reason = exports["lb-phone"]:CreateCustomNumber(number, data)
 
if not success then
    print("Failed to add number:", reason)
end

data:

  • onCall: function(incomingCall)
    • id: string
    • accept: function
    • deny: function - You can call this function to decline/end the call. Note that this won't trigger onEnd.
    • setName: function(name: string)
    • hasEnded: function: boolean - Use this after waits etc to make sure the call hasn't ended
  • onEnd?: function - optional
  • onAction?: function(action) - optional. Possible actions: mute, unmute, enable_speaker, disable_speaker
  • onKeypad?: function(key) - optional

RemoveCustomNumber

Remove a custom number. You have to remove it from the same resource that created it.

-- number: string
-- return: boolean
-- return?: string
local success, reason = exports["lb-phone"]:RemoveCustomNumber(number)
 
if not success then
    print("Failed to remove number:", reason)
end

EndCustomCall

End the current custom call. Returns false if there is no call.

-- return: boolean
local success = exports["lb-phone"]:EndCustomCall()