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.
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 = "[email protected]",
    subject = "Welcome!",
    message = "Welcome to our server. Enjoy your stay!"
})

-- With action button
exports['roadphone']:sendMail({
    senderMail = "[email protected]",
    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 = "[email protected]",
    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.