Client exports
All exports
Every export of fx-phone and its bundled app resources, with the side it runs on and a link to its reference.
Everything another resource can call on fx-phone:
lualocal open = exports['fx-phone']:IsOpen()
The resource folder must be named fx-phone.
#Before you start
- Client exports run on the player's own game and act on that player's phone.
- Server exports take a player (
src, the server id) or a character (identifier: citizenid on QBCore and Qbox, identifier on ESX). An identifier works for offline characters too. - Phone numbers are strings:
'5551234', not5551234. - Exports do not check permissions. They act as the system. If you call one on behalf of a player, check first that the player is allowed to do it.
- An export that can fail returns
falseornil, and often a short error code as the second value. See Error codes. - Image links must be
https://on a host allowed inServerConfig.Upload.AllowedHosts, or a file of a resource (nui://my-resource/logo.png). - Whatever a resource adds (trays, popups, key binds, checks, custom apps) is removed when that resource stops.
- Exports marked "waits" ask the server or the player and block until the answer arrives. Call them from a thread or an event handler, not every frame.
#Client exports
| Export | Purpose | Reference |
|---|---|---|
IsOpen |
Whether the phone is open | Phone |
IsPhoneOnScreen |
Same value as IsOpen |
Phone |
ToggleOpen |
Open, close or toggle the phone | Phone |
OpenApp (setApp) |
Open the phone on an app | Phone |
CloseApp |
Go back to the home screen | Phone |
SetLandscape (setLandscape) |
Turn the phone on its side | Phone |
ToggleLandscape |
Flip portrait / landscape | Phone |
IsLandscape (isLandscape) |
Whether the phone is in landscape | Phone |
GetPhoneNumber (GetEquippedPhoneNumber) |
This player's number | Phone |
GetSettings |
The player's phone settings | Phone |
GetTheme |
'light' or 'dark' |
Phone |
GetConfig |
The shared Config table |
Phone |
HasPhoneItem |
Whether the player carries a phone | Phone |
ToggleDisabled |
Block or unblock the phone | Phone |
IsDisabled |
Whether the phone is blocked | Phone |
SetPhoneVariation |
Change the phone's colour | Phone |
SendNotification |
Show a notification | Notifications |
PhoneNotification |
Show a notification, positional form | Notifications |
ShowMusicTray |
Show a music player in the island | Dynamic Island |
UpdateMusicTray |
Change a music tray | Dynamic Island |
RemoveMusicTray (HideMusicTray) |
Remove a music tray | Dynamic Island |
ShowLiveTray |
Show a live activity in the island | Dynamic Island |
UpdateLiveTray |
Change a live tray | Dynamic Island |
RemoveLiveTray |
Remove a live tray | Dynamic Island |
SetIslandIndicator |
Switch a privacy dot on or off | Dynamic Island |
DoPhoneConfirmation |
Ask a yes / no question (waits) | Dialogs and pickers |
ShowComponent |
Open a contact, gallery, camera, GIF, emoji or colour picker (waits) | Dialogs and pickers |
SetPopUp |
Show a popup with buttons | Dialogs and pickers |
SetContextMenu |
Show a menu of actions | Dialogs and pickers |
CreateCall |
Start a call (waits) | Calls and contacts |
StartVideoCall |
Start a video call (waits) | Calls and contacts |
EndCall |
Hang up or decline | Calls and contacts |
IsInCall |
Whether the player is in a call | Calls and contacts |
AddContact |
Add a contact (waits) | Calls and contacts |
OpenCamera |
Open the camera, optionally with a callback | Camera and photos |
IsCameraOpen |
Whether the camera view is open | Camera and photos |
SaveToGallery |
Add media to Photos (waits) | Camera and photos |
AddCustomApp |
Register an app | Custom apps |
RemoveCustomApp |
Remove an app | Custom apps |
SendCustomAppMessage (SendCustomNUIMessage) |
Send data to an app's page | Custom apps |
SetInputFocus |
Tell the phone a text field has focus | Custom apps |
ToggleFocusKeepInput |
Keep game input while the phone has focus | Custom apps |
SetAppBadge |
Set the badge on an app icon | Custom apps |
SetAppInstalled |
Install or uninstall an app | Custom apps |
SetAppHidden |
Hide an app icon | Custom apps |
GetBattery |
Battery level | Battery, signal and flashlight |
SetBattery |
Set the battery level | Battery, signal and flashlight |
IsCharging |
Whether the phone is charging | Battery, signal and flashlight |
GetSignal |
Signal bars | Battery, signal and flashlight |
ToggleFlashlight |
Switch the flashlight | Battery, signal and flashlight |
GetFlashlight |
Whether the flashlight is on | Battery, signal and flashlight |
HasSim |
Whether the phone has a working number | SIM |
GetSimLines |
Every number in the phone, by slot (waits) | SIM |
GetSimInfo |
Everything Settings > SIM shows (waits) | SIM |
HasSecondSim |
Whether the GhostNet card works | SIM |
GetSecondSim |
The GhostNet card in the phone | SIM |
GetCryptoWallet |
The coins the player holds | Other |
GetCoinValue |
Current price of a coin | Other |
AddKeyBind |
Add a rebindable key | Other |
AddCheck |
Add an openPhone check |
Other |
RemoveCheck |
Remove a check | Other |
getQuantity |
How many of an item the player carries | Other |
hasEnoughOfItem |
Whether the player carries enough of an item | Other |
#Server exports
| Export | Purpose | Reference |
|---|---|---|
GetPhoneNumber (GetEquippedPhoneNumber) |
Number of a player or character | Players and numbers |
GetSourceFromNumber (getSourceFromNumber) |
Online player with a number | Players and numbers |
GetNumberFromIdentifier |
Number of a character | Players and numbers |
GetIdentifierFromNumber |
Character behind a number | Players and numbers |
GetWispNumber |
Number of a player's Wisp account | Players and numbers |
GetUserData (getUserData) |
Phone record of a character | Players and numbers |
GetUserDataBySource (getUserDataBySource) |
Phone record by server id | Players and numbers |
GetUserDataList (getUserDataList) |
Records of every loaded phone | Players and numbers |
SetUserData (setUserData) |
Change one field of a phone record | Players and numbers |
WipeUser (wipeUser) |
Delete a character's phone data | Players and numbers |
FactoryReset |
Reset a phone to day one | Players and numbers |
SendNotification |
Send a notification to a player or a number | Notifications |
PhoneNotification |
Send a notification, positional form | Notifications |
NotifyEveryone |
Send a notification to every phone | Notifications |
QueueNotificationForOffline |
Save a notification for a character | Notifications |
EmergencyNotification |
Show an emergency notification | Notifications |
DoPhoneConfirmation |
Ask a player a yes / no question (waits) | Notifications |
SendMessage (sendMessage) |
Send a text message | Messages and mail |
SendCoords (sendLocation) |
Send a location in a message | Messages and mail |
SentMoney |
Show a "money sent" bubble | Messages and mail |
SendMail |
Send an email | Messages and mail |
sendMail |
Send an email, cylex_phone arguments | cylex_phone compatibility |
SendCompanyMessage |
Write into a company line | Messages and mail |
GetOnDutyWorkers |
Players answering a company line | Messages and mail |
CreateCall |
Start a call from a player's phone | Calls and contacts |
StartVideoCall |
Start a video call | Calls and contacts |
EndCall |
End a player's call | Calls and contacts |
IsInCall |
Whether a player is in a call | Calls and contacts |
GetCall |
Details of a call | Calls and contacts |
AddContact |
Add a contact to a phone | Calls and contacts |
AddTransaction |
Add a row to the bank history | Bank |
addTransaction |
Add a bank history row, cylex_phone arguments | cylex_phone compatibility |
GetBankData (getBankData) |
Balance, IBAN and crypto of a character | Bank |
SetBankData (setBankData) |
Change the IBAN or the balance | Bank |
AddInvoice |
Send an invoice | Invoices |
GetInvoices (getBills) |
Invoices a character received | Invoices |
DeleteInvoice |
Delete an invoice | Invoices |
addBill |
Send an invoice, cylex_phone arguments | cylex_phone compatibility |
addBilling |
Send an invoice by IBAN, cylex_phone arguments | cylex_phone compatibility |
addSystemBill |
Send a system invoice, cylex_phone arguments | cylex_phone compatibility |
deleteBill |
Delete an invoice, cylex_phone arguments | cylex_phone compatibility |
AddCrypto |
Give coins | Crypto |
RemoveCrypto |
Take coins | Crypto |
GetOwnedCoin |
How much of a coin a character holds | Crypto |
GetCoin |
A coin and its price | Crypto |
AddCustomCoin |
Add or update your own coin | Crypto |
AddCard |
Add a card to the Wallet | Wallet |
RemoveCard |
Remove a Wallet card | Wallet |
GetCards |
Cards scripts gave a player | Wallet |
AddGalleryPhoto (addGalleryPhoto) |
Add media to a player's Photos | Photos and AirDrop |
GetPhotos (getPhotosData) |
Newest media of a player | Photos and AirDrop |
AirShare |
Offer something through AirDrop | Photos and AirDrop |
GetSocialAccount |
A social account by username | Social apps |
GetActiveSocialAccount |
The account a player is signed in to | Social apps |
SetSocialVerified |
Set or remove the verified badge | Social apps |
GetSimOwner (GetSimByNumber) |
Who a number belongs to | SIM |
GetPlayerFromNumber (GetNumberOwner) |
Owner or holder of a number | SIM |
GetSimsByIdentifier |
Every SIM of a character | SIM |
SearchSims |
Search SIMs | SIM |
IssueSim |
Create a SIM | SIM |
RegisterSim |
Put a name on a prepaid SIM | SIM |
TransferSim |
Move a SIM to another character | SIM |
BlockSim |
Block a SIM | SIM |
UnblockSim |
Lift a block | SIM |
ReissueSim |
Replace a lost card | SIM |
useSimCard |
ox_inventory item hook for SIM items | SIM |
HasSecondSim |
Whether a player's GhostNet card works | SIM |
GetSecondSim |
A player's GhostNet card | SIM |
GiveSecondSim |
Give a GhostNet card without the item | SIM |
GetAnonProfile |
A player's Anon identity | SIM |
AddAnonXp |
Give Anon XP | SIM |
GetMedicalProfile |
A character's Medical ID | Health |
GetBloodType |
A character's blood type | Health |
SetBloodType |
Change the blood type | Health |
SetMedicalField |
Change one Medical ID field | Health |
AddMedicalRecord |
Write a medical record | Health |
GetMedicalRecords |
A character's records | Health |
GetActivePrescriptions |
Prescriptions still valid | Health |
RemoveMedicalRecord |
Delete a record | Health |
ShowMedicalId |
Open a patient's Medical ID on a phone | Health |
SetAppData |
Save a value for a custom app | Custom app storage |
GetAppDataFor |
Read a custom app's saved values | Custom app storage |
AddCheck |
Add a check that can block a player action | Other |
RemoveCheck |
Remove a check | Other |
GetConfig |
The shared Config table |
Other |
GetPhoneKit |
Case and accessories on a player's phone | Other |
GiveAccessory |
Give a case or accessory | Other |
GetEquippedCase |
The case design a character has on | Other |
GetLiveChannel |
A Live channel in numbers | Other |
SetLiveVerified |
Set the Live verified badge | Other |
GetVersionStatus |
Whether fx-phone is up to date | Other |
Names in brackets are aliases: the same function under another name, kept so scripts written for cylex_phone or lb-phone work by changing only the resource name. See lb-phone compatibility and cylex_phone compatibility.
Both sides also register ForwardExport. It is internal: only the compatibility shim resources may call it.
#Bundled app resources
The app resources that ship with the phone have exports of their own, called on their own resource name, for example exports['fx-billingapp']:SendInvoice(...).
| Resource | Side | Exports | Reference |
|---|---|---|---|
fx-billingapp |
server | SendInvoice (CreateInvoice), CancelInvoice, PayInvoice, GetInvoices, GetStats, HasUnpaidInvoices, GetVersionStatus |
Billing |
fx-companyapp |
server | 52 exports for companies, employees, funds, invoices, statistics and the directory | Company |
fx-companyapp |
client | GetPhoneResource, IsAppInstalled, RefreshApp, ReinstallApp, Notify |
Company |
fx-sound |
client | Play, PlayPos, Pause, Resume, Stop, FadeStop, Seek, SetVolume, SetPosition, SetPositions, SetDistance, SetEnvironment, SetSpatial, SetFilters, GetPosition, GetDuration, Exists, GetAll, GetStats, OnStart, OnEnd, SetListener, SetMasterEQ, SetListenerEnv |
Sound |
fx-sound |
server | GetVersionStatus |
Sound |
fx-garageapp |
client | OpenApp, CloseApp |
My Vehicles |
fx-garageapp |
server | GetMileage, GetInsurance, HasUnpaidInvoices |
My Vehicles |
fx-metubeapp |
client | PlayOnClosest, GetClosestSession, OpenApp, CloseApp |
MeTube |
fx-orderapp |
client | OpenApp, CloseApp |
Order |
fx-orderapp |
server | GetBusiness |
Order |
fx-musicapp, fx-mapsapp, fx-rentalapp, fx-fansapp |
server | GetVersionStatus |
Music, Maps, Rental, Fans |