Writing to log format
#2

Make a folder in your scriptfiles folder and name it something, like your server short form name for example, or Plik as I see it is the name in your code.

pawn Код:
// Top of your script

#define SAVE_LOGS

// Bottom of your script:

forward SaveToFile(filename[],text[]);
public SaveToFile(filename[],text[])
{
    #if defined SAVE_LOGS
    new File:Plik, filepath[256], string[256], year,month,day, hour,minute,second;
    getdate(year,month,day); gettime(hour,minute,second);

    format(filepath,sizeof(filepath),"ladmin/logs/%s.txt",filename);
    Plik = fopen(filepath,io_append);
    format(string,sizeof(string),"[%d.%d.%d %d:%d:%d] %s\r\n",day,month,year,hour,minute,second,text);
    fwrite(Plik,string);
    fclose(Plik);
    #endif
    return 1;
}
Now, make a text file in scriptfiles/Plik with a .txt extension at the end, like KickLog.txt

Next, type SaveToFile("KickLog",string); under your kick command, as this is the example for now (You can change it up if you want)

Now when the next person gets kicked, it will save a log of it in scriptfiles/Plik/KickLog.txt
Reply


Messages In This Thread
Writing to log format - by Holnista - 26.03.2011, 23:29
Re: Writing to log format - by grand.Theft.Otto - 27.03.2011, 00:52
Re: Writing to log format - by Holnista - 27.03.2011, 07:26
Re: Writing to log format - by Holnista - 27.03.2011, 10:16
Re: Writing to log format - by Holnista - 27.03.2011, 13:02

Forum Jump:


Users browsing this thread: 4 Guest(s)