Notification System

Send custom notifications to the phone interface.
apptitle
string
required
App name to display
title
string
required
Notification title
message
string
required
Notification message content
img
string
required
Path to app icon
local notifyData = {
    apptitle = "APPTITLE",
    title = "TITLE",
    message = "MESSAGE",
    img = "/public/img/Apps/light_mode/settings.webp"
}

exports["roadphone"]:sendNotification(notifyData)

Dispatch System

Basic Dispatch

Send a dispatch to a specific job.
message
string
required
Dispatch message content
job
string
required
Job name that should receive the dispatch (from SQL jobs table)
image
string
Image URL or nil
local jobreceived = "JOBNAME"
local message = "MESSAGE"
local image = "IMAGE LINK"

exports["roadphone"]:sendDispatch(message, job, image)

Dispatch with Custom Coordinates

Send a dispatch with specific coordinates instead of player position.
coords
table
default:"GetEntityCoords(PlayerPedId())"
Custom coordinates for the dispatch
jobreceived
string
required
Job name that should receive the dispatch
message
string
required
Dispatch message content
image
string
Image URL or nil
local coords = GetEntityCoords(PlayerPedId())
local position = {x = coords.x, y = coords.y, z = coords.z - 1}
local jobreceived = "JOBNAME"
local message = "MESSAGE"
local image = nil

TriggerServerEvent('roadphone:sendDispatch', GetPlayerServerId(PlayerId()), message, jobreceived, position, false, image)

Phone State Functions

isFlightmode

Check if flight mode is enabled.
return
boolean
Returns true if flight mode is enabled, false otherwise
flightmode = exports['roadphone']:isFlightmode()
print(flightmode)

isFlashlight

Check if flashlight is enabled.
return
boolean
Returns true if flashlight is enabled, false otherwise
flashlight = exports['roadphone']:isFlashlight()
print(flashlight)

togglePhone

Toggle phone open/closed state.
exports['roadphone']:togglePhone()

isPhoneOpen

Check if phone is currently open.
return
boolean
Returns true if phone is open, false if closed
isphonopen = exports['roadphone']:isPhoneOpen()
print(isphonopen)

isPlayerMuted

Check if player is muted in call.
return
boolean
Returns true if muted, false otherwise
muted = exports['roadphone']:isPlayerMuted()
print(muted)

Phone Data Functions

getPhoneNumber

Get the player’s phone number.
return
string
Returns the player’s phone number
number = exports['roadphone']:getPhoneNumber()
print(number)

Communication Functions

sendMessage

Send a text message to another player.
phoneNumber
string
required
Target phone number
message
string
required
Message content to send
exports['roadphone']:sendMessage(phoneNumber, message)

startCall

Initiate a phone call.
number
string
required
Number to call
anonym
boolean
required
Whether to make an anonymous call
exports['roadphone']:startCall(number, anonym)

Phone Access Control

isBlocked

Check if phone is blocked.
return
boolean
Returns true if blocked, false otherwise
local blocked = exports['roadphone']:isBlocked()

blockPhone

Prevent the phone from turning on.
exports['roadphone']:blockPhone()

unblockPhone

Remove blocked status from phone.
exports['roadphone']:unblockPhone()

inputFocus

Set NUI focus keep input for the phone.
boolean
boolean
required
true to enable, false to disable
exports['roadphone']:inputFocus(boolean)

Email System

sendMail

Send an email to a player.

Email with Button

sender
string
required
Sender name
subject
string
required
Email subject
message
string
required
Email message content
button
object
Optional button configuration
local data = {
   sender = 'RoadShop',
   subject = "RoadShop TEST",
   message = "Test Message",
   button = {
         buttonEvent = "qb-drugs:client:setLocation",
         buttonData = "test",
         buttonname = "test"
    }
}

exports['roadphone']:sendMail(data)

Email without Button

local data = {
   sender = 'RoadShop',
   subject = "RoadShop TEST",
   message = "Test Message"
}

exports['roadphone']:sendMail(data)

sendMailOffline

Send an email to an offline player.
identifier
string
required
Player identifier
data
object
required
Email data object (same structure as sendMail)
local data = {
   sender = 'RoadShop',
   subject = "RoadShop TEST",
   message = "Test Message"
}

exports['roadphone']:sendMailOffline(identifier, data)

Event Numbers

Configure special event numbers that trigger custom actions when called.
Configure event numbers in config.lua first before using this event.
AddEventHandler("roadphone:client:call:eventnumber", function(number)
    if tostring(number) == "77777" then  -- Check which number is called
        -- Your code here
    end
end)

Messages

getMessages

Retrieve messages for a phone number.
ESX.TriggerServerCallback('roadphone:messages:getMessages', function(data)
   print(data)
end, number)