Skip to content

OnServerEvent

The game mode sent an event to this player’s game.

Every event the mode’s SendClientEvent or SendClientEventToAll addressed to this player arrives here, with its name and the string it carried. An error inside is logged ([KcdMp] OnServerEvent: ...), never fatal.

function OnServerEvent(name, payload)
-- ...
end
Parameter Type
name string the event’s name, as the mode sends it
payload string the string the mode sent ("" when it sent none)

nothing

function OnServerEvent(name, payload)
if name == "marker" then
local x, y, z = payload:match("^([^,]+),([^,]+),(.+)$")
marker = {x = tonumber(x), y = tonumber(y), z = tonumber(z)}
print("marker at " .. payload)
end
end

SendServerEvent · the Script events group of the index