Exports
Eleven Phone exports for other FiveM resources: numbers, SMS, notifications, official mail, banking, crypto, coverage, wifi, calls, virtual lines and alerts.
What other resources can ask the phone to do. None of this is needed for the phone to work: it's for hooking up your own systems. All of them are called as exports['eleven-phone']:<name>(…).
Numbers and devices (server)
| Export | What it does |
|---|---|
GetEquippedPhoneNumber(source | citizenid) | A player's number. A source is a number and a citizenid a string. With Config.Aparatos.Unicos, their main number (the last phone of theirs they used). |
GetCarriedPhones(source) | Numbers of the phones they're carrying, the one in use first. |
GetPhoneOwner(number) | The citizenid that owns that number, or nil. |
GetSourceFromNumber(number) | The source of whoever carries that number if online, or nil. With Unicos, whoever carries that device (may not be its owner). |
GetOwnersPhones(citizenids) | Several owners' phones at once: { [citizenid] = { number, … } }. |
Messages and notifications (server)
| Export | What it does |
|---|---|
SendMessage(from, to, text, photo?, chatId?) | Sends an SMS as if from another number. |
push(source | citizenid, data) | Sends a notification to the phone's shade. |
SendNotification(number, data) | Like push, but addressed to a phone number. |
olvidaAviso(who, ref) | Withdraws a notification that no longer applies. |
correoOficial(source | citizenid, data) | Sends an email from a public body. |
Sending a notification
exports['eleven-phone']:push(source, {
app = 'mensajes',
from = 'Garage',
body = 'Your car is ready.',
})
appmust be an existing app: it provides the icon and colour.bodyis the final text. If you want it translated per player language, sendbodyKeyandbodyArgs(a key fromlocales/) instead.- With
Unicos, a citizenid reaches all their phones and asourcethe one in their hand.
Note
Notifications live in memory and are lost when the server restarts. What matters (the message, the email) stays in its table.
Sending an SMS from outside
local res = exports['eleven-phone']:SendMessage('5550100', targetNumber,
'Your card has been blocked. Call 555-0100.')
-- res = { ok = true, chatId = 12, messageId = 907 }
The sender doesn't need to belong to anyone: a number that doesn't exist makes the message read as coming from outside. With chatId, later messages land in the same conversation. It doesn't write to groups or bypass a block. On failure it returns { ok = false, reason = … } with bad_number, bad_request, marker, nobody, blocked, db or error.
Sending official mail
exports['eleven-phone']:correoOficial(citizenid, {
de = 'Los Santos City Hall',
dir = 'cityhall@sanandreas.gov',
asunto = 'Licence granted',
cuerpo = 'Your application has been approved. You can pick it up now.',
organismo = 'justicia',
})
| Field | What it is |
|---|---|
de | Who signs it. Shown in the inbox and the notification. |
dir | Sender address. If omitted, it's built from organismo. |
asunto | Subject. Can be empty. |
cuerpo | Plain text, no HTML. |
organismo | Key in Config.Correo.Organismos, for the badge. |
sinRespuesta | false to allow replies. By default replies aren't allowed. |
Returns true if the email was saved. The recipient gets a notification that opens that thread.
Banking and crypto (server)
| Export | What it does |
|---|---|
AddTransaction(number, amount, title, logo, opts?) | Notifies the phone of a transaction already recorded at the bank (it doesn't move money). With opts.auto, it skips the notification if the same amount was notified less than 10 s ago. |
AddCashNote(number, amount, title, logo) | Records a cash movement the bank doesn't see. |
GetCoins() / GetCoin(id) | The crypto catalogue and the value of one coin. |
AddCrypto(source | citizenid, coin, amount, invested?) | Credits crypto to someone's wallet. It charges nothing: invested is the dollar amount declared as paid, for portfolio P&L. |
for _, c in ipairs(exports['eleven-phone']:GetCoins()) do
print(c.id, c.label, c.price)
end
exports['eleven-phone']:AddCrypto(citizenid, 'fulgor', 1.25, 300)
Always get ids from GetCoins() instead of hard-coding them.
Services (server)
| Export | What it does |
|---|---|
avisaServicio(source, business, message, coords?) | Drops a request into a business's (job) inbox as if that player wrote it. With coords, it sends a location. |
ListaServicios() | The business directory with on-duty counts: { job, name, urgente, deTurno, x, y }. |
EnviarComoServicio(business, number, text, sender) | Replies in a business chat without an employee holding a phone (for example, from a switchboard), signed as sender. Only in an existing conversation. |
The server event eleven-phone:servicioEntrante fires with (business, number, text, x, y) whenever someone writes to a business.
Coverage and wifi
| Export | Side | What it does |
|---|---|---|
Cobertura(source) / HayCobertura(source) | server | Someone's signal bars and whether they have service. wifi holds the network name if they're in a wifi zone. |
SetWifiZones(resource, zones) | server | Sets your resource's wifi zones: { id, x, y, z, radio, nombre }. Each call replaces the previous list. |
ClearWifiZones(resource) | server | Removes your resource's wifi zones. They're removed automatically if your resource stops. |
SetPlayerWifi(resource, source, network) | server | Gives one player wifi wherever they are (inside a house, say). network = { id, nombre }; nil removes it. |
GetSignalBars() / HasSignal() | client | The local player's bars and whether they have service. |
SetSignalOverride(value) | client | Forces coverage (a jammer, a basement). nil returns it to normal. |
Repetidores() | shared | The list of masts, to draw them elsewhere. |
BarrasEn(coords) | shared | How many bars there would be at a point on the map. |
Password-protected wifi
Whoever manages a network can name it and set a password from Settings → Network and data → Wi-Fi networks. Your resource decides who manages it by exporting these two (optional) functions:
-- Does this player manage network `id` from your resource?
exports('WifiGestiona', function(src, id) return true end)
-- Networks from your resource they manage: { { id = 'house:7', nombre = 'Sunny House' } }
exports('WifiRedesDe', function(src) return {} end)
Calls (server)
| Export | What it does |
|---|---|
IsInCall(source) | Whether the player is in a call (or one is ringing). Also exists client-side, with no arguments. |
EndCall(source) | Hangs up that player's call. false if they had none. |
CreateCall(caller, number, options?) | Opens a call to a number from someone without a phone (a payphone). caller is a source or { source, label, photo }. With options.requirePhone the caller must have a phone. Returns the call id. |
CreateCallConMotivo(caller, number, options?) | Same, but returns { id, motivo } so you know why it failed. |
CreateServiceCall(caller, job) | Calls a business: it rings for everyone on duty and the first to answer takes it. Returns { id, motivo }. |
Virtual lines
A number with no phone behind it, handled by a resource of yours (a switchboard, a 911 centre). Callers dial as usual and the call rings until your console picks it up.
| Export | What it does |
|---|---|
RegistrarLineaVirtual(number, name, wait?, photo?) | Registers the line. wait: seconds it rings (90 by default). |
QuitarLineaVirtual(number) | Unregisters it. |
VirtualAnswer(id, source) | Picks up an incoming call; source is the operator who'll talk. |
TransferCall(id, source, target, stay?) | Transfers the call to { cid = … }, { numero = … } or { job = … }. With stay, the operator remains on the call. Returns { ok, motivo }. |
RegistrarLineaSms(number) / QuitarLineaSms(number) | Receive SMS sent to that number. |
Server events your resource receives:
| Event | When |
|---|---|
eleven-phone:virtual:entrante | A call comes in on a virtual line: { id, linea, src, cid, numero }. |
eleven-phone:callAnswered | Someone picks up: { id, number }. |
eleven-phone:callTransferred / eleven-phone:callTransferFailed | A transfer was picked up or failed. |
eleven-phone:callEnded | A call ends. |
eleven-phone:smsLinea | An SMS reaches a registered line: (line, from, text, attachment, chatId, id). |
Alerts (server)
Public emergency alert
A full-screen alert, with a siren if requested, shown as soon as the player has their phone on them and has signal. Received alerts are kept under Settings → Emergency alerts. You decide who receives it.
exports['eleven-phone']:AlertaEmergencia(source, {
id = 'ap-14', tipo = 'extrema', cabecera = 'Extreme alert',
titulo = 'Active shooting', mensaje = 'Avoid the Vespucci area.',
firma = 'Los Santos Police Department',
sirena = true, hora = '21:47', quedan = 3600,
evento = 'my_cad:alert:received',
})
exports['eleven-phone']:AlertaEmergenciaFin(source, 'ap-14')
evento is a server event fired with (source, id) once the phone has actually displayed it.
Critical alert
An alert that stays on screen until opened, rings even when the phone is on silent and asks for a reply (the "Acudir" and "No disponible" buttons; this screen is currently in Spanish only), which goes back to the resource that sent it. It isn't stored: if it needs repeating, the sender repeats it.
exports['eleven-phone']:AlertaCritica({ citizenid = 'ABC123' }, {
id = 'cd-14', titulo = 'ALERT', texto = '…',
coords = { x = 440.0, y = -983.0 },
evento = 'my_cad:alert:reply',
})
exports['eleven-phone']:AlertaCriticaFin({ citizenid = 'ABC123' }, { id = 'cd-14' })
The target is a person ({ citizenid = … }) or a phone ({ numero = … }). On reply, the client fires evento as a network event to the server with (id, reply) ('voy' or 'no'); register it with RegisterNetEvent and read source to know who answered. On "Acudir", the phone sets a route to reunionCoords or coords. Other fields the screen displays: subtitulo, nivel, nivelTexto, lugar, reunion, motivo, hora, activadaPor.
Business Eco accounts (server)
| Export | What it does |
|---|---|
ecoCuentaDeEmpresa(job) | The Eco account linked to that job, or nil. |
ecoAccesoLista(job) | Who runs that account: { citizenid, granted_by, at }. |
ecoAccesoDar(job, citizenid, grantedBy?) | Puts someone in charge of the account. |
ecoAccesoQuitar(job, citizenid) | Removes them. |
None of them check whether the caller is in charge of the business: your system decides that. The account is linked to a job with /ecoempresa (see Commands).
Client
| Export | What it does |
|---|---|
UsePhoneItem() | Opens the phone. It's what ox_inventory calls when the item is used. |
AddCheck('openPhone', fn) | Registers a gate: if fn() returns false, the phone won't open. Returns an id. |
RemoveCheck(id) | Removes that gate. |
IsInCall() | Whether the local player is in a call. |