SIM Card Exports
Server exports for the SIM Card System. They let another resource hand a player a working phone number, take it away, move it between phone and inventory, and charge or refill its prepaid balance.These exports exist regardless of
Config.SimCardDLC. With the DLC disabled every write export answers { ok = false, error = 'simcard_disabled' } and every read export answers empty — your integration never crashes because a server owner turned the DLC off.Return shape
Write exports always return a table:Issuing
giveSimCard
Create a SIM card and put it into the player’s inventory.number
required
The player’s server ID.
table
table
{ ok = true, number = string, simId = string, credits = number, inserted = boolean } or { ok = false, error = string }.inserted = false on an otherwise successful call means the SIM was created but did not fit into the phone (no phone, or max_sims_reached). The card is in the inventory — nothing was lost.removeSimCard
Destroy a SIM the player owns — inserted or in the inventory — and release its number.number
required
The player’s server ID.
string
required
The SIM’s number.
table
{ ok = true, number = string, from = 'phone' | 'inventory' } or { ok = false, error = string }.Moving SIMs
insertSimCard
Move a SIM from the inventory into the player’s phone.number
required
The player’s server ID.
string
required
Number of a SIM item the player carries.
table
{ ok = true, sims = table, activeSim = number } or { ok = false, error = string }.ejectSimCard
Take a SIM out of the phone and back into the inventory. The balance travels with it.number
required
The player’s server ID.
string
required
Number of an inserted SIM.
table
{ ok = true, sims = table, activeSim = number } or { ok = false, error = string }.setActiveSimCard
Make an inserted SIM the active one. This changes the player’s phone number immediately.number
required
The player’s server ID.
string
required
Number of an inserted SIM.
table
{ ok = true, number = string, credits = number, simIndex = number } or { ok = false, error = string }.Credits
addSimCredits
Top up a SIM. Works on inserted SIMs and on SIM items in the inventory.number
required
The player’s server ID.
number
required
Credits to add. Must be greater than zero.
string
Which SIM to top up. Omit for the active one.
table
{ ok = true, credits = number, number = string, from = 'phone' | 'inventory' } or { ok = false, error = string }.removeSimCredits
Deduct credits, e.g. for a premium hotline or a paid data service. Fails without changing anything when the balance is too low.number
required
The player’s server ID.
number
required
Credits to deduct. Must be greater than zero.
string
Which SIM to charge. Omit for the active one.
table
{ ok = true, credits = number, number = string, from = 'phone' | 'inventory' } or { ok = false, error = string, credits = number }.Reading
getSimCards
Everything the player carries: SIMs inside the phone, which one is active, and loose SIM items in the inventory.number
required
The player’s server ID.
table
getActiveSimNumber
The number the player currently calls and writes from.number
required
The player’s server ID.
string | nil
The active SIM’s number, or
nil when no SIM is inserted.This is the same value the core
getNumberFromSource returns while the DLC is active — use whichever reads better in your resource.getSimCredits
Credit balance of one SIM.number
required
The player’s server ID.
string
Which SIM to read. Omit for the active one.
number | nil
The balance, or
nil when the player carries no such SIM.isSimNumberInUse
Is this number already issued to a SIM card? Covers cards whose owner is offline and cards that are not inserted into any phone.string
required
The number to check.
boolean
true when the number is claimed in roadshop_simcards.The core export
isPhoneNumberInUse only knows online phones and the users table. For SIM numbers, this is the export that answers correctly.Full example: company phone plan
Issuing a work SIM on hire and revoking it on dismissal, top-ups paid by the employer.Related Resources
SIM Card System
Configuration, credits, numbers and the player flow
Server Exports
The core server-side export surface