OPX//77
opx_infinityspawn

Events

Last updated on

Network and local events and page channels of the spawn module.

opx:net:spawn:offer

Server → client. A choice is open. The client ignores a second offer while one is open.

RegisterNetEvent('opx:net:spawn:offer', function(offer) end)
  • offer: table — { timeoutMs, resume }
    • resume: boolean — the character's row holds a position: the client shows a first card, Where I left off, with id 'resume'

opx:net:spawn:opened

Client → server. The menu is on screen; the player's window starts now. Only the first report counts.

TriggerServerEvent('opx:net:spawn:opened', {})

opx:net:spawn:waiting

Client → server. The join is still busy ahead of the menu (name form or fitting room up, an offer waiting). Sent every 30 s; the server takes one per 5 s. Pushes the hold on by HOLD_MAX_SECONDS, up to 30 minutes from the offer. Ignored once the menu has opened.

TriggerServerEvent('opx:net:spawn:waiting')

opx:net:spawn:choose

Client → server. The place clicked. Unknown ids are refused (spawn.noChoice) and the menu stays up. id = 'resume' keeps the row's position; it is refused the same way when the offer had no resume. Cooldown CHOOSE_COOLDOWN_MS.

TriggerServerEvent('opx:net:spawn:choose', { id = placeId })
  • id: string

opx:net:spawn:close

Server → client. Sent twice per choice. The first ({ reason }) takes the menu down before the body moves and says nothing. The second (result = true) comes after the placement: the client toasts Spawned at {place}, Back where you left off, the timeout line, or, when placed is false, You could not be moved there.

RegisterNetEvent('opx:net:spawn:close', function(result) end)
  • result: table
    • reason: string — 'chosen', 'resumed' or 'timeout'
    • result?: true — on the second message only
    • placed?: boolean — second message: whether the body was moved
    • place?: string — second message: the label chosen (config text)
    • placeId?: string — second message: its id; the client shows spawn.place.<id> when the catalogue has it

opx:on:spawn:state

Client, local. { open = true, phase = 'spawn' } when the menu opens, { open = false, phase = 'idle' } when it closes. Same shape as opx:on:entry:state.

AddEventHandler('opx:on:spawn:state', function(state) end)
  • state: table — { open, phase }

Page channels

On the interactive surface.

ChannelDirectionPayloadMeaning
spawn:openLua → page{ locations = [{ id, label, district }], title, about, hint }Draw the menu. Re-sent every 250 ms until the page takes it.
spawn:closeLua → page{}Take the menu down.
spawn:choosepage → Lua{ id }The player clicked a place. A second click within 400 ms is dropped.
focus:setpage → Lua{ focus, owner }Shared focus broadcast; the module takes keyboard and cursor while its owner spawn is on top.

On this page