SA-MP Forums Archive
Rcon Cmd - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Rcon Cmd (/showthread.php?tid=158762)



Rcon Cmd - Cameltoe - 11.07.2010

How do i use the Rcon cmd callback?

on wiki it only says:

pawn Код:
public OnRconCommand(cmd[])
{
    printf("You typed %s!",cmd);
    return 1;
}
Id like this callback a bit more explained, and how could i do like:
pawn Код:
if(cmd == "ban 1")
?

Thx in advance!


Re: Rcon Cmd - Grim_ - 11.07.2010

I've never actually used it, but you can try
pawn Код:
if(strcmp(cmd, "ban", true) == 0)
// or
if(strcmp(cmd, "rcon ban", true) == 0)
I'm sure one of them will work, I'm just not sure which.


Re: Rcon Cmd - Cameltoe - 11.07.2010

K, thx i will try


Re: Rcon Cmd - Cameltoe - 11.07.2010

pawn Код:
public OnRconCommand(cmd[])
{
    if(strcmp(cmd, "rcon gmx", true) == 0)
    {
        SaveAccount();
        SendClientMessageToAll(COLOR_YELLOW,"_____________________________________");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_GREEN,"( ! ) Server: Server is restarting!");
        SendClientMessageToAll(COLOR_GREEN,"( ! ) Server: Account's saved!");
        SendClientMessageToAll(COLOR_YELLOW,"_____________________________________");
        SendRconCommand("gmx");
    }
    if(strcmp(cmd, "gmx", true) == 0)
    {
        SaveAccount();
        SendClientMessageToAll(COLOR_YELLOW,"_____________________________________");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_GREEN,"( ! ) Server: Server is restarting!");
        SendClientMessageToAll(COLOR_GREEN,"( ! ) Server: Account's saved!");
        SendClientMessageToAll(COLOR_YELLOW,"_____________________________________");
        SendRconCommand("gmx");
    }
    if(strcmp(cmd, "/rcon gmx", true) == 0)
    {
        SaveAccount();
        SendClientMessageToAll(COLOR_YELLOW,"_____________________________________");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_GREEN,"( ! ) Server: Server is restarting!");
        SendClientMessageToAll(COLOR_GREEN,"( ! ) Server: Account's saved!");
        SendClientMessageToAll(COLOR_YELLOW,"_____________________________________");
        SendRconCommand("gmx");
    }
    return 1;
}
None of them worked any ideas?


Re: Rcon Cmd - Cameltoe - 11.07.2010

Bump, Help please


Re: Rcon Cmd - novox - 11.07.2010

with your above code try using
pawn Код:
if(!strcmp(cmd, "gmx", true))
{
     //code here
}
i know it works like this under OnPlayerCommandText, never really tried with rcon commands


Re: Rcon Cmd - MadeMan - 11.07.2010

OnRconCommand works in filterscripts only.

And this code is the right one, but I think you can't redefine already existing RCON commands like "gmx".

pawn Код:
public OnRconCommand(cmd[])
{
    if(strcmp(cmd, "gmx", true) == 0)
    {
        SaveAccount();
        SendClientMessageToAll(COLOR_YELLOW,"_____________________________________");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_GREEN,"( ! ) Server: Server is restarting!");
        SendClientMessageToAll(COLOR_GREEN,"( ! ) Server: Account's saved!");
        SendClientMessageToAll(COLOR_YELLOW,"_____________________________________");
        SendRconCommand("gmx");
    }
    return 1;
}



Re: Rcon Cmd - Cameltoe - 15.07.2010

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
OnRconCommand works in filterscripts only.

And this code is the right one, but I think you can't redefine already existing RCON commands like "gmx".

pawn Код:
public OnRconCommand(cmd[])
{
    if(strcmp(cmd, "gmx", true) == 0)
    {
        SaveAccount();
        SendClientMessageToAll(COLOR_YELLOW,"_____________________________________");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_GREEN,"( ! ) Server: Server is restarting!");
        SendClientMessageToAll(COLOR_GREEN,"( ! ) Server: Account's saved!");
        SendClientMessageToAll(COLOR_YELLOW,"_____________________________________");
        SendRconCommand("gmx");
    }
    return 1;
}
Thx, ill check with a fs. could you please explain why it's like this?