Skip to Content

Server Exports

Misc

GetConfig

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

GetCellTowers

---@return vector3[] local cellTowers = exports["lb-phone"]:GetCellTowers()

FormatNumber

---@param phoneNumber string ---@return string local formattedNumber = exports["lb-phone"]:FormatNumber(phoneNumber)

AirShare

---@class ImageShareData ---@field isVideo boolean ---@field src string # link to the image/video ---@field timestamp? number # timestamp in ms, defaults to current time ---@class ContactShareData ---@field number string ---@field firstname string ---@field lastname? string ---@field email? string ---@field address? string ---@field avatar? string ---@class LocationShareData ---@field name string ---@field location vector2 # [y, x] ---@class NoteShareData ---@field title string ---@field content string ---@class VoicememoShareData ---@field title string ---@field src string # link to the audio file ---@field duration number # audio file duration in seconds ---@param sender number ---@param target number ---@param shareType "image" | "contact" | "location" | "note" | "voicememo" ---@param shareData ImageShareData | ContactShareData | LocationShareData | NoteShareData | VoicememoShareData exports["lb-phone"]:AirShare(sender, target, shareType, shareData)

ContainsBlacklistedWord

Checks if a string contains a blacklisted word defined in the config.

---@param source number ---@param text string ---@return boolean local containsBlacklistedWord = exports["lb-phone"]:ContainsBlacklistedWord(source, text)

AddCheck

Check params

  • startInstaPicLive: parameters username (string)
  • joinInstaPicLive: parameters username (string), inviter (string)
  • postInstaPicStory: parameters username (string)
  • buyCrypto: parameters coin (string), amount (number)
  • sellCrypto: parameters coin (string), amount (number)
  • transferCrypto: parameters transferToNumber (string), coin (string), amount (number)
  • createDarkChatChannel: parameters username (string), channel (string)
  • joinDarkChatChannel: parameters username (string), channel (string)
  • sendDarkchatMessage: parameters username (string), channel (string), message (string)
  • postInstaPic: parameters username (string), media (string[]), caption? (string), location? (string)
  • postBirdy: parameters username (string), content? (string), attachments? (string[])
  • postTrendy: parameters username (string), video (string), caption (string)
  • postMarketplace: parameters post (table with title, description, attachments (string[]) and price)
  • postPages: parameters post (table with title, description, attachment? (string) and price?)

The handler is called before the action is performed. Return false to prevent it.

---@alias CheckEvent "createDarkChatChannel" | "joinDarkChatChannel" | "sendDarkchatMessage" | "startInstaPicLive" | "joinInstaPicLive" | "postInstaPicStory" | "buyCrypto" | "sellCrypto" | "transferCrypto" | "postInstaPic" | "postBirdy" | "postTrendy" | "postMarketplace" | "postPages" ---@param event CheckEvent ---@param handler fun(source: number, ...: any): boolean ---@return number id local id = exports["lb-phone"]:AddCheck(event, handler)

RemoveCheck

---@param id number ---@return boolean success local success = exports["lb-phone"]:RemoveCheck(id)

Social media

GetSocialMediaUsername

Gets the username of the account that a phone is logged in to. Returns false if the phone isn’t logged in to the app.

---@param phoneNumber string ---@param app "instapic" | "birdy" | "trendy" | "darkchat" | "mail" ---@return string | false local username = exports["lb-phone"]:GetSocialMediaUsername(phoneNumber, app)

ToggleVerified

For Birdy, verified can also be a number to set a specific verification tier from Config.Verified.Birdy.

---@param app "birdy" | "instapic" | "trendy" ---@param username string ---@param verified boolean | number ---@return boolean success local success = exports["lb-phone"]:ToggleVerified(app, username, verified)

IsVerified

Returns a boolean for InstaPic and Trendy. For Birdy, the verification tier is returned, where 0 means that the account isn’t verified.

---@param app "birdy" | "instapic" | "trendy" ---@param username string ---@return boolean | number local isVerified = exports["lb-phone"]:IsVerified(app, username)

ChangePassword

---@param app "birdy" | "instapic" | "trendy" | "mail" | "darkchat" ---@param username string # The username, or the address for mail ---@param password string ---@param dontLogOut? boolean # Set to true to keep the account logged in on all phones ---@return boolean success local success = exports["lb-phone"]:ChangePassword(app, username, password, dontLogOut)

PostBirdy

---@param username string ---@param content? string ---@param attachments? string[] ---@param replyTo? string # the id of the post to reply to ---@param hashtags? string[] ---@param source? number # The player that created the post, used for logs ---@return boolean success ---@return string? id local success, id = exports["lb-phone"]:PostBirdy(username, content, attachments, replyTo, hashtags, source)

GetBirdyPost

Used to get a post on birdy.

---@class BirdyPost ---@field id string ---@field username string ---@field content? string ---@field attachments? string[] ---@field likes number ---@field replies number ---@field reposts number ---@field replyTo? string # The ID of the post this post is a reply to ---@field timestamp number ---@field displayName string ---@field avatar? string ---@field verified boolean | number ---@param id string ---@return BirdyPost? local post = exports["lb-phone"]:GetBirdyPost(id)

PostInstaPic

---@param username string ---@param media string[] # URLs of the images/videos ---@param caption string ---@param location? string ---@return boolean success ---@return string? id local success, id = exports["lb-phone"]:PostInstaPic(username, media, caption, location)

DeleteBirdyAccount

---@param username string ---@return boolean success local success = exports["lb-phone"]:DeleteBirdyAccount(username)

DeleteInstaPicAccount

---@param username string ---@return boolean success local success = exports["lb-phone"]:DeleteInstaPicAccount(username)

DeleteTrendyAccount

---@param username string ---@return boolean success local success = exports["lb-phone"]:DeleteTrendyAccount(username)

Handle phone & user

FactoryReset

---@param phoneNumber string exports["lb-phone"]:FactoryReset(phoneNumber)

GetEquippedPhoneNumber

---@param source number | string # the player source or identifier ---@return string? local phoneNumber = exports["lb-phone"]:GetEquippedPhoneNumber(source)

GetSourceFromNumber

Gets the source of the player that has a phone number equipped. Returns false if no online player has the number equipped.

---@param phoneNumber string ---@return number | false local source = exports["lb-phone"]:GetSourceFromNumber(phoneNumber)

HasPhoneItem

Check if a player has a phone item. If phoneNumber is provided, it also checks that the phone has that number.

---@param source number ---@param phoneNumber? string ---@return boolean local hasPhoneItem = exports["lb-phone"]:HasPhoneItem(source, phoneNumber)

GetSettings

Returns nil if the phone isn’t equipped by an online player.

---@param phoneNumber string ---@return table? local settings = exports["lb-phone"]:GetSettings(phoneNumber)

HasAirplaneMode

Returns nil if the phone isn’t equipped by an online player.

---@param phoneNumber string ---@return boolean? local hasAirplaneMode = exports["lb-phone"]:HasAirplaneMode(phoneNumber)

SendNotification

If target is a phone number, the notification is saved and its ID is returned. If target is a player source, the notification is only shown to the player, and is not saved.

You need to set title, content, or both. Set remove = true on a button to remove the notification after it is pressed.

---@class NotificationButton ---@field title string ---@field event? string # The event to trigger when the button is clicked ---@field server? boolean # Whether the event is server-side ---@field data any ---@field remove? boolean # Remove the notification after the button is pressed ---@class Notification ---@field app string # Identifier of the app that sent the notification ---@field title? string ---@field content? string # Limited to 500 characters ---@field thumbnail? string ---@field avatar? string ---@field showAvatar? boolean ---@field customData? { buttons?: NotificationButton[] } ---@param target string | number # The player source or phone number ---@param data Notification ---@param cb? fun(id: number | boolean) ---@return number? id local id = exports["lb-phone"]:SendNotification(target, data) -- Example: exports["lb-phone"]:SendNotification("2059700389", { app = "Mail", title = "New Mail", content = "You have a new mail from the government.", customData = { buttons = { { title = "Read", event = "mail:openMail", data = { id = 1 } }, { title = "Delete", event = "mail:deleteMail", data = { id = 1 }, remove = true } } } })

NotifyEveryone

---@class SimpleNotification ---@field app string # Identifier of the app that sent the notification ---@field title string # Title of the notification ---@field content? string # Content of the notification ---@field thumbnail? string # Thumbnail URL ---@field avatar? string # Avatar URL ---@field showAvatar? boolean # Whether to show an avatar placeholder if no avatar was sent ---@param notify "all" | "online" # all = everyone that has used their phone in the last 7 days (saved to db), online = only online players (not saved) ---@param data SimpleNotification exports["lb-phone"]:NotifyEveryone("online", { app = "Settings", title = "Test", content = "This is a test notification", })

EmergencyNotification

---@param source number # The player source ---@param data { title: string, content: string, icon?: "warning" | "danger" } ---@return number? id exports["lb-phone"]:EmergencyNotification(source, { title = "Emergency Alert", content = "This is a test emergency alert", icon = "warning", })

AddContact

---@class ContactData ---@field number string ---@field firstname string ---@field lastname? string ---@field avatar? string ---@field email? string ---@field address? string ---@param phoneNumber string # the phone number to add the contact to ---@param data ContactData exports["lb-phone"]:AddContact(phoneNumber, { number = "01234567890", firstname = "John", lastname = "Doe", avatar = "https://example.com/avatar", email = "[email protected]", address = "Eclipse Towers, Penthouse Suite 1", })

Wallet app

AddTransaction

---@param phoneNumber string # the phone number to add the transaction to ---@param amount number # the amount of the transaction ---@param title string # the title of the transaction ---@param image? string # the image URL of the transaction exports["lb-phone"]:AddTransaction(phoneNumber, amount, title, image)

Security

GetPin

---@param phoneNumber string ---@return string? # nil if the phone doesn't have a pin local pin = exports["lb-phone"]:GetPin(phoneNumber)

ResetSecurity

---@param phoneNumber string exports["lb-phone"]:ResetSecurity(phoneNumber)

Mail

CreateMailAccount

---@param address string ---@param password string ---@param cb? function ---@return boolean success ---@return string? reason local result = exports["lb-phone"]:CreateMailAccount(address, password)

GetEmailAddress

---@param phoneNumber string ---@return string? local email = exports["lb-phone"]:GetEmailAddress(phoneNumber)

SendMail

---@class MailAction ---@field label string ---@field data { event: string, isServer: boolean, data: any } ---@class MailData ---@field to string # The email address to send the mail to, or "all" to send it to everyone ---@field sender? string # The sender of the email, defaults to "System" ---@field subject? string # The subject of the email, defaults to "System mail" ---@field message? string # The message of the email ---@field attachments? string[] # URLs of the attachments ---@field actions? MailAction[] # Actions (buttons) that the user can interact with ---@param data MailData ---@return boolean success ---@return number | string # The id of the mail, or the error reason if it failed local success, id = exports["lb-phone"]:SendMail(data)

When a player presses an action, the event is triggered with the id of the mail and data:

local success, id = exports["lb-phone"]:SendMail({ to = "[email protected]", subject = "Your order", message = "Your order is ready to be picked up.", actions = { { label = "Set waypoint", data = { event = "my-script:setWaypoint", isServer = false, data = { x = 428.9, y = -984.5 } } } } }) -- client side ---@param mailId number ---@param data { x: number, y: number } AddEventHandler("my-script:setWaypoint", function(mailId, data) SetNewWaypoint(data.x, data.y) end)

DeleteMail

---@param id number ---@return boolean success local success = exports["lb-phone"]:DeleteMail(id)

Messages/SMS

SendMessage

You need to provide a message, attachments, or both. Returns nil if the message wasn’t sent, e.g. if one of the numbers has blocked the other.

---@param from string # The sender's phone number ---@param to string # The recipient's phone number ---@param message? string # The message content ---@param attachments? string[] # URLs of the attachments ---@param cb? fun(channelId: number | false) ---@param channelId? number # The channel ID to send the message to ---@return { channelId: number, messageId: number }? local result = exports["lb-phone"]:SendMessage(from, to, message, attachments, cb, channelId)

SentMoney

Used to send a message to a player indicating that they have received money.

---@param from string # The sender's phone number ---@param to string # The recipient's phone number ---@param amount number # The amount of money sent exports["lb-phone"]:SentMoney(from, to, amount)

SendCoords

---@param from string # The sender's phone number ---@param to string # The recipient's phone number ---@param coords vector2 | vector3 | vector4 | { x: number, y: number } exports["lb-phone"]:SendCoords(from, to, coords)

DarkChat

SendDarkChatMessage

---@param username string ---@param channel string ---@param message string ---@param cb? fun(success: boolean) ---@return boolean local success = exports["lb-phone"]:SendDarkChatMessage(username, channel, message, cb)

SendDarkChatLocation

---@param username string ---@param channel string ---@param coords vector2 ---@param cb? fun(success: boolean) ---@return boolean local success = exports["lb-phone"]:SendDarkChatLocation(username, channel, coords, cb)

CreateDarkChatChannel

---@param channel string ---@param password? string ---@return boolean success ---@return string? reason local success, reason = exports["lb-phone"]:CreateDarkChatChannel(channel, password)

DeleteDarkChatChannel

---@param channel string ---@param deleteMessages boolean ---@return boolean success local success = exports["lb-phone"]:DeleteDarkChatChannel(channel, deleteMessages)

AddUserToDarkChatChannel

---@param username string ---@param channel string ---@return boolean success local success = exports["lb-phone"]:AddUserToDarkChatChannel(username, channel)

RemoveUserFromDarkChatChannel

---@param username string ---@param channel string ---@return boolean success local success = exports["lb-phone"]:RemoveUserFromDarkChatChannel(username, channel)

Battery

SaveBattery

Saves the battery level of a player’s equipped phone to the database.

---@param source number exports["lb-phone"]:SaveBattery(source)

SaveAllBatteries

Saves the battery level of all online players’ equipped phones to the database.

exports["lb-phone"]:SaveAllBatteries()

IsPhoneDead

---@param phoneNumber string ---@return boolean local dead = exports["lb-phone"]:IsPhoneDead(phoneNumber)

Calls

CreateCall

Creates a call that is not shown on the phone UI, e.g. for payphones. You need to set either callee or options.company. Returns nil if the call couldn’t be created.

---@param caller string | { source: number, phoneNumber: string } # The caller's phone number, or a table with the caller's source and the number to show ---@param callee? string # The phone number of the person being called ---@param options? { requirePhone?: boolean, hideNumber?: boolean, company?: string } ---@return number? callId local callId = exports["lb-phone"]:CreateCall({ phoneNumber = "Abc 123", source = src }, number, { requirePhone = false, hideNumber = true })

GetCall

---@class CallData ---@field callId number ---@field started number # The os.time() when the call started ---@field answered boolean ---@field videoCall boolean ---@field hideCallerId boolean ---@field exportCall? boolean # Whether the call was created using the CreateCall export ---@field videoRequested? boolean ---@field company? string ---@field custom? { number: string, forwarded: boolean } # Set if the call is to a custom number ---@field caller { source?: number, number: string, nearby: number[] } ---@field callee { source?: number, number?: string, nearby: number[] } ---@param callId number ---@return CallData? local call = exports["lb-phone"]:GetCall(callId)

EndCall

Ends the call that a player is in. Returns false if the player isn’t in a call.

---@param source number ---@param cb? fun(success: boolean) ---@return boolean success local success = exports["lb-phone"]:EndCall(source)

IsInCall

See GetCall for the call data.

---@param source number ---@return boolean inCall ---@return number? callId ---@return CallData? call local inCall, callId, call = exports["lb-phone"]:IsInCall(source)

ForwardCall

Forwards a call to a custom number to another phone number or a company. The call can only be forwarded once, and it has to be forwarded before it has been answered.

---@class ForwardCallOptions ---@field number? string # The phone number to forward the call to ---@field company? string # The company to forward the call to ---@field hideNumber? boolean # Whether the caller's number should be hidden ---@alias ForwardCallError ---| "invalid_destination" # You need to set either number or company, not both ---| "caller_not_in_custom_call" ---| "already_forwarded" ---| "call_answered" ---| "company_calls_disabled" ---| "invalid_company" ---| "caller_is_target" ---| "blocked" ---| "target_unavailable" ---| "target_busy" ---| "call_ended" ---@param source number # The player that called the custom number ---@param options ForwardCallOptions ---@return number? callId ---@return ForwardCallError? errorReason local callId, errorReason = exports["lb-phone"]:ForwardCall(source, { number = "1234567890" }) if not callId then print("Failed to forward call:", errorReason) end

Crypto

Types

---@alias CryptoCoinPermissions { buy?: boolean, sell?: boolean, transfer?: boolean } ---@class CryptoCoin ---@field id string ---@field name string ---@field symbol string ---@field image string ---@field current_price number ---@field prices number[] ---@field change_24h number ---@field permissions? CryptoCoinPermissions ---@class OwnedCryptoCoin : CryptoCoin ---@field owned? number ---@field invested? number

AddCrypto

---@param target string | number # The player identifier or source ---@param coin string ---@param amount number ---@return boolean local success = exports["lb-phone"]:AddCrypto(target, coin, amount)

RemoveCrypto

---@param target string | number # The player identifier or source ---@param coin string ---@param amount number ---@return boolean local success = exports["lb-phone"]:RemoveCrypto(target, coin, amount)

AddCustomCoin

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

GetCoin

---@param id string ---@return CryptoCoin? local coinData = exports["lb-phone"]:GetCoin(id)

GetOwnedCoin

Gets a player’s balance and investment data together with the current coin data. target can be a player source or an identifier.

---@param target string | number # The player identifier or source ---@param coin string ---@return OwnedCryptoCoin | false local coinData = exports["lb-phone"]:GetOwnedCoin(target, coin)

Callbacks

CallbackOptions

---@class CallbackOptions ---@field preventSpam? boolean # Prevents the same callback from being called until the previous one has finished ---@field rateLimit? number # How many times this callback can be called per player per minute ---@field defaultReturn? any # Default return value if the callback is not called or fails

RegisterCallback

---@param event string ---@param handler fun(source: number, ...) : any ---@param options? CallbackOptions exports["lb-phone"]:RegisterCallback(event, handler, options)

BaseCallback

---@param event string ---@param callback fun(source: number, phoneNumber: string, ...) : ... ---@param options? CallbackOptions exports["lb-phone"]:BaseCallback(event, callback, options)

AwaitClientCallback

---@param event string ---@param source number ---@param ... ---@return ... local result = exports["lb-phone"]:AwaitClientCallback(event, source, ...)

TriggerClientCallback

---@param event string ---@param source number ---@param cb fun(...) ---@param ... any exports["lb-phone"]:TriggerClientCallback(event, source, cb, ...)