Client Exports
RoadPhone 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.
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.SendMessageNUI
Send a raw message directly to the phone NUI.table
required
The data object to send to NUI. Must include an
event key.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.