SA-MP Forums Archive
RconCommand Log - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: RconCommand Log (/showthread.php?tid=385924)



RconCommand Log - BiosMarcel - 18.10.2012

How can i log Rcon Commands.

Example:

/rcon 123 //Unknow Command (The Log Script put this in the text file)
/rcon unloadfs Test //Known Command (The Log Script doesn't Log ths)

Why


Re: RconCommand Log - Red_Dragon. - 18.10.2012

use
pawn Код:
/rcon login "YOUR PASS"
in the server.cfg


AW: RconCommand Log - BiosMarcel - 18.10.2012

XD Not Login "LOG"


Re: RconCommand Log - Roel - 18.10.2012

pawn Код:
public OnRconCommand(cmd[])
{
    new File:log = fopen("rconlog.txt", io_append );
    if(log)
    {
        new string[128];
        format(string,sizeof(string),"RCON COMMAND: %s",cmd);
        fwrite(log, "Server started.\r\n");
        fclose(log);
    }
    return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
    new File:log = fopen("rconlog.txt",io_append );
    if(log)
    {
        new string[128];
        format(string,sizeof(string),"RCON ATTEMPT LOGIN: IP: %s PASS: %s SUCCEED:",ip,password,success);
        fwrite(log, "Server started.\r\n");
        fclose(log);
    }
    return 1;
}



AW: RconCommand Log - BiosMarcel - 18.10.2012

It doesn't works i have tried this ^^ it only logs the unknow commands


Re: RconCommand Log - Roel - 18.10.2012

No it doesn't, if it does, you are doing something wrong.

SA-MP Wiki
Quote:

Important Note: You will need to include this callback in a loaded filterscript for it to work in the gamemode!




AW: RconCommand Log - BiosMarcel - 18.10.2012

Try it by yourself it only logs unknow commands


Re: RconCommand Log - Lordzy - 18.10.2012

Try this
pawn Код:
new File:cmdlog;

public OnRconCommand(playerid,cmd[])
{
    new str[128];
    new Lname[24];
    GetPlayerName(playerid,Lname,24);
    format(str, sizeof(str),"%s has used the command %s", cmd[])
    cmdlog = fopen("L_CMDLogs.txt", io_append);
    fwrite(cmdlog, str);
    fclose(cmdlog);
    return 0;
}



Re: RconCommand Log - Roel - 18.10.2012

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
Try this
pawn Код:
new File:cmdlog;

public OnRconCommand(playerid,cmd[])
{
    new str[128];
    new Lname[24];
    GetPlayerName(playerid,Lname,24);
    format(str, sizeof(str),"%s has used the command %s", cmd[])
    cmdlog = fopen("L_CMDLogs.txt", io_append);
    fwrite(cmdlog, str);
    fclose(cmdlog);
    return 0;
}
pawn Код:
format(str, sizeof(str),"%s has used the command %s", cmd[])
pawn Код:
format(str, sizeof(str),"%s has used the command %s", Lname,cmd)
And i think it's the same.


AW: RconCommand Log - BiosMarcel - 18.10.2012

playerid works in onrconcommand?