SA-MP Forums Archive
Logging - f*cked up - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Logging - f*cked up (/showthread.php?tid=99279)



Logging - f*cked up - Striker_Moe - 26.09.2009

Код:
public OnPlayerDisconnect(playerid, reason)
{
#if Disconnection-Log

	new hour;
	new minute;
	new second;
	new day;
	new month;
	new year;
	new cmd[264];
	new File:Disconnections;
	Disconnections = fopen("logs/disconnections.txt",io_append);
	{
	format(cmd,sizeof(cmd),"[%02d/%02d/%02d %02d:%02d:%02d] Player: %s || ID: %d || IP: %s disconnected. \r\n",day, month, year, hour, minute, second,PlayerName(playerid),playerid,PlayerIP(playerid));
	fwrite(Disconnections,cmd);
	fclose(Disconnections);
	}
	#endif
}
Thats my code, but.. this is what the file looks like:

[00/00/00 00:00:00] Player: All******* || ID: 16 || IP: 255.255.255.255 disconnected.

WTF? Whats wrong?


Re: Logging - f*cked up - Correlli - 26.09.2009

Player's ip will always be showed as 255.255.255.255 if you will try to get it at OnPlayerDisconnect callback.
About time & date: use gettime and getdate functions.


Re: Logging - f*cked up - ded - 26.09.2009

Best thing to do is get the IP OnPlayerConnect and store it then.