PlayerDisconnect
Tip
This event is available on both client-side and server-side with different signatures.
Server
This event is called when a player disconnects.
Parameter | Description |
---|---|
player | The player that disconnected. |
reason | The reason the player disconnected with. |
Normal event handler
Alt.OnPlayerDisconnect += (player, reason) => {
// ...
}
Attribute event handler
Warning
Attribute event handlers only work in Scripts, or after executing Alt.RegisterEvents on a class instance.
For more info see: Create script
public class MyScript : IScript
{
[ScriptEvent(ScriptEventType.PlayerDisconnect)]
public void OnPlayerDisconnect(IPlayer player, string reason)
{
// ...
}
}
Client
This event is called when current player disconnects.
Tip
This event has no arguments.
Normal event handler
Alt.OnPlayerDisconnect += () => {
// ...
}