Skip to main content

Client Exports

RoadPhone Pro provides several client-side exports that allow other resources to interact with the phone system.

Phone State

isPhoneOpen

Check if the phone UI is currently open.
boolean
true if the phone is currently open, false otherwise.

isBlocked

Check if the phone is currently blocked (e.g., during certain activities).
boolean
true if the phone is blocked, false otherwise.

blockPhone

Block the phone from being used. Useful for situations where phone usage should be disabled.
boolean
Always returns true.

unblockPhone

Unblock the phone to allow normal usage again.
boolean
Always returns false.

togglePhone

Open or close the phone programmatically.
This toggles the phone state - if open it will close, if closed it will open.

closePhone

Close the phone UI. Unlike togglePhone this never opens it, and it leaves an ongoing call untouched.
The phone stays in hand while a call is running — only the UI closes.

isInPhoneCall

Is the player in any phone call — ringing, dialing, connected or in a group call?
boolean
true while any call state is active.
Broader than getCallState, which does not know about group calls. Use this before putting another prop in the player’s hand — a phone box handset, for example.

getPhoneProp

The prop model name RoadPhone would use for a phone item, honouring Config.UsePhoneProps and the item’s colour variant.
string
Phone item name or colour key (e.g. 'phone', 'purple_phone', 'silver'). Pass the actual item name, or the metadata colour on Jaksam; an omitted or unknown value uses the mapping’s default.
string
Prop model name, e.g. 'phonesilver' or the vanilla 'prop_phone_ing_03' when custom props are disabled.

Fold prop limitation

getPhoneProp does not receive active device state and does not resolve Fold’s open/closed model. See Fold configuration for the model names. The normal Fold action switches the attached prop itself.

usingRoadPods

Read whether the player is currently using RoadBuds. The export keeps its technical name and requires the RoadBuds addon to be loaded.
Returns the client-side usage flag (boolean).

setPhoneBoxActive

Tell RoadPhone that the player is using a phone box, so the phone’s own call path stands down.
boolean
required
true while the player holds a phone box handset, false when they hang up.
Only for resources that implement their own phone box. Leaving this on true blocks the player’s own phone.

Phone Information

getPhoneNumber

Get the phone number of the current player.
string | nil
The player’s phone number, or nil if not available.

isFlightmode

Check if flight mode is enabled on the phone.
boolean
true if flight mode is enabled, false otherwise.

isFlashlight

Check if the phone flashlight is currently active.
boolean
true if the flashlight is on, false otherwise.

isPlayerMuted

Check if the player is currently muted (e.g., in a call).
boolean
true if the player is muted, false otherwise.

Communication

sendMessage

Send an SMS message to a phone number.
string
required
The recipient’s phone number.
string
required
The message content to send.

startCall

Initiate a phone call to a specific number.
string
required
The phone number to call.
boolean
Whether to make an anonymous call (optional).
This export will automatically open the phone if it’s not already open.

sendMail

Send an email to the current player.
table
required
The email data object.

sendMailOffline

Send an email to a player by their identifier (works even if offline).
string
required
The player’s identifier (e.g., license or citizenid).
table
required
The email data object (same structure as sendMail).

Notifications & Dispatches

sendNotification

Send a notification to the player’s phone.
table
required
The notification data object.

sendDispatch

Send a dispatch notification to job members.
string
required
The dispatch message content.
string
required
The job name to send the dispatch to (e.g., “police”, “ambulance”).
string
Optional image URL for the dispatch.

UI Control

setHeaderBlack

Set the phone header (status bar) to black or white mode.
boolean
required
true for black header, false for white header.
Useful for apps with light backgrounds that need a dark header for visibility.

inputFocus

Control whether keyboard input is captured by NUI or passed to the game.
boolean
required
true to capture input in NUI, false to allow game input.
Use this carefully - setting to true will prevent the player from using game controls.

SendMessageNUI

Send a raw message directly to the phone NUI.
table
required
The data object to send to NUI. Must include an event key.
This is an advanced export. Only use if you understand the phone’s NUI event system.

Call Management

acceptCall

Accept the current incoming call. Useful for smartwatch or external call control.
boolean
true if an incoming call was accepted, false if no incoming call exists.

declineCall

Decline the current incoming call.
boolean
true if an incoming call was declined, false if no incoming call exists.

endCall

End the current active, incoming, or outgoing call.
boolean
true if a call was ended, false if no call exists.

getCallState

Get the current call state including direction, number, mute status, and contact name.
table
{ state = "idle"|"active"|"incoming"|"outgoing", number = string|nil, isMuted = boolean, contactName = string|nil }

Phone Data Access

getContacts

Get all contacts cached on the client.
table
Array of contact objects.

getMessages

Get all messages cached on the client.
table
Array of message objects.

getUnreadMessages

Get all unread received messages.
table
Array of unread message objects (only received messages, not sent).

getRecentCalls

Get the recent call history.
table
Array of recent call objects.

getFavouriteContacts

Get all contacts marked as favourites.
table
Array of contact objects where favourite == 1.

getNotes

Get the player’s notes (requires RoadWatch).
table | nil
Array of note objects, or nil if RoadWatch is disabled.

getBankTransactions

Get the bank transaction history cached on the client.
table
Array of bank transaction objects.

getBankIban

Get the player’s bank IBAN.
string
The player’s bank IBAN string.

getWeather

Get the most recent weather data.
table | nil
The last weather data object, or nil if not yet received.

Music Control

These exports are designed for RoadWatch (smartwatch) integration but can be used by any external resource.

getMusicState

Get the current music playback state.
table
{ isPlaying = bool, isPaused = bool, title = string|nil, artist = string|nil, image = string|nil, length = number, current = number, lengthFormatted = string, currentFormatted = string, volume = number, isRadio = bool }

watchPauseMusic

Pause the currently playing music.
boolean
true if pause command was sent, false if no music playing or already paused.

watchResumeMusic

Resume paused music.
boolean
true if resume command was sent, false if not playing or not paused.

watchNextSong

Skip to the next song (disabled for radio).
boolean
true if next command was sent, false if not playing or is radio.

watchPreviousSong

Go to the previous song (disabled for radio).
boolean
true if previous command was sent, false if not playing or is radio.

watchSetVolume

Set the music playback volume.
number
required
Volume level between 0 and 100.
boolean
true if volume was set, false if invalid volume.

watchPlaySong

Play a specific song by its metadata.
table
required
Song data object.
boolean
true if play command was sent, false if song data is invalid or missing id.

Health Tracking

These exports return client-side simulated health data. The health system must be enabled in the config.

getClientHealthData

Get all current client-side health data.
table
{ steps = number, distance = number, calories = number, activeMinutes = number, heartRate = number, stress = number, bloodPressure = { systolic = number, diastolic = number }, spo2 = number, isSleeping = boolean }

getClientHeartRate

Get the player’s current simulated heart rate.
number
Current heart rate in bpm (range: 50-200).

getClientStress

Get the player’s current simulated stress level.
number
Current stress level (0-100).

getClientSteps

Get the player’s accumulated step count for this session.
number
Total steps walked/run this session.

Live Bar

The pill at the top of the screen — the same surface the phone uses for calls, music and timers. Any resource can push its own live activity into it, and it doubles as a large live card on the lockscreen.
Delivery jobs, drug runs, taxi rides, crafting timers: anything with a duration and a progress value belongs here instead of in a chat message.

StartIslandActivity

table
required
string | nil
The activity ID (ext:<resource>:<id>), or nil when data was not a table.

UpdateIslandActivity

Patch a running activity. Only the fields you pass change.
string
required
ID returned by StartIslandActivity.
table
required
Any subset of the fields above, e.g. { progress = 60, label = '300m' }.
boolean
false when the ID is unknown or the activity has already ended.

StopIslandActivity

string
required
ID returned by StartIslandActivity.
boolean
false when the activity was already gone.
Activities of a resource are cleaned up automatically when that resource stops — no onResourceStop handler needed on your side.

Button clicks

Buttons report back as a client event:

Map Pins

One call puts a point on both maps: as a pin in the phone’s Maps app and as a blip — optionally with a GPS route — on the game map. The server-side equivalents are AddMapPinForPlayer / RemoveMapPinForPlayer.

AddMapPin

table
required
string | nil
The pin ID (ext:<resource>:<id>), or nil when data was not a table.

RemoveMapPin

string
required
The ID returned by AddMapPin.
boolean
false when the pin does not exist or belongs to another resource.

RemoveMapPins

Remove every pin this resource placed.
number
How many pins were removed.
Pins are namespaced per resource, and a resource can only remove its own. Stopping a resource clears its pins automatically.

Valet

Drives the phone’s valet flow from outside the UI — used by RoadWatch, and usable by any resource that wants a “bring me my car” button.

searchCar

Start the valet search for a plate: the car is located and marked for the player.
string
required
The vehicle plate.

deliverOrMarkCar

Deliver the vehicle to the player, or mark it on the map when delivery is not possible.
string
required
The vehicle plate.
Both run the same valet action the phone’s own buttons use, including its cost and cooldown rules from config.lua.