how to make a /giveplayerweapon command using strtok?
#3

You created here one only 'tmp', so 'giveplayerid', 'giveplayerweapon' and 'giveplayerammo' will return the '[PLAYERID]' parameter.
You should create two more 'tmp's, try this one:
pawn Код:
if(strcmp(cmd,"/setweapon",true)==0)
    {
        new giveplayerweapon,giveplayerammo;
        tmp = strtok(cmdtext,idx);
        new tmp2[2][64];
        tmp2[0] = strtok(cmdtext,idx), tmp2[1] = strtok(cmdtext,idx);
        if(!strlen(tmp) || !strlen(tmp2[0]) || !strlen(tmp2[1])) return SendClientMessage(playerid,0xFFF0000FF,"USAGE: /setweapon [PLAYERID] [WEAPONID]");
        {
            giveplayerid = strval(tmp);
            giveplayerweapon = strval(tmp2[0]);
            giveplayerammo = strval(tmp2[1]);
            GivePlayerWeapon(giveplayerid,giveplayerweapon,giveplayerammo);
        }
        return 1;
    }
Reply


Messages In This Thread
how to make a /giveplayerweapon command using strtok? - by CSMajor - 16.08.2010, 22:37
Re: how to make a /giveplayerweapon command using strtok? - by [XST]O_x - 16.08.2010, 22:44
Re: how to make a /giveplayerweapon command using strtok? - by Injection - 16.08.2010, 22:48

Forum Jump:


Users browsing this thread: 2 Guest(s)