[HELP] Saving Messages
#10

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
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;
}
thank u a lot!
but 1 question, whene i write a message , it doesn't shown in the screen before 2 or 3 seconds , is it due the code ? but anyway u gave to me a HUGE help thanks.
Reply


Messages In This Thread
[HELP] Saving Messages - by Saw® - 17.06.2012, 13:52
Re: [HELP] Saving Messages - by Kindred - 17.06.2012, 14:13
Re: [HELP] Saving Messages - by Saw® - 18.06.2012, 10:33
Re: [HELP] Saving Messages - by Saw® - 18.06.2012, 17:50
Re: [HELP] Saving Messages - by MadeMan - 18.06.2012, 18:06
Re: [HELP] Saving Messages - by MarinacMrcina - 18.06.2012, 18:11
Re: [HELP] Saving Messages - by MadeMan - 18.06.2012, 18:12
Re: [HELP] Saving Messages - by MarinacMrcina - 18.06.2012, 18:14
Re: [HELP] Saving Messages - by MadeMan - 18.06.2012, 18:21
Re: [HELP] Saving Messages - by Saw® - 19.06.2012, 09:03

Forum Jump:


Users browsing this thread: 1 Guest(s)