Logging - f*cked up
#1

Код:
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?
Reply
#2

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.
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)