Events
Last updated on
Network events, the local view event and the page channels of the calls module.
opx:net:calls:state
Server → client. The player's whole call state, pushed on every change.
RegisterNetEvent('opx:net:calls:state', function(state) end)- state:
table— built per recipient: a name is the character's only when the recipient has that character in their contacts (by citizen id), elsecalls.unknown(Unknown caller / Correspondant inconnu). There is no account-name fallback.call?:{ id, founder, elapsedMs, participants = { { id, name, self } } }— strangers on the same call get each other's serveridand Unknown callerinvite?:{ id, kind, from, fromName, expiresInMs }— acontactoffer names its sender (offering your contact is choosing to be known)outgoing?:{ id, kind, to, toName, expiresInMs }—toNamefollows the contacts rule; a contact offer never names the person it was offered to
opx:net:calls:ready
Client → server. Ask for the state again. 1 per second.
TriggerServerEvent('opx:net:calls:ready')opx:net:calls:invite
Client → server. Call (or add to the current call) a player; kind = 'contact' offers a contact swap instead.
TriggerServerEvent('opx:net:calls:invite', targetId, kind)- targetId:
number - kind?:
'contact'
opx:net:calls:accept
Client → server. Answer the waiting invite.
TriggerServerEvent('opx:net:calls:accept', inviteId)- inviteId:
number
opx:net:calls:decline
Client → server. Refuse the waiting invite.
TriggerServerEvent('opx:net:calls:decline', inviteId)- inviteId:
number
opx:net:calls:hangup
Client → server. Leave the current call.
TriggerServerEvent('opx:net:calls:hangup')- Not on a call: withdraws the outgoing invite instead.
- On a call: never touches an invite you sent, but leaving also withdraws a pending invite you sent to join that call.
opx:net:calls:withdraw
Client → server. Withdraw the unanswered invite you sent, and nothing else; a live call is left alone. The callee gets a missed entry (not for a contact swap). Audit calls.cancel. One per REQUEST_MS.
TriggerServerEvent('opx:net:calls:withdraw')opx:net:calls:roster
Client → server. Ask for the hologram list. 1 per second.
TriggerServerEvent('opx:net:calls:roster')opx:net:calls:forget
Client → server. Delete one contact. Names the row's ref from the last list the server sent, never a citizen id. One per REQUEST_MS; an unknown ref is badRequest. Audit calls.forget. The server answers with a fresh list.
TriggerServerEvent('opx:net:calls:forget', ref)- ref:
string— up to 8 characters, e.g.'k3'
opx:net:calls:contacts
Server → client. The hologram list.
RegisterNetEvent('opx:net:calls:contacts', function(list) end)- list:
tablerows: every contact{ id, ref, name, kind, refusal }, callable ones first;refusalis why one cannot be called now; an offline contact hasid = 0andrefusal = 'offline';refnames the row forforgetrecent: newest first{ outcome, name, citizenId, atMs };outcomeisdeclined,refused,missedorunanswered;namefollows the contacts ruleonCall:boolean
opx:on:calls:view
Client, local. The state half talking to the view; the view sends it to the page as calls:holo.
AddEventHandler('opx:on:calls:view', function(payload) end)- payload:
{ kind = 'holo', ... }
Page channels
The hologram is on the interactive surface and takes keyboard and cursor while open. Escape (the platform's pause key) closes it. It shows calls.holo.dialing (Calling...) under the name you are ringing, and a calls.holo.withdraw button (CANCEL) that sends calls:withdraw. The client's internal M.State() answers { call, invite, outgoing }.
| Channel | Direction | Payload | Meaning |
|---|---|---|---|
calls:ready | page → Lua | {} | The hologram mounted; Lua asks the server for the state. |
calls:close | page → Lua | {} | Close the hologram. |
calls:toggle | page → Lua | {} | Open or close. Not sent by the shipped page. |
calls:call | page → Lua | { id } | Call that player. |
calls:share | page → Lua | { id } | Offer a contact swap. Not sent by the shipped page (the eye row does it). |
calls:accept | page → Lua | {} | Answer the waiting invite. |
calls:decline | page → Lua | {} | Refuse the waiting invite. |
calls:hangUp | page → Lua | {} | Hang up the live call; with no call, withdraw what you are ringing. |
calls:withdraw | page → Lua | {} | The Cancel button: withdraw the invite you sent, leaving any live call alone. Calls M.Withdraw(). |
calls:forget | page → Lua | { ref } | The second press on a contact's DELETE. Forwarded as opx:net:calls:forget. |
calls:diag | page → Lua | { detail } | A view-side message, relayed with OPX.Note. Not sent by the shipped page. |
calls:holo | Lua → page | { open, rows, recent, call, invite, outgoing, anchor, answerKey, declineKey } | The hologram. Sent on open/close and on every state change, also while closed (open = false), so the page can show a ringing call without taking focus. |