Server Exports
RoadPhone Pro provides several server-side exports that allow other resources to interact with the phone system.
getPlayerFromPhone
Get a player’s server ID from their phone number.
local playerId = exports [ 'roadphone' ]: getPlayerFromPhone ( number )
The phone number to look up.
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 )
The player’s identifier (license, citizenid, etc.).
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 )
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 )
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 )
The transaction reason/description.
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 )
The cryptocurrency ID (1 = Bitcoin, 2 = Ethereum, etc.).
-- 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 )
-- 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 )
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 )
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 )
The sender’s email address.
Optional action button configuration.
exports [ 'roadphone' ]: sendMailOffline ( "license:abc123" , {
senderMail = "[email protected] " ,
subject = "Account Verification" ,
message = "Your account has been verified. Welcome to the server!"
})
-- With action button
exports [ 'roadphone' ]: sendMailOffline ( "license:abc123" , {
senderMail = "[email protected] " ,
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 )
The source player ID sending the dispatch.
The dispatch message content.
The target job name (e.g., “police”, “ambulance”).
Optional coordinates for the dispatch location.
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 )
The dispatch title/sender name shown in the notification.
The dispatch message content.
The dispatch location coordinates.
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 )
The RoadDrop data object.
The sender’s name/identifier shown in the notification.
Optional message content.
Optional image URL to send.
Array of player server IDs to send to. If not provided, sends to nearby players.
-- 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 = "[email protected] " ,
subject = "Payment Confirmed" ,
message = string.format ( "Your payment of %.4f has been processed." , amount )
})
return true
end
return false
end