Rcon Cmd
#1

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

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

K, thx i will try
Reply
#4

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?
Reply
#5

Bump, Help please
Reply
#6

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

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

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)