Client exports

SIM

Client exports that read the SIMs and the GhostNet card in the player's phone.

How the two SIM slots, SIM cards and the GhostNet card work is described in SIM cards. The server exports are in SIM (server).

#HasSim

Returns whether the phone has a working number.

lua---@return boolean hasSim
exports['fx-phone']:HasSim()
luaif not exports['fx-phone']:HasSim() then return end

#GetSimLines

Returns every number in the phone, by SIM slot.

lua---@return { slot: integer, number: string }[] lines
exports['fx-phone']:GetSimLines()
luafor _, line in ipairs(exports['fx-phone']:GetSimLines()) do print(line.slot, line.number) end
  • One entry per SIM that gives service: one with a single SIM, two with two lines, an empty table with none.
  • A GhostNet card has no number and is not listed.
  • With Config.Sim.Enabled = false the result is the built-in number in slot 1.
  • This export asks the server and waits for the answer. Do not call it every frame.

#GetSimInfo

Returns everything Settings > SIM shows about this player's phone.

lua---@return table|nil info
exports['fx-phone']:GetSimInfo()
lualocal info = exports['fx-phone']:GetSimInfo()
if info and info.sim then print(info.sim.number, info.sim.carrier) end
Field Value
enabled Whether Config.Sim.Enabled is on
slots { [1] = card, [2] = card }: what sits in each slot, false for an empty slot
lines The same list as GetSimLines
primary The slot (1 or 2) of the primary line, or false
sim The primary line's SIM: { iccid, number, kind, registered, ownerName, carrier, status, insertedAt, type, slot, primary }. When no line works, the first SIM that is in. nil without a SIM
prefs { calls, texts }: 'primary' or 'ask'
emergency The emergency numbers, as strings
cards The cards in the player's inventory that the SIM screen lists
esims The player's own eSIMs that are switched off
pending A card the player used from the inventory and has not put in yet, or false
cooldown { slot1, slot2 }: seconds until each slot takes another SIM

A card in slots is one of:

  • A SIM: { type = 'line', slot, number, kind, registered, ownerName, carrier, status, iccid, insertedAt, primary }. kind is 'physical' or 'esim'; status is 'active', 'blocked', 'lost' or 'inactive'. With SIM cards off, slot 1 is the built-in number and has builtin = true.
  • A GhostNet card: { type = 'ghost', slot, line, carrier, enabled, status, active, activatedAt, expiresAt }.

This export asks the server and waits for the answer. Do not call it every frame.

#HasSecondSim

Returns whether the GhostNet card works right now: it is in the phone, switched on and not expired.

lua---@return boolean active
exports['fx-phone']:HasSecondSim()
luaif exports['fx-phone']:HasSecondSim() then openBlackMarket() end
  • The value comes from a local copy that the server keeps current, so this export does not wait.

#GetSecondSim

Returns the GhostNet card in the phone, whichever slot it is in.

lua---@return { type: 'ghost', slot: integer, line: string, carrier: string, enabled: boolean, status: 'active'|'expired', active: boolean, activatedAt: integer, expiresAt: integer }|nil sim
exports['fx-phone']:GetSecondSim()
lualocal sim = exports['fx-phone']:GetSecondSim()
if sim then print(sim.slot, sim.expiresAt) end
  • nil when the phone has no GhostNet card. The two times are unix seconds.
  • The client event fx-phone:sim2:changed fires with the same table (or nil) whenever it changes. See Client events.