28.12.2012, 05:42
I tried making a file logging system but whenever I enter a command more than once it won't make a new line and replace the first line with the current line.
Here is my LogToFile stock:
And when an admin uses a command I put this in the command function:
+rep for helpers.
Here is my LogToFile stock:
pawn Код:
stock LogToFile(filename[], log[])
{
new file[128], fullLog[200];
format(file, sizeof file, "AdminSys/Logs/%s.log", filename);
if(!dini_Exists(file)) dini_Create(file);
new File:hFile = fopen(file, io_write);
new year, month, day, hour, minute, second;
getdate(year, month, day);
gettime(hour, minute, second);
format(fullLog, sizeof fullLog, "[%d/%d/%d - %d:%d:%d] %s\r\n", day, month, year, hour, minute, second, log);
fwrite(hFile, fullLog);
fclose(hFile);
return 1;
}
pawn Код:
LogToFile("commandName", formattedLog);