onPlayerPart

Description

This is called when a player disconnects from the server.

NameDescription
playerThe pointer of the player
reasonReason ID for the part

Reasons

IDReasonDetails
0TimeoutThe player's connection was lost.
1QuitThe player purposefully quit, either using the /quit (/q) command or via the pause menu.
2Kick/BanThe player was kicked or banned by the server.
3CrashThe player's game crashed or their network had a fault.

Example

In this example the server will send a message when a player leaves the server

function onPlayerPart(player, reason) {
switch(reason) {
case 0: {
Message("[#fbfd49]"+player.Name+" quit the game (timeout).");
break;
}
case 1: {
Message("[#fbfd49]"+player.Name+" quit the game (quit).");
break;
}
case 2: {
Message("[#fbfd49]"+player.Name+" quit the game (kicked/banned).");
break;
}
case 3: {
Message("[#fbfd49]"+player.Name+" quit the game (crash).");
break;
}
}
}