Skip to content

OnPlayerDisconnect

The player is gone.

reason is "disconnected" (they left), "timed out" (nothing heard for a while) or "kicked: <reason>" with the text given to Kick or Ban. Their pid may be given to the next player who joins; their SetPlayerData is cleared, their saved record has been written. A horse they controlled stays in the world (a nearby player takes it over); their dog leaves with them; every fight of theirs ends.

function OnPlayerDisconnect(pid, reason)
-- ...
end
Parameter Type
pid number the player
reason string why, as above

nothing

function OnPlayerDisconnect(pid, reason)
SendClientMessageToAll(COLOUR_SERVER, string.format("%s left (%s)", GetPlayerName(pid), reason))
removeFromQueue(pid)
end

OnPlayerConnect · Kick · the Players group of the index