07.03.2011, 20:25
pawn Код:
forward ServerLog(playerid, string[]);
public ServerLog(playerid, string[])
{
new day, month, year, hour, minute, second, entry[192], filename[32], File:file;
getdate(year, month, day);
gettime(hour, minute, second);
format(entry, sizeof (entry), "[%02i:%02i:%02i] %s(%d): %s\r\n", hour, minute, second, PlayerName(playerid), playerid, string);
format(filename, sizeof (filename), "Server/Logs/%02i.%s.%i.log", day, GetMonth(), year); //
file = ((fexist(filename)) ? (fopen(filename, io_append)) : (fopen(filename, io_write)));
fwrite(file, entry);
fclose(file);
return 1;
}
pawn Код:
ServerLog("%s(%d) Is a banana", PlayerName(playerid), playerid);
&&
ServerLog(string);
with other words
Like the "printf"
pawn Код:
printf("%s(%d) Is a banana", PlayerName(playerid), playerid);
&&
printf(string);