RconCommand Log
#1

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
Reply
#2

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

XD Not Login "LOG"
Reply
#4

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;
}
Reply
#5

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

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!

Reply
#7

Try it by yourself it only logs unknow commands
Reply
#8

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;
}
Reply
#9

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.
Reply
#10

playerid works in onrconcommand?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)