Skip to main content

Server Exports

RoadPhone 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.
string
required
The phone number to look up.
number | nil
The player’s server ID (source), or nil if not found or offline.

getNumberFromIdentifier

Get a player’s phone number from their identifier.
string
required
The player’s identifier (license, citizenid, etc.).
string | nil
The player’s phone number, or nil if not found.

Banking & IBAN

getPlayerIBAN

Get or create an IBAN for a player.
number
required
The player’s server ID.
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.

getPlayerFromIBAN

Find a player by their IBAN.
string
required
The IBAN to search for.
table | nil
The player object (via Bridge.Player.GetPlayerByIdentifier), or nil if not found.

addBankTransaction

Add a bank transaction record to the transaction history.
string
required
The sender’s IBAN.
string
required
The receiver’s IBAN.
string
required
The transaction reason/description.
number
required
The transaction amount.
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.
string
required
The player’s identifier.
number
required
The cryptocurrency ID (1 = Bitcoin, 2 = Ethereum, etc.).
number
required
The amount to add.

removecrypto

Remove cryptocurrency from a player’s wallet.
string
required
The player’s identifier.
number
required
The cryptocurrency ID.
number
required
The amount to remove.

checkcryptoamount

Check if a player has at least a certain amount of cryptocurrency.
string
required
The player’s identifier.
number
required
The cryptocurrency ID.
number
required
The amount to check for.
boolean
true if the player has at least the specified amount, false otherwise.

getcryptoamount

Get the current cryptocurrency balance for a player.
string
required
The player’s identifier.
number
required
The cryptocurrency ID.
number
The player’s balance for the specified cryptocurrency.

Communication

sendMailOffline

Send an email to a player by their identifier (works even if offline).
string
required
The player’s identifier.
table
required
The email data object.

Dispatches

sendDispatch

Send a dispatch notification to all members of a specific job.
number
required
The source player ID sending the dispatch.
string
required
The dispatch message content.
string
required
The target job name (e.g., “police”, “ambulance”).
vector3 | table
Optional coordinates for the dispatch location.
string
Optional image URL for the dispatch.

sendDispatchAnonym

Send an anonymous dispatch notification (no sender information).
string
required
The target job name.
string
required
The dispatch title/sender name shown in the notification.
string
required
The dispatch message content.
vector3 | table
required
The dispatch location coordinates.
string
Optional image URL for the dispatch.
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.
table
required
The RoadDrop data object.
Deprecated Alias: sendAirdrop - Use sendRoadDrop for new implementations.

Advanced Usage Examples

Complete Dispatch System Integration

Banking Integration

Crypto Payment System


Messages

sendMessage

Send an SMS message from one phone number to another. Works for both online and offline players.
string
required
The sender’s phone number.
string
required
The recipient’s phone number.
string
required
The message content (must not be empty).
boolean
true on success, false if validation fails (missing params, empty message, same sender/receiver).

Social Media

deleteConnectAccount

Delete a Connect (Instagram) account and all associated data (posts, likes, comments, stories).
string
required
The Connect username to delete.
boolean
true if account found and deleted, false if username not found.

deleteTweetWaveAccount

Delete a TweetWave account and all associated data (tweets, likes, comments).
string
required
The TweetWave username to delete.
boolean
true if account found and deleted, false if username not found.

Taxi

saveTaxiTripToHistory

Save a taxi trip record to the database history.
string
required
The customer’s phone number.
string
The driver’s phone number (optional).
string
The driver’s name (optional).
string
The pickup street name (optional).
string
The destination street name (optional).
number
The trip price (default: 0).
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.
number
required
The player’s server ID.
table | nil
Health data table, or nil if not cached.

getPlayerHeartRate

Get a player’s current heart rate.
number
required
The player’s server ID.
number
Heart rate in bpm (default: 70 if not cached).

getPlayerStress

Get a player’s current stress level.
number
required
The player’s server ID.
number
Stress level 0-100 (default: 0 if not cached).

getPlayerSteps

Get a player’s step count for the current session.
number
required
The player’s server ID.
number
Steps today (default: 0 if not cached).

getPlayerDailyHealth

Get a player’s daily health summary from the database.
number
required
The player’s server ID.
string
Date in 'YYYY-MM-DD' format (default: today).
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.
number
required
The player’s server ID.
number
Number of days to retrieve (default: 7).
table
Array of daily health records ordered by date DESC.

isPlayerSleeping

Check if a player is currently sleeping.
number
required
The player’s server ID.
boolean
true if sleeping, false otherwise.

addSleepHours

Add sleep hours to a player’s daily health record. Useful for bed script integrations.
number
required
The player’s server ID.
number
required
Number of sleep hours to add.
boolean
true on success, false if player identifier not found.

setPlayerStress

Set a custom stress level for a player. Updates the server cache and notifies the client.
number
required
The player’s server ID.
number
required
Stress level (automatically clamped to 0-100).
boolean
true on success, false if player identifier not found.

getPlayerSpO2

Get a player’s blood oxygen saturation level.
number
required
The player’s server ID.
number
SpO2 percentage (default: 98 if not cached).

getPlayerBloodPressure

Get a player’s blood pressure values.
number
required
The player’s server ID.
table
{ systolic = number, diastolic = number } (default: { systolic = 120, diastolic = 80 }).

DarkChat

getDarkchatRooms

Get all DarkChat rooms/groups. Results are cached for 60 seconds.
table
Array of { id = number, name = string, members = table }.

getDarkchatGroupmessages

Get all DarkChat group messages. Results are cached for 60 seconds.
table
Array of { id, groupname, sender, message, members, date }.

getGroupMessages

Get messages for a specific DarkChat group.
string
required
The DarkChat group name.
number
Maximum messages to return (default: config MessageLimit or 80).
table
Array of message objects in chronological order.

Music

getMusicLibrary

Search the music library by title or artist.
Search term (optional — returns all if nil).
number
Maximum results (default: 50).
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.
number
required
The player’s server ID.
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.
number
required
The player’s server ID.
number
Battery level (0-100).

setBatteryLevel

Set a player’s battery level. Updates metadata and notifies the client.
number
required
The player’s server ID.
number
required
The new battery level (clamped to 0-100).
number
The new battery level after clamping.

chargeBattery

Charge a player’s battery by a specified amount.
number
required
The player’s server ID.
number
required
Amount to charge (e.g., 10 for 10%).
number
The new battery level (capped at 100).

isBatteryDead

Check if a player’s phone battery is dead.
number
required
The player’s server ID.
boolean
true if battery is at 0, false otherwise.

startCharging

Start realistic (gradual) charging for a player’s phone.
number
required
The player’s server ID.
boolean
true if charging started, false if already charging or battery is full.

stopCharging

Stop charging a player’s phone.
number
required
The player’s server ID.

isCharging

Check if a player’s phone is currently being charged.
number
required
The player’s server ID.
boolean
true if currently charging, false otherwise.