/giveallweapon problem [Weapon Name]
#3

"weaponid" is integer and you use %s specifier in format to get the name of it which won't happen. Since you have an array with the names, just use it and index the weaponid itself.

A native function exists by the way: https://sampwiki.blast.hk/wiki/GetWeaponName

Just for more: If you open sscanf2.inc and scroll at the bottom, you'll notice a custom specifier called "weapon":
pawn Код:
SSCANF:weapon(string[])
{
    ...
}
You can replace in the if/else if statements the function strcmp with strfind (remember if what returns is not equal to -1, the text was found) and simply use in sscanf (in commands):
pawn Код:
new weaponid, ammo;

if (sscanf(params, "k<weapon>i", weaponid, ammo)) return ... // send usage
if (weaponid == -1) return ... // invalid weapon name/ID
Reply


Messages In This Thread
/giveallweapon problem [Weapon Name] - by ahmedraed - 04.11.2016, 17:13
Respuesta: /giveallweapon problem [Weapon Name] - by Ner0x96 - 04.11.2016, 17:18
Re: /giveallweapon problem [Weapon Name] - by Konstantinos - 04.11.2016, 17:27
Re: /giveallweapon problem [Weapon Name] - by ahmedraed - 04.11.2016, 17:48

Forum Jump:


Users browsing this thread: 1 Guest(s)