14.03.2013, 11:41
Sscanf doesn't work like that. Also - for God's sake, indentation.
#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
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;
}
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