Skip to content

SendServerEvent

Sends an event to the game mode’s OnClientEvent.

The server accepts at most 30 events a second from one client; more is dropped. An event whose name is over 64 bytes or whose payload is over 4096 bytes (UTF-8) is not sent at all - never cut - and the refusal is written to the client’s log, so split a big payload yourself. The payload travels as the string given ("" without one) - the mode trusts it no further than any other input.

The events of the server’s web interface pages count against the same budget: the player’s script events and their pages’ events together are at most 30 events and 64 KB (name and payload) a second. What is over it is dropped, and a script that sends in bursts should spread them over a few frames. Use JsonEncode to send a table.

SendServerEvent(name [, payload])
Parameter Type
name string the event’s name
payload string the string to send (optional)

nothing

SendServerEvent("marker_reached", tostring(markerIndex))

OnServerEvent · the Script events group of the index