OnPlayerDisconnect
From SA-MP
[edit]
OnPlayerDisconnect
This callback is called when a player leaves the server.
(playerid, reason)
| playerid | ID of the player who left. |
| reason | ID of the reason why they left. |
Examples of making a text message to all of the reason player disconnects (since the native messages were taken out in 0.2.)
public OnPlayerDisconnect(playerid, reason) { new string[64], playername[ MAX_PLAYER_NAME ], reasontext[10]; if(reason == 1) reasontext = "Leaving"; else if(reason == 2) reasontext = "Kicked/Banned"; else reasontext = "Timed out"; GetPlayerName(playerid, playername, sizeof(playername)); format(string, sizeof(string), "** %s left the server (%s)", playername, reasontext); SendClientMessageToAll(0xFFFFFFFF, string); return 1; }
[edit]
Reasons
- 0 Timed out
- 1 Left normally (/q or ESC menu and quit)
- 2 Kicked or banned
This function does not return a specific value, it's best to simply ignore it.
