is there a way to make your own RCON commands?
#10

If you want to make console commands you need to use OnRconCommand and sscanf and strcmp.

pawn Код:
public OnRconCommand(cmd[])
{
    new cmdtext[16], params[128];
    sscanf(cmd, "s[16]S( )[128]", cmdtext, params);

    if(!strcmp(cmdtext, "setname", true))
    {
        new id, newname[MAX_PLAYER_NAME];
        if(sscanf(params, "us[24]", id, newname))
        {
            print("USAGE: setname <id/name> <newname>");
        }
        else
        {
            if(id == INVALID_PLAYER_ID) print("ERROR: Player not connected.");
            else SetPlayerName(id, newname);
        }
        return 1;
    }
    return 0;
}
You'll need sscanf.

Also IMPORTANT:
pawn Код:
// Put this in a filterscript. OnRconCommand won't be called in your GM unless it is used in a FS

public OnRconCommand(cmd[]) return 1;
Just tested it and it works great.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)