OnPlayerDisconnected
Внешний вид
This event is triggered when a player leaves the server.
<syntaxhighlight lang="csharp"> [ServerEvent(Event.PlayerDisconnected)] </syntaxhighlight>
Parameters
- player: parameter input should be in Player type
- type: parameter input should be in DisconnectionType type
- reason: parameter input should be in string type
Example
<syntaxhighlight lang="csharp"> [ServerEvent(Event.PlayerDisconnected)] public void OnPlayerDisconnect(Player player, DisconnectionType type, string reason) { switch (type) { case DisconnectionType.Left: player.SendChatMessage($"~b~{player.Name}~w~ has quit the server."); break; case DisconnectionType.Timeout: player.SendChatMessage($"~b~{player.Name}~w~ has timed out."); break; case DisconnectionType.Kicked: player.SendChatMessage($"~b~{player.Name}~w~ was kicked from the server {reason}."); break; } } </syntaxhighlight>