OPX//77
opx_infinitycalls

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), else calls.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 server id and Unknown caller
    • invite?: { id, kind, from, fromName, expiresInMs } — a contact offer names its sender (offering your contact is choosing to be known)
    • outgoing?: { id, kind, to, toName, expiresInMs } — toName follows 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: table
    • rows: every contact { id, ref, name, kind, refusal }, callable ones first; refusal is why one cannot be called now; an offline contact has id = 0 and refusal = 'offline'; ref names the row for forget
    • recent: newest first { outcome, name, citizenId, atMs }; outcome is declined, refused, missed or unanswered; name follows the contacts rule
    • onCall: 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 }.

ChannelDirectionPayloadMeaning
calls:readypage → Lua{}The hologram mounted; Lua asks the server for the state.
calls:closepage → Lua{}Close the hologram.
calls:togglepage → Lua{}Open or close. Not sent by the shipped page.
calls:callpage → Lua{ id }Call that player.
calls:sharepage → Lua{ id }Offer a contact swap. Not sent by the shipped page (the eye row does it).
calls:acceptpage → Lua{}Answer the waiting invite.
calls:declinepage → Lua{}Refuse the waiting invite.
calls:hangUppage → Lua{}Hang up the live call; with no call, withdraw what you are ringing.
calls:withdrawpage → Lua{}The Cancel button: withdraw the invite you sent, leaving any live call alone. Calls M.Withdraw().
calls:forgetpage → Lua{ ref }The second press on a contact's DELETE. Forwarded as opx:net:calls:forget.
calls:diagpage → Lua{ detail }A view-side message, relayed with OPX.Note. Not sent by the shipped page.
calls:holoLua → 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.

On this page