Skip to content

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.

SendClientEvent(pid, name [, payload])
Parameter Type
pid number the player
name string the event’s name
payload string the string to send ("" without) (optional)

boolean - false when not connected

-- a marker the client script draws
SendClientEvent(pid, "marker", string.format("%.1f,%.1f,%.1f", x, y, z))

SendClientEventToAll · OnClientEvent · SetPlayerState · the Script events group of the index