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.

Server Exports

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

Player Information

getPlayerFromPhone

Get a player’s server ID from their phone number.
local playerId = exports['roadphone']:getPlayerFromPhone(number)
number
string
required
The phone number to look up.
returns
number | nil
The player’s server ID (source), or nil if not found or offline.
local source = exports['roadphone']:getPlayerFromPhone("1234567")
if source then
    print("Player found with source: " .. source)
else
    print("Player not found or offline")
end

getNumberFromIdentifier

Get a player’s phone number from their identifier.
local phoneNumber = exports['roadphone']:getNumberFromIdentifier(identifier)
identifier
string
required
The player’s identifier (license, citizenid, etc.).
returns
string | nil
The player’s phone number, or nil if not found.
local phoneNumber = exports['roadphone']:getNumberFromIdentifier("license:abc123")
if phoneNumber then
    print("Phone number: " .. phoneNumber)
end

Banking & IBAN

getPlayerIBAN

Get or create an IBAN for a player.
local iban = exports['roadphone']:getPlayerIBAN(source)
source
number
required
The player’s server ID.
returns
string
The player’s IBAN. If the player doesn’t have one, a new unique IBAN will be generated.
IBAN format is configurable via Cfg.BankIBANPrefix (default: “DE”) + 6 random digits.
local iban = exports['roadphone']:getPlayerIBAN(source)
print("Player IBAN: " .. iban) -- e.g., "DE123456"

getPlayerFromIBAN

Find a player by their IBAN.
local player = exports['roadphone']:getPlayerFromIBAN(iban)
iban
string
required
The IBAN to search for.
returns
table | nil
The player object (via Bridge.Player.GetPlayerByIdentifier), or nil if not found.
local player = exports['roadphone']:getPlayerFromIBAN("DE123456")
if player then
    -- Player found - use based on your framework
end

addBankTransaction

Add a bank transaction record to the transaction history.
exports['roadphone']:addBankTransaction(sender, receiver, reason, amount)
sender
string
required
The sender’s IBAN.
receiver
string
required
The receiver’s IBAN.
reason
string
required
The transaction reason/description.
amount
number
required
The transaction amount.
local senderIban = exports['roadphone']:getPlayerIBAN(senderSource)
local receiverIban = exports['roadphone']:getPlayerIBAN(receiverSource)

exports['roadphone']:addBankTransaction(
    senderIban,
    receiverIban,
    "Vehicle Purchase",
    50000
)
This only adds a transaction record - it does not transfer actual money. Handle money transfers with your framework’s banking system.

Cryptocurrency

addcrypto

Add cryptocurrency to a player’s wallet.
exports['roadphone']:addcrypto(identifier, coinid, amount)
identifier
string
required
The player’s identifier.
coinid
number
required
The cryptocurrency ID (1 = Bitcoin, 2 = Ethereum, etc.).
amount
number
required
The amount to add.
-- Add 0.5 Bitcoin to player
exports['roadphone']:addcrypto("license:abc123", 1, 0.5)

removecrypto

Remove cryptocurrency from a player’s wallet.
exports['roadphone']:removecrypto(identifier, coinid, amount)
identifier
string
required
The player’s identifier.
coinid
number
required
The cryptocurrency ID.
amount
number
required
The amount to remove.
-- Remove 0.25 Bitcoin from player
exports['roadphone']:removecrypto("license:abc123", 1, 0.25)

checkcryptoamount

Check if a player has at least a certain amount of cryptocurrency.
local hasAmount = exports['roadphone']:checkcryptoamount(identifier, coinid, amount)
identifier
string
required
The player’s identifier.
coinid
number
required
The cryptocurrency ID.
amount
number
required
The amount to check for.
returns
boolean
true if the player has at least the specified amount, false otherwise.
if exports['roadphone']:checkcryptoamount("license:abc123", 1, 1.0) then
    print("Player has at least 1 Bitcoin")
else
    print("Insufficient Bitcoin balance")
end

getcryptoamount

Get the current cryptocurrency balance for a player.
local amount = exports['roadphone']:getcryptoamount(identifier, coinid)
identifier
string
required
The player’s identifier.
coinid
number
required
The cryptocurrency ID.
returns
number
The player’s balance for the specified cryptocurrency.
local btcBalance = exports['roadphone']:getcryptoamount("license:abc123", 1)
print("Bitcoin balance: " .. btcBalance)

Communication

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.
mailData
table
required
The email data object.
exports['roadphone']:sendMailOffline("license:abc123", {
    senderMail = "admin@server.com",
    subject = "Account Verification",
    message = "Your account has been verified. Welcome to the server!"
})

-- With action button
exports['roadphone']:sendMailOffline("license:abc123", {
    senderMail = "bank@server.com",
    subject = "Loan Approved",
    message = "Your loan of $50,000 has been approved.",
    button = {
        text = "Claim Funds",
        event = "bank:claimLoan",
        data = { amount = 50000 }
    }
})

Dispatches

sendDispatch

Send a dispatch notification to all members of a specific job.
exports['roadphone']:sendDispatch(source, message, job, coords, image)
source
number
required
The source player ID sending the dispatch.
message
string
required
The dispatch message content.
job
string
required
The target job name (e.g., “police”, “ambulance”).
coords
vector3 | table
Optional coordinates for the dispatch location.
image
string
Optional image URL for the dispatch.
-- Basic dispatch
exports['roadphone']:sendDispatch(source, "10-71 Shots Fired", "police")

-- With coordinates
local playerCoords = GetEntityCoords(GetPlayerPed(source))
exports['roadphone']:sendDispatch(source, "Medical Emergency", "ambulance", playerCoords)

-- With image
exports['roadphone']:sendDispatch(source, "Robbery in Progress", "police", coords, "https://example.com/robbery.jpg")

sendDispatchAnonym

Send an anonymous dispatch notification (no sender information).
exports['roadphone']:sendDispatchAnonym(job, title, message, coords, image)
job
string
required
The target job name.
title
string
required
The dispatch title/sender name shown in the notification.
message
string
required
The dispatch message content.
coords
vector3 | table
required
The dispatch location coordinates.
image
string
Optional image URL for the dispatch.
-- Anonymous 911 call
exports['roadphone']:sendDispatchAnonym(
    "police",
    "Anonymous Caller",
    "There's suspicious activity at the bank",
    vector3(150.0, -1040.0, 29.0)
)

-- Store robbery alert (automated system)
exports['roadphone']:sendDispatchAnonym(
    "police",
    "Silent Alarm",
    "Store robbery triggered at 24/7 Strawberry",
    storeCoords,
    "https://example.com/alarm.jpg"
)
Use this for automated systems (store alarms, speed cameras, etc.) where there’s no actual player caller.

RoadDrop (AirDrop)

sendRoadDrop

Send a RoadDrop notification to nearby players.
exports['roadphone']:sendRoadDrop(data)
data
table
required
The RoadDrop data object.
-- Send to nearby players
exports['roadphone']:sendRoadDrop({
    sender = "John Doe",
    message = "Check this out!",
    image = "https://example.com/image.jpg"
})

-- Send to specific players
exports['roadphone']:sendRoadDrop({
    sender = "Admin",^
    message = "Important announcement",
    targetPlayers = {1, 2, 3}
})
Deprecated Alias: sendAirdrop - Use sendRoadDrop for new implementations.

Advanced Usage Examples

Complete Dispatch System Integration

-- Store robbery script integration
RegisterServerEvent('store:robbery:started')
AddEventHandler('store:robbery:started', function(storeId, storeCoords)
    local src = source

    -- Send silent alarm to police
    exports['roadphone']:sendDispatchAnonym(
        "police",
        "Silent Alarm",
        "Store robbery in progress - 24/7 #" .. storeId,
        storeCoords,
        "https://cdn.example.com/robbery-alert.png"
    )
end)

Banking Integration

-- Custom shop purchase with transaction history
function ProcessPurchase(source, itemPrice, itemName)
    local playerIban = exports['roadphone']:getPlayerIBAN(source)
    local shopIban = "DE000001" -- Shop's IBAN

    -- Handle money transfer with your framework
    -- ...

    -- Add transaction record
    exports['roadphone']:addBankTransaction(
        playerIban,
        shopIban,
        "Purchase: " .. itemName,
        itemPrice
    )
end

Crypto Payment System

-- Accept cryptocurrency payments
function AcceptCryptoPayment(identifier, coinId, amount)
    -- Check if player has enough
    if exports['roadphone']:checkcryptoamount(identifier, coinId, amount) then
        -- Remove crypto from player
        exports['roadphone']:removecrypto(identifier, coinId, amount)

        -- Send confirmation email
        exports['roadphone']:sendMailOffline(identifier, {
            senderMail = "crypto@exchange.com",
            subject = "Payment Confirmed",
            message = string.format("Your payment of %.4f has been processed.", amount)
        })

        return true
    end
    return false
end

Messages

sendMessage

Send an SMS message from one phone number to another. Works for both online and offline players.
local success = exports['roadphone']:sendMessage(senderNumber, receiverNumber, message)
senderNumber
string
required
The sender’s phone number.
receiverNumber
string
required
The recipient’s phone number.
message
string
required
The message content (must not be empty).
returns
boolean
true on success, false if validation fails (missing params, empty message, same sender/receiver).
-- Send an automated SMS
local sent = exports['roadphone']:sendMessage("911", "1234567", "Your report has been received.")

Social Media

deleteConnectAccount

Delete a Connect (Instagram) account and all associated data (posts, likes, comments, stories).
local deleted = exports['roadphone']:deleteConnectAccount(username)
username
string
required
The Connect username to delete.
returns
boolean
true if account found and deleted, false if username not found.

deleteTweetWaveAccount

Delete a TweetWave account and all associated data (tweets, likes, comments).
local deleted = exports['roadphone']:deleteTweetWaveAccount(username)
username
string
required
The TweetWave username to delete.
returns
boolean
true if account found and deleted, false if username not found.

Taxi

saveTaxiTripToHistory

Save a taxi trip record to the database history.
exports['roadphone']:saveTaxiTripToHistory(customerPhone, driverPhone, driverName, pickupStreet, destinationStreet, price, vehicleType)
customerPhone
string
required
The customer’s phone number.
driverPhone
string
The driver’s phone number (optional).
driverName
string
The driver’s name (optional).
pickupStreet
string
The pickup street name (optional).
destinationStreet
string
The destination street name (optional).
price
number
The trip price (default: 0).
vehicleType
string
The vehicle type (default: 'economy').

Health Tracking

The health system requires Config.BatterySystem or the health addon to be enabled. Server-side exports return data from the in-memory cache, which is updated by client sync events.

getPlayerHealth

Get all current health data for a player from the server cache.
local health = exports['roadphone']:getPlayerHealth(source)
source
number
required
The player’s server ID.
returns
table | nil
Health data table, or nil if not cached.
local health = exports['roadphone']:getPlayerHealth(source)
if health then
    print("Heart Rate: " .. health.heartRate)
    print("Steps: " .. health.steps)
    print("Stress: " .. health.stress)
end

getPlayerHeartRate

Get a player’s current heart rate.
local heartRate = exports['roadphone']:getPlayerHeartRate(source)
source
number
required
The player’s server ID.
returns
number
Heart rate in bpm (default: 70 if not cached).

getPlayerStress

Get a player’s current stress level.
local stress = exports['roadphone']:getPlayerStress(source)
source
number
required
The player’s server ID.
returns
number
Stress level 0-100 (default: 0 if not cached).

getPlayerSteps

Get a player’s step count for the current session.
local steps = exports['roadphone']:getPlayerSteps(source)
source
number
required
The player’s server ID.
returns
number
Steps today (default: 0 if not cached).

getPlayerDailyHealth

Get a player’s daily health summary from the database.
local summary = exports['roadphone']:getPlayerDailyHealth(source, date)
source
number
required
The player’s server ID.
date
string
Date in 'YYYY-MM-DD' format (default: today).
returns
table | nil
Database row with daily stats (steps, distance, calories, etc.), or nil if no data.

getPlayerHealthHistory

Get a player’s health history for the last N days.
local history = exports['roadphone']:getPlayerHealthHistory(source, days)
source
number
required
The player’s server ID.
days
number
Number of days to retrieve (default: 7).
returns
table
Array of daily health records ordered by date DESC.

isPlayerSleeping

Check if a player is currently sleeping.
local sleeping = exports['roadphone']:isPlayerSleeping(source)
source
number
required
The player’s server ID.
returns
boolean
true if sleeping, false otherwise.

addSleepHours

Add sleep hours to a player’s daily health record. Useful for bed script integrations.
local success = exports['roadphone']:addSleepHours(source, hours)
source
number
required
The player’s server ID.
hours
number
required
Number of sleep hours to add.
returns
boolean
true on success, false if player identifier not found.
-- Bed script integration
RegisterCommand('sleep', function(source)
    exports['roadphone']:addSleepHours(source, 8)
end)

setPlayerStress

Set a custom stress level for a player. Updates the server cache and notifies the client.
local success = exports['roadphone']:setPlayerStress(source, stressLevel)
source
number
required
The player’s server ID.
stressLevel
number
required
Stress level (automatically clamped to 0-100).
returns
boolean
true on success, false if player identifier not found.

getPlayerSpO2

Get a player’s blood oxygen saturation level.
local spo2 = exports['roadphone']:getPlayerSpO2(source)
source
number
required
The player’s server ID.
returns
number
SpO2 percentage (default: 98 if not cached).

getPlayerBloodPressure

Get a player’s blood pressure values.
local bp = exports['roadphone']:getPlayerBloodPressure(source)
source
number
required
The player’s server ID.
returns
table
{ systolic = number, diastolic = number } (default: { systolic = 120, diastolic = 80 }).

DarkChat

getDarkchatRooms

Get all DarkChat rooms/groups. Results are cached for 60 seconds.
local rooms = exports['roadphone']:getDarkchatRooms()
returns
table
Array of { id = number, name = string, members = table }.

getDarkchatGroupmessages

Get all DarkChat group messages. Results are cached for 60 seconds.
local messages = exports['roadphone']:getDarkchatGroupmessages()
returns
table
Array of { id, groupname, sender, message, members, date }.

getGroupMessages

Get messages for a specific DarkChat group.
local messages = exports['roadphone']:getGroupMessages(groupname, limit)
groupname
string
required
The DarkChat group name.
limit
number
Maximum messages to return (default: config MessageLimit or 80).
returns
table
Array of message objects in chronological order.

Music

getMusicLibrary

Search the music library by title or artist.
local songs = exports['roadphone']:getMusicLibrary(search, limit)
Search term (optional — returns all if nil).
limit
number
Maximum results (default: 50).
returns
table
Array of { id, url_type, title, artist, thumbnail, length }.
Requires RoadWatch to be enabled. Returns empty table if disabled.

getPlayerPlaylists

Get a player’s playlists and saved songs.
local data = exports['roadphone']:getPlayerPlaylists(source)
source
number
required
The player’s server ID.
returns
table
{ playlists = table, songs = table }.

Battery

Battery exports require Config.BatterySystem = true and Config.UseMetadata = true.

getBatteryLevel

Get a player’s current phone battery level.
local level = exports['roadphone']:getBatteryLevel(source)
source
number
required
The player’s server ID.
returns
number
Battery level (0-100).

setBatteryLevel

Set a player’s battery level. Updates metadata and notifies the client.
local newLevel = exports['roadphone']:setBatteryLevel(source, level)
source
number
required
The player’s server ID.
level
number
required
The new battery level (clamped to 0-100).
returns
number
The new battery level after clamping.

chargeBattery

Charge a player’s battery by a specified amount.
local newLevel = exports['roadphone']:chargeBattery(source, amount)
source
number
required
The player’s server ID.
amount
number
required
Amount to charge (e.g., 10 for 10%).
returns
number
The new battery level (capped at 100).

isBatteryDead

Check if a player’s phone battery is dead.
local dead = exports['roadphone']:isBatteryDead(source)
source
number
required
The player’s server ID.
returns
boolean
true if battery is at 0, false otherwise.

startCharging

Start realistic (gradual) charging for a player’s phone.
local started = exports['roadphone']:startCharging(source)
source
number
required
The player’s server ID.
returns
boolean
true if charging started, false if already charging or battery is full.

stopCharging

Stop charging a player’s phone.
exports['roadphone']:stopCharging(source)
source
number
required
The player’s server ID.

isCharging

Check if a player’s phone is currently being charged.
local charging = exports['roadphone']:isCharging(source)
source
number
required
The player’s server ID.
returns
boolean
true if currently charging, false otherwise.