Another log file for special cmd.
#1

Hello there,

As you know there's a log file that saves everything that happens in your server, but I want another log file which gonna save every bans and reasons. for example, when some admin uses /ban cmd, he needs to type like; /ban [reason] and when he bans someone, it'll be automatically saved to the notepad file in the server documents. And IT'll be like;

Admin Fred has banned "playerid" Reason: "reason", Date:"date" Is that possible? Thank you from now.

I also need when someone gets killed, I want every kills in another log file, which will show like;

"Killer's Name" has killed "who got killed" with "weaponname" date:"date"
Reply
#2

https://sampwiki.blast.hk/wiki/File_Functions
Reply
#3

Well, I have no idea about pawn, if that's not hard, could you just write that code for me? Kill LOGS and Ban logs
Reply
#4

Quote:
Originally Posted by fuem1907
Посмотреть сообщение
Well, I have no idea about pawn, if that's not hard, could you just write that code for me? Kill LOGS and Ban logs
Never is too late to learn something new!
Reply
#5

Well, Ofc I'd like to learn somethings new about pawno but my own language is not english, so I'm not good with reading all of them, one mistake = blows everything.
Reply
#6

A small function.

pawn Код:
stock WriteLog(szFilePath[], szData[])
{
    new
        szBuffer[512],//increase/decrease the size of this array if needed
        File: LogFile = fopen( szFilePath, io_write )
    ;
   
    if( fexist( szFilePath ) )
    {
        strcat(szBuffer, szData);
        strcat(szBuffer, "\r\n");
        fwrite(LogFile, szBuffer);
        fclose(LogFile);
        return 1;
    }
    return 0;
}
USAGE:
pawn Код:
WriteLog("BANLOG.txt", "Noob was banned by (noob-banner)");
Reply
#7

thank you, is this including ban reason?
Reply
#8

I'd be so appreciete if you guys help me about these logs.
Reply
#9

The first argument to the function is the file you wish to write to, and the second argument is the string to write to the file (reason).

You make the reason in your ban command, and use this function to write it to file.
Reply
#10

Oh I thought

WriteLog("BANLOG.txt", "Noob was banned by (noob-banner)"); with this it doesnt says the reason for getting banned, but as I said I dont know anything about pawno, so


thank you very much, can you do the same think about kill logs if you have free time please? I'm really in trouble with these
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)