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.
Syntax
Section titled “Syntax”SendServerEvent(name [, payload])| Parameter | Type | |
|---|---|---|
name |
string | the event’s name |
payload |
string | the string to send (optional) |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”SendServerEvent("marker_reached", tostring(markerIndex))See also
Section titled “See also”OnServerEvent · the Script events group of the index
