Called when a player drops from the server.
string reason, string resourceName, uint clientDropReason
uint32_t
).This example prints the name of the player, the reason why the player has disconnected, the resource from which the event was dispatched, and the internal client drop reason to the server console.
-- source is global here, don't add to function
AddEventHandler('playerDropped', function (reason, resourceName, clientDropReason)
print('Player ' .. GetPlayerName(source) .. ' dropped (Reason: ' .. reason .. ', Resource: ' .. resourceName .. ', Client Drop Reason: ' .. clientDropReason .. ')')
end)
// In class constructor
EventHandlers["playerDropped"] += new Action<Player, string, string, uint>(OnPlayerDropped);
// Delegate method
private void OnPlayerDropped([FromSource]Player player, string reason, string resourceName, uint clientDropReason)
{
Debug.WriteLine($"Player {player.Name} dropped (Reason: {reason}, Resource: {resourceName}, Client Drop Reason: {clientDropReason}).");
}
on("playerDropped", (reason, resourceName, clientDropReason) => {
console.log(`Player ${GetPlayerName(global.source)} dropped (Reason: ${reason}, Resource: ${resourceName}, Client Drop Reason: ${clientDropReason}).`);
});