SendClientEvent
A named event with a string payload to one player’s client script.
The client script’s KcdMp.on_event(name, fn) handler for name receives it (or its KcdMp.on_any_event); a client
without a script, or without a handler for the name, ignores it. payload is a string - format it however the two halves
agree. Nothing is queued for a client that has not loaded the level yet.
Syntax
Section titled “Syntax”SendClientEvent(pid, name [, payload])| Parameter | Type | |
|---|---|---|
pid |
number | the player |
name |
string | the event’s name |
payload |
string | the string to send ("" without) (optional) |
Returns
Section titled “Returns”boolean - false when not connected
Example
Section titled “Example”-- a marker the client script drawsSendClientEvent(pid, "marker", string.format("%.1f,%.1f,%.1f", x, y, z))See also
Section titled “See also”SendClientEventToAll · OnClientEvent · SetPlayerState · the Script events group of the index
