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.
Syntax
Section titled “Syntax”function OnPlayerDisconnect(pid, reason) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the player |
reason |
string | why, as above |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”function OnPlayerDisconnect(pid, reason) SendClientMessageToAll(COLOUR_SERVER, string.format("%s left (%s)", GetPlayerName(pid), reason)) removeFromQueue(pid)endSee also
Section titled “See also”OnPlayerConnect · Kick · the Players group of the index
