#define REASON_CRASH 0 //Timed out
#define REASON_LEAVE 1 //Left normally (/q or ESC menu and quit)
#define REASON_KICK 2 //Kicked
#define REASON_BAN 3 //Banned
#define REASON_RECONNECT 4 //Custom reconnect function
native ReconnectPlayer(playerid);
native CrashPlayer(playerid);
public OnPlayerDisconnect(playerid, reason)
{
new pName[MAX_PLAYER_NAME], StringMessage[128];
GetPlayerName(playerid, pName, sizeof(pName));
switch(reason)
{
case REASON_CRASH: format(StringMessage, sizeof(StringMessage), "%s["embed_white"%i"embed_orange"]"embed_white" Has left the server! "embed_orange"[CRASH]",pName[playerid], playerid);
case REASON_LEAVE: format(StringMessage, sizeof(StringMessage), "%s["embed_white"%i"embed_orange"]"embed_white" Has left the server! "embed_orange"[LEAVING]",pName[playerid], playerid);
case REASON_KICK: format(StringMessage, sizeof(StringMessage), "%s["embed_white"%i"embed_orange"]"embed_white" Has left the server! "embed_orange"[KICK]",pName[playerid], playerid);
case REASON_BAN: format(StringMessage, sizeof(StringMessage), "%s["embed_white"%i"embed_orange"]"embed_white" Has left the server! "embed_orange"[BAN]",pName[playerid], playerid);
case REASON_RECONNECT: format(StringMessage, sizeof(StringMessage), "%s["embed_white"%i"embed_orange"]"embed_white" Has left the server! "embed_orange"[RECONNECT]",pName[playerid], playerid);
}
SendClientMessageToAll(0xFF0000AA, StringMessage);
}
Its really cool.But one bug.
When any player leaves(Normal) it stays REASON_RECONNECT.Fix that. |