How to log command usages
#2

ok i made u a very easy function to use.
it saves a file called CMDLog.txt in your scriptfiles and using Y_INI
pawn Код:
stock LogPlayerCmd(playerid,cmdtext[])
{
    new name[MAX_PLAYER_NAME], file[80],fStr[90],tStr[30];
    GetPlayerName(playerid, name, sizeof(name));
    //
    new Hour, Minute, Second;
    gettime(Hour, Minute, Second);
    format(tStr,sizeof tStr,"[%02d:%02d:%02d]",Hour, Minute, Second);
    format(fStr,sizeof fStr,"%s: %s",name,cmdtext);
    //
    new INI:Acc = INI_Open("CmdLog.txt");
    INI_WriteString(Acc,tStr, fStr);
    INI_Close(Acc);
    return 1;
}
is easy to use. for example in your command above all you have to do is add this
pawn Код:
LogPlayerCmd(playerid,"armour");
and that will save a file called "CmdLog.txt" and will have the time that the player send the cmd and the name and the cmd he typed.

NOTE if the players spams the cmd it will overweight the last cmd by him
Reply


Messages In This Thread
How to log command usages - by Tamer - 06.01.2013, 10:26
Re: How to log command usages - by park4bmx - 06.01.2013, 10:36
Re: How to log command usages - by eesh - 06.01.2013, 10:53
Re: How to log command usages - by park4bmx - 06.01.2013, 10:56
Re: How to log command usages - by eesh - 06.01.2013, 10:59
Re: How to log command usages - by Tamer - 06.01.2013, 11:04
Re: How to log command usages - by Mr.Anonymous - 06.01.2013, 11:07
Re: How to log command usages - by Tamer - 06.01.2013, 11:11

Forum Jump:


Users browsing this thread: 4 Guest(s)