(/command [id] [time]) how can i add another variable?
#5

It's easy to add more parameters with strcmp (the old-school way :P)

pawn Код:
if(strcmp(cmd, "/aj", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pGmL] >= 2)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "Uz.yj: /aj [ID] [MIN]");
                new para1 = ReturnUser(tmp);
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "Uz.yj: /aj [ID] [MIN]");
                new level = strval(tmp);
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "Uz.yj: /aj [ID] [MIN] [PARAM 3]");
                new para3 = strval(tmp);
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "Uz.yj: /aj [ID] [MIN] [PARAM 4]");
                new para4 = strval(tmp);
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "Uz.yj: /aj [ID] [MIN] [PARAM 5]");
                new para5 = strval(tmp);
                //done...
But as everyone is saying, switch to ZCMD and SSCANF.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)