18.06.2012, 18:21
You can use this Log function
pawn Код:
stock Log(const filename[], const string[])
{
new hour, minute, second;
gettime(hour, minute, second);
new year, month, day;
getdate(year, month, day);
new timestamp[32];
format(timestamp, sizeof(timestamp), "[%02d/%02d/%02d | %02d:%02d:%02d] ", day, month, year, hour, minute, second);
new File:logfile = fopen(filename, io_append);
fwrite(logfile, timestamp);
fwrite(logfile, string);
fwrite(logfile, "\r\n");
fclose(logfile);
}
pawn Код:
public OnPlayerText(playerid, text[])
{
new PlayerLog[60], Name[MAX_PLAYER_NAME], string[256];
GetPlayerName(playerid, Name, sizeof(Name));
format(PlayerLog, sizeof(PlayerLog), "logs/%s.txt", Name);
format(string, sizeof(string), "%s says: %s", Name, text);
Log(PlayerLog, string);
return 1;
}