Server Exports
RoadPhone Pro provides several server-side exports that allow other resources to interact with the phone system.Running the SIM Card DLC? Issuing numbers, moving SIMs between phone and inventory and charging prepaid credits have their own reference: SIM Card Exports.
Player Information
getPlayerFromPhone
Get the framework player object for an online phone holder. For a numeric server ID, usegetSourceFromPhone.
string
required
The phone number to look up.
table | nil
The framework player object, or
nil if not found or offline. Prefer getSourceFromPhone across resource boundaries because object methods do not survive serialization.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.getSourceFromPhone
Server ID of the player who owns a phone number. Prefer this overgetPlayerFromPhone across resource boundaries — a framework player object loses its methods when it is serialised out of RoadPhone.
string
required
The phone number to resolve.
number | nil
The player’s server ID, or
nil when nobody online carries that number.GetPlayerSourceByPhoneNumber(number) does exactly the same and is kept for existing integrations.GetPhoneNumberBySource
The number of the phone the player is currently using.number
required
The player’s server ID.
string | nil
The active phone number, or
nil without a phone. With the SIM Card DLC this is the active SIM’s number.isPhoneNumberInUse
Is a number already assigned to a phone? Also covers offline players via the users table.string
required
The number to check.
boolean
true when the number is taken.SIM cards have their own registry — with the SIM Card DLC use
isSimNumberInUse instead.getActivePhoneNumber
Read the number resolved by the phone’s current server-side number logic. This never assigns a new number.source is a numeric online player server ID. Returns a number string or nil. Metadata mode reads the active item; with the SIM addon it uses the active SIM. Legacy mode resolves the player’s database number. GetPhoneNumberBySource(source) wraps the same resolver.
Account Sessions
GetCloudAccountForSource
nil without a valid login. Use account.id for authorized server-side operations. Keep the full account row on the server; an item’s account_id alone is not proof of login.
GetCloudSource
nil if unavailable. This is a presence lookup, not authorization for an arbitrary caller.
Business Availability
SetServiceOpen
open boolean. Returns true on success or false, 'bad_input' for invalid arguments. Closing a job in Config.ServiceAlwaysOpen returns false, 'always_open'.
Broadcasts the updated business status. State is held in memory and resets on resource restart. Use a job configured for your business listing.
IsServiceOpen
true; invalid jobs or businesses without an open status return false.
Notifications
PhoneNotifyPlayer
Push a phone notification to a player.number
required
The player’s server ID.
table
required
PhoneNotifyNumber
Push a notification to a phone number instead of a player. This is the one you want in metadata mode: a player can carry several phones, and a notification belongs to one of them.string
required
The recipient’s phone number.
table
required
Same fields as
PhoneNotifyPlayer.Delivered live only while that phone is the one in hand. Otherwise it is queued under its number and surfaces the next time that phone is opened — offline recipients included.
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).Calls
Everything a resource needs to place, route or bill a call itself — used by the phone box and the Trap Phone, and available to any custom number range.isLeitstelleNumber
Is this number an emergency/dispatch number fromConfig.Leitstelle?
string
required
The dialed number.
boolean
true for a configured dispatch number.getLeitstelleDispatcherSource
A random on-duty dispatcher listening on that emergency number.string
required
The emergency number that was dialed.
number | nil
Server ID of a dispatcher, or
nil when nobody is on the line.Dispatchers log in from the phone’s dispatch app; membership is verified against the job configured for that number, so a player cannot put themselves on the 911 line.
generateCallChannelID
A voice channel ID from the same range the phone itself uses. Needed when a resource connects two parties on its own.string
A 7-digit channel ID.
getCallSettings
Call behaviour the core and every number provider have to agree on, so an unreachable number sounds the same everywhere.table
{ unavailableRingSeconds = number } — how long an unreachable number keeps ringing before it gives up.rememberActiveCall
Register a call the provider connected itself, so a disconnect ends it on the other side too.number
required
One participant’s server ID.
number
required
The other participant’s server ID.
forgetActiveCall
Drop a call from the register when the provider ends it.number
required
Either participant’s server ID — the pairing is removed on both sides.
Number Providers
Numbers that belong to no phone can be served by another resource: a phone box, a Trap Phone, a hotline. The core asks every registered provider in turn, and the first one that claims the number owns the call or message.1
Register on startup
boolean
true once the resource is registered — calling it twice is harmless.2
Export the contract
Every function is optional; a missing one simply means “not my number”.
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.
string
Optional cause of death, shown by dispatch systems that display one.
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.
string
Optional cause of death, shown by dispatch systems that display one.
Use this for automated systems (store alarms, speed cameras, etc.) where there’s no actual player caller.
Map Pins
Pins that a resource owns: they show up in the phone’s Maps app, optionally with a world blip and a route. The same API exists client-side.AddMapPinForPlayer
number
required
The player who should see the pin.
table
required
string | nil
The pin ID (
ext:<resource>:<id>), or nil when coordinates were missing.RemoveMapPinForPlayer
number
required
The player the pin was added for.
string
required
The ID returned by
AddMapPinForPlayer.boolean
true when the pin existed and belonged to your resource.A resource can only remove its own pins — the owner is taken from the invoking resource, not from the ID.
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.
RoadDrop
sendRoadDrop
Send a photo, a contact card or a playlist to one player’s phone, exactly like an in-game RoadDrop share.table
required
Exactly one content field is used per call —
picturelink, contact or playlist, in that order of precedence. Without any of them nothing is delivered and the sender is notified.Deprecated alias:
sendAirdrop(data) behaves identically. Use sendRoadDrop in new code.Social Media
deleteConnectAccount
Delete a Connect 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 Wave account and all associated data (posts, likes, comments). The export retains its technical name.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').Music
getMusicLibrary
Search the music library by title or artist.string
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 }.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 }).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.