Params and OnRconCommand
#1

Is there anything similar to params in OnRconCommand?
So you can e.g. type "msg hello!" into the console and ingame will be transmitted "hello!"
Reply
#2

i am not sure for this you ar not in counter-strike
Reply
#3

In console: say hello
Reply
#4

Quote:
Originally Posted by RatHack
Посмотреть сообщение
In console: say hello
I know, that was just an example. If there was an equivelent then i would use it for something like..

restart [time]
Reply
#5

I'll show you few examples with sscanf:
pawn Код:
public OnRconCommand(cmd[])
{
    if(!strcmp(cmd, "msg", false, 3))
    {//           length of "msg" ^
        new
            msg[128],
            user;
        if(sscanf(cmd[3], "us[128]", user, msg))
        {//           ^ length of "msg"
            print("SYNTAX: msg [user] [message]");
            return 1;
        }
        if(user != INVALID_PLAYER_ID)
        {
            SendClientMessage(user, -1, msg);
        }
        else
        {
            print("ERROR: player is not connected.");
        }
        return 1;
    }
    if(!strcmp(cmd, "restart", false, 7))
    {//           length of "restart" ^
        new
            time;
        if(sscanf(cmd[7], "d", time))
        {//           ^ length of "restart"
            print("SYNTAX: restart [time]");
            return 1;
        }
        printf("SERVER: server will restart in %d seconds.", time);
        SetTimer("Rcon_Restart", time * 1000, false);
        return 1;
    }
    return 1;
}
OK, now you should understand how to get parameters from cmd.
Reply
#6

Perfect! Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)