SA-MP Forums Archive
OnPlayerDisconnect - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerDisconnect (/showthread.php?tid=316632)



OnPlayerDisconnect - BGMike - 07.02.2012

Hello, I have a proble, here is my codes:

Код:
	new string[128];
	new name[MAX_PLAYER_NAME];
	new ip[20];
	GetPlayerIp(playerid,ip,sizeof(ip));
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0:
		{
			format(string,sizeof string,"%s (ID: %d) left the server [Timed out]",name,playerid);
			SendNoAdminMessage(0xAFAFAFAA,string);
			format(string,sizeof string,"%s (ID: %d) left the server [IP: %s] [Timed out]",name,playerid,ip);
			SendReportMessage(0xAFAFAFAA,string);
		}
        case 1:
		{
			format(string,sizeof string,"%s (ID: %d) left the server [Leaving]",name,playerid);
			SendNoAdminMessage(0xAFAFAFAA,string);
			format(string,sizeof string,"%s (ID: %d) left the server [IP: %s] [Timed out]",name,playerid,ip);
			SendReportMessage(0xAFAFAFAA,string);
		}
        case 2:
		{
			format(string,sizeof string,"%s (ID: %d) left the server [Kicked/Banned]",name,playerid);
			SendNoAdminMessage(0xAFAFAFAA,string);
			format(string,sizeof string,"%s (ID: %d) left the server [IP: %s] [Timed out]",name,playerid,ip);
			SendReportMessage(0xAFAFAFAA,string);
		}
    }
SendNoAdminMessage means tо send a message to all players with admin level 0
SendReportMessage means tо send a message to all players with admin level more than 0

And the problem is when someone leaving the server this IP appears always 255.255.255.255, but when the player is kicked/banned the corrected IP appears, but says that the player timed out.
Any ideas how to fix it ?