Commands to extra parameters return Unknown Command
#1

Hello everybody, all commands I have like /ban [id], /slap [id], /givemoney [id], /makeadmin [id], etc.. when I type /makeadmin or any other command without the extra parameter (ID) it returns the correct usage, but If I type the ID it says 'SERVER: Unknown command'

This is the main template for the commands (for admins) that have extra parameters.
pawn Код:
if(strcmp(cmdtext, "/command", true)==0)
    {
        new tmp[256];
        tmp = strtok( cmdtext, idx );
        if (!strlen(tmp))
        {
            return SendClientMessage(playerid,COLOR_GRAY,"[SERVER]: /usage");
        }
        if(PlayerInfo[playerid][pAdminLevel] == 2)
        {
            return 1;
        }
        else SendClientMessage(playerid,COLOR_GRAY,"[SERVER]: You are not an admin !");
        if(strval(tmp) == playerid) SendClientMessage(playerid,COLOR_RED,"[ERROR] You cannot do this on yourself!");
        if(strval(tmp) == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Invalid ID.");
        return 1;
    }
Now a 'full command'
pawn Код:
if(strcmp(cmdtext, "/makegolden", true)==0)
    {
        new tmp[256];
        tmp = strtok( cmdtext, idx );
        if (!strlen(tmp))
        {
            return SendClientMessage(playerid,COLOR_GRAY,"[SERVER]: /makegolden");
        }
        if(PlayerInfo[playerid][pAdminLevel] == 2)
        {
            new string[50], string2[50], adminname[MAX_PLAYER_NAME], givename[MAX_PLAYER_NAME];
            GetPlayerName(playerid, adminname, sizeof(adminname));
            GetPlayerName(playerid, givename, sizeof(givename));
            format(string, sizeof(string), " Administrator %s has made you a Golden User. Thanks for donating!", adminname);
            format(string2, sizeof(string2), " You have made %s a Golden User.", givename);
            SendClientMessage(playerid,COLOR_YELLOW,string2);
            SendClientMessage(strval(tmp),COLOR_YELLOW,string);
            PlayerInfo[strval(tmp)][pIsGolden] = 1;
            return 1;
        }
        else SendClientMessage(playerid,COLOR_GRAY,"[SERVER]: You are not an admin !");
        if(strval(tmp) == playerid) SendClientMessage(playerid,COLOR_RED,"[ERROR] You cannot do this on yourself!");
        if(strval(tmp) == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Invalid ID.");
        return 1;
    }
Help is really appreciated.
P.S: I know I use 256 cells in a small var, dont remind it to me.
Reply


Messages In This Thread
Commands to extra parameters return Unknown Command - by admantis - 08.12.2010, 05:01
Re: Commands to extra parameters return Unknown Command - by Mehtab - 08.12.2010, 05:07
Re: Commands to extra parameters return Unknown Command - by admantis - 08.12.2010, 05:10
Re: Commands to extra parameters return Unknown Command - by Mehtab - 08.12.2010, 05:24
Re: Commands to extra parameters return Unknown Command - by admantis - 08.12.2010, 05:29
Re: Commands to extra parameters return Unknown Command - by Mean - 08.12.2010, 09:21

Forum Jump:


Users browsing this thread: 1 Guest(s)