OnPlayerDisconnect
From SA-MP Wiki
(Difference between revisions)
Revision as of 21:07, 21 April 2014 MP2 (Talk | contribs) ← Previous diff |
Revision as of 19:47, 23 April 2014 Ikkentim (Talk | contribs) (This is a callback(NoReturn>NoReturnCallback)) Next diff → |
||
Line 7: | Line 7: | ||
{{Param|reason|The reason for the disconnection. See table below.}} | {{Param|reason|The reason for the disconnection. See table below.}} | ||
- | {{NoReturn}} | + | {{NoReturnCallback}} |
==== Reasons ==== | ==== Reasons ==== |
Revision as of 19:47, 23 April 2014
Description:
This callback is called when a player disconnects from the server.
(playerid, reason)
playerid | The ID of the player that disconnected. |
reason | The reason for the disconnection. See table below. |
Return Values:
This callback does not handle returns.
Reasons
ID | Reason | Details |
---|---|---|
0 | Timeout/Crash | The player's connection was lost. Either their game crashed or their network had a fault. |
1 | Quit | The player purposefully quit, either using the /quit (/q) command or via the pause menu. |
2 | Kick/Ban | The player was kicked or banned by the server. |
Example Usage:
public OnPlayerDisconnect(playerid, reason) { new szString[64], playerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, playerName, MAX_PLAYER_NAME); new szDisconnectReason[3][] = { "Timeout/Crash", "Quit", "Kick/Ban" }; format(szString, sizeof szString, "%s left the server (%s).", playerName, szDisconnectReason[reason]); SendClientMessageToAll(0xC4C4C4FF, szString); return 1; }
Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.
- OnPlayerConnect: Called when a player connects to the server.