Skip to main content

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 = "[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)
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 = "[email protected]",
            subject = "Payment Confirmed",
            message = string.format("Your payment of %.4f has been processed.", amount)
        })

        return true
    end
    return false
end