[Help Please] Simple Weapon Command.
#2

Sscanf doesn't work like that. Also - for God's sake, indentation.

pawn Код:
CMD:testgun(playerid,params[]){

    if(IsPlayerInRangeOfPoint(playerid, 2, 295.8800,-38.5147,1001.5156))
    {
        new gun[5], bullets;
        if(!sscanf(params, "s[5]d", gun, bullets) && !strcmp(gun, "colt", true)) return givePlayerValidWeapon(playerid, 22, bullets);
    }
    return 1;
}
#Some explanation:
Sscanf will return false if every element is matched. So we need to search for string (5 chars will suffice for colt), and one integer (number of bullets). If sscanf is successful, then check if the string is equal "colt" (case insensitive) and return your function
Reply


Messages In This Thread
[Help Please] Simple Weapon Command. - by daddyblake - 14.03.2013, 11:30
Re: [Help Please] Simple Weapon Command. - by Misiur - 14.03.2013, 11:41
Re: [Help Please] Simple Weapon Command. - by Scrillex - 14.03.2013, 11:42
Re: [Help Please] Simple Weapon Command. - by daddyblake - 14.03.2013, 11:43
Re: [Help Please] Simple Weapon Command. - by Scrillex - 14.03.2013, 11:47

Forum Jump:


Users browsing this thread: 1 Guest(s)