07.03.2011, 14:00
pawn Код:
forward Serverlog(string[]);
public Serverlog(string[])
{
new Year, Month2, Day;
getdate(Year, Month2, Day);
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
new entry[256];
format(entry, sizeof(entry), "[%02d.%02d.%d | %02d:%02d:%02d] %s\r\n",Day, Month2, Year, Hour, Minute, Second, string);
new File:hFile;
hFile = fopen("Server/Logs/DAY--MONTH--YEAR", io_append);
fwrite(hFile, entry);
fclose(hFile);
return 1;
}
public OnPlayerText(playerid, text[])
{
Serverlog(text);
return 1;
}
Today it is 7.Mrach.2011
Then the log should be named "7.March.2011"
And next day it should make a new log named "8.March.2011"
And then so on...
Server/Logs:
7.March.2011.log
8.March.2011.log
9.March.2011.log