Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.roadshop.org/llms.txt

Use this file to discover all available pages before exploring further.

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.
local isOpen = exports['roadphone']:isPhoneOpen()
returns
boolean
true if the phone is currently open, false otherwise.

isBlocked

Check if the phone is currently blocked (e.g., during certain activities).
local blocked = exports['roadphone']:isBlocked()
returns
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.
exports['roadphone']:blockPhone()
returns
boolean
Always returns true.

unblockPhone

Unblock the phone to allow normal usage again.
exports['roadphone']:unblockPhone()
returns
boolean
Always returns false.

togglePhone

Open or close the phone programmatically.
exports['roadphone']:togglePhone()
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.
local phoneNumber = exports['roadphone']:getPhoneNumber()
returns
string | nil
The player’s phone number, or nil if not available.

isFlightmode

Check if flight mode is enabled on the phone.
local flightMode = exports['roadphone']:isFlightmode()
returns
boolean
true if flight mode is enabled, false otherwise.

isFlashlight

Check if the phone flashlight is currently active.
local flashlightOn = exports['roadphone']:isFlashlight()
returns
boolean
true if the flashlight is on, false otherwise.

isPlayerMuted

Check if the player is currently muted (e.g., in a call).
local muted = exports['roadphone']:isPlayerMuted()
returns
boolean
true if the player is muted, false otherwise.

Communication

sendMessage

Send an SMS message to a phone number.
exports['roadphone']:sendMessage(phoneNumber, message)
phoneNumber
string
required
The recipient’s phone number.
message
string
required
The message content to send.
-- Send a message to a specific number
exports['roadphone']:sendMessage("1234567", "Hello from my script!")

startCall

Initiate a phone call to a specific number.
exports['roadphone']:startCall(number, anonym)
number
string
required
The phone number to call.
anonym
boolean
Whether to make an anonymous call (optional).
-- Start a normal call
exports['roadphone']:startCall("1234567")

-- Start an anonymous call
exports['roadphone']:startCall("1234567", true)
This export will automatically open the phone if it’s not already open.

sendMail

Send an email to the current player.
exports['roadphone']:sendMail(mailData)
mailData
table
required
The email data object.
exports['roadphone']:sendMail({
    senderMail = "admin@server.com",
    subject = "Welcome!",
    message = "Welcome to our server. Enjoy your stay!"
})

-- With action button
exports['roadphone']:sendMail({
    senderMail = "mechanic@server.com",
    subject = "Vehicle Ready",
    message = "Your vehicle repairs are complete.",
    button = {
        text = "Claim Vehicle",
        event = "mechanic:claimVehicle",
        data = { vehicleId = 123 }
    }
})

sendMailOffline

Send an email to a player by their identifier (works even if offline).
exports['roadphone']:sendMailOffline(identifier, mailData)
identifier
string
required
The player’s identifier (e.g., license or citizenid).
mailData
table
required
The email data object (same structure as sendMail).
exports['roadphone']:sendMailOffline("license:abc123", {
    senderMail = "admin@server.com",
    subject = "Important Notice",
    message = "This message will be delivered when you log in."
})

Notifications & Dispatches

sendNotification

Send a notification to the player’s phone.
exports['roadphone']:sendNotification(notifydata)
notifydata
table
required
The notification data object.
exports['roadphone']:sendNotification({
    apptitle = "My Script",
    title = "Success!",
    message = "Your action was completed successfully.",
    img = "/public/img/Apps/light_mode/settings.webp"
})

sendDispatch

Send a dispatch notification to job members.
exports['roadphone']:sendDispatch(message, job, image)
message
string
required
The dispatch message content.
job
string
required
The job name to send the dispatch to (e.g., “police”, “ambulance”).
image
string
Optional image URL for the dispatch.
-- Send a police dispatch
exports['roadphone']:sendDispatch("10-71 Shots Fired at Legion Square", "police")

-- With image
exports['roadphone']:sendDispatch("Medical emergency", "ambulance", "https://example.com/image.jpg")

UI Control

setHeaderBlack

Set the phone header (status bar) to black or white mode.
exports['roadphone']:setHeaderBlack(boolean)
boolean
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.
exports['roadphone']:inputFocus(boolean)
boolean
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.
exports['roadphone']:SendMessageNUI(data)
data
table
required
The data object to send to NUI. Must include an event key.
exports['roadphone']:SendMessageNUI({
    event = "customEvent",
    someData = "value"
})
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.
local accepted = exports['roadphone']:acceptCall()
returns
boolean
true if an incoming call was accepted, false if no incoming call exists.

declineCall

Decline the current incoming call.
local declined = exports['roadphone']:declineCall()
returns
boolean
true if an incoming call was declined, false if no incoming call exists.

endCall

End the current active, incoming, or outgoing call.
local ended = exports['roadphone']:endCall()
returns
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.
local callState = exports['roadphone']:getCallState()
returns
table
{ state = "idle"|"active"|"incoming"|"outgoing", number = string|nil, isMuted = boolean, contactName = string|nil }
local state = exports['roadphone']:getCallState()
if state.state == "active" then
    print("In call with: " .. (state.contactName or state.number))
    print("Muted: " .. tostring(state.isMuted))
end

Phone Data Access

getContacts

Get all contacts cached on the client.
local contacts = exports['roadphone']:getContacts()
returns
table
Array of contact objects.

getMessages

Get all messages cached on the client.
local messages = exports['roadphone']:getMessages()
returns
table
Array of message objects.

getUnreadMessages

Get all unread received messages.
local unread = exports['roadphone']:getUnreadMessages()
returns
table
Array of unread message objects (only received messages, not sent).

getRecentCalls

Get the recent call history.
local calls = exports['roadphone']:getRecentCalls()
returns
table
Array of recent call objects.

getFavouriteContacts

Get all contacts marked as favourites.
local favourites = exports['roadphone']:getFavouriteContacts()
returns
table
Array of contact objects where favourite == 1.

getNotes

Get the player’s notes (requires RoadWatch).
local notes = exports['roadphone']:getNotes()
returns
table | nil
Array of note objects, or nil if RoadWatch is disabled.

getBankTransactions

Get the bank transaction history cached on the client.
local transactions = exports['roadphone']:getBankTransactions()
returns
table
Array of bank transaction objects.

getBankIban

Get the player’s bank IBAN.
local iban = exports['roadphone']:getBankIban()
returns
string
The player’s bank IBAN string.

getWeather

Get the most recent weather data.
local weather = exports['roadphone']:getWeather()
returns
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.
local state = exports['roadphone']:getMusicState()
returns
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 }
local music = exports['roadphone']:getMusicState()
if music.isPlaying then
    print("Now playing: " .. (music.title or "Unknown") .. " by " .. (music.artist or "Unknown"))
    print("Volume: " .. music.volume .. "%")
end

watchPauseMusic

Pause the currently playing music.
local paused = exports['roadphone']:watchPauseMusic()
returns
boolean
true if pause command was sent, false if no music playing or already paused.

watchResumeMusic

Resume paused music.
local resumed = exports['roadphone']:watchResumeMusic()
returns
boolean
true if resume command was sent, false if not playing or not paused.

watchNextSong

Skip to the next song (disabled for radio).
local skipped = exports['roadphone']:watchNextSong()
returns
boolean
true if next command was sent, false if not playing or is radio.

watchPreviousSong

Go to the previous song (disabled for radio).
local skipped = exports['roadphone']:watchPreviousSong()
returns
boolean
true if previous command was sent, false if not playing or is radio.

watchSetVolume

Set the music playback volume.
local success = exports['roadphone']:watchSetVolume(volume)
volume
number
required
Volume level between 0 and 100.
returns
boolean
true if volume was set, false if invalid volume.

watchPlaySong

Play a specific song by its metadata.
local success = exports['roadphone']:watchPlaySong(song)
song
table
required
Song data object.
returns
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.
local health = exports['roadphone']:getClientHealthData()
returns
table
{ steps = number, distance = number, calories = number, activeMinutes = number, heartRate = number, stress = number, bloodPressure = { systolic = number, diastolic = number }, spo2 = number, isSleeping = boolean }
local health = exports['roadphone']:getClientHealthData()
print("Steps: " .. health.steps)
print("Heart Rate: " .. health.heartRate .. " bpm")
print("Stress: " .. health.stress .. "%")
print("SpO2: " .. health.spo2 .. "%")

getClientHeartRate

Get the player’s current simulated heart rate.
local heartRate = exports['roadphone']:getClientHeartRate()
returns
number
Current heart rate in bpm (range: 50-200).

getClientStress

Get the player’s current simulated stress level.
local stress = exports['roadphone']:getClientStress()
returns
number
Current stress level (0-100).

getClientSteps

Get the player’s accumulated step count for this session.
local steps = exports['roadphone']:getClientSteps()
returns
number
Total steps walked/run this session.