playerDropped

Called when a player drops from the server.

Parameters

string reason
  • source: The player that has disconnected.
  • reason: The reason why the player has disconnected.

Examples

This example prints the name of the player and the reason why the player has disconnected to the server console.

Lua Example:
-- source is global here, don't add to function
AddEventHandler('playerDropped', function (reason)
  print('Player ' .. GetPlayerName(source) .. ' dropped (Reason: ' .. reason .. ')')
end)
C# Example:
// In class constructor
EventHandlers["playerDropped"] += new Action<Player, string>(OnPlayerDropped);

// Delegate method
private void OnPlayerDropped([FromSource]Player player, string reason)
{
    Debug.WriteLine($"Player {player.Name} dropped (Reason: {reason}).");
}
JavaScript Example:
on("playerDropped", (reason) => {
    console.log(`Player ${GetPlayerName(global.source)} dropped (Reason: ${reason}).`)
});
上次修改 2020-05-27: missing paren (8ee316c)