Cmd log?
#1

Is there any script available for me to put in and it saves all the commands done IG.

Like

Scriptfiles -> Server Logs:
07-08-2011
08-08-2011
09-09-2011
And it adds more dates every day.

Please give me it if there is.
Reply
#2

Anywhere in script:
pawn Код:
forward SaveIn(filename[],text[]);
public SaveIn(filename[],text[]) // "Stolen" from LuxurioN's LuxAdmin and edited abit :P
{
    new File:Lfile;
    new filepath[ 256 ];
    new string[ 256 ];
    format(filepath,sizeof(filepath),"%s",filename);
    Lfile = fopen(filepath,io_append);
    format(string,sizeof(string),"%s\r\n",text);
    fwrite(Lfile,string);
    fclose(Lfile);
    return 1;
}
pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    new string[ 128 ], name[ 24 ];
    GetPlayerName( playerid, name, 24 );
    format( string, sizeof string, "%s typed a command: %s", name, cmdtext );
    printf( string );
    SaveIn( "Cmdslog.txt", string );
    return 0;
}
If you want dates, tell here.
Reply
#3

pawn Код:
stock CmdLog(p,text[])
{
    new
        File:Lfile,
        y,m,d,
        str[180],
        name[24];
    getdate(y,m,d);
    format(name,sizeof(name),"/Logs/%d-%02d-%d.txt",d,m,y);
    Lfile = fopen(name,io_append);
    GetPlayerName(p,name,sizeof(name));
    format(str,sizeof(str),"[CMD] %s typed a command: %s\r\n",name,text);
    fwrite(Lfile,str);
    fclose(Lfile);
}
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    CmdLog(playerid, cmdtext);
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)