17.11.2010, 19:31
Hi!
When i type /weapon i get "Error: Invalid Weapon ID",
And i mean just "/weapon" nothing else,
This is my code:
As you can see its supposed to show usage not error
When i type /weapon i get "Error: Invalid Weapon ID",
And i mean just "/weapon" nothing else,
This is my code:
pawn Код:
CMD:weapon(playerid, params[])
{
new tmp[256], tmp2[256], Index;
new Weap, Ammo, WeapName[32], String[128];
tmp = strtok(params, Index), tmp2 = strtok(params, Index);
if(!strlen(tmp)) return SendClientMessage(playerid, colorRed, "Usage: /weapon [WeaponID/PartOfName] [Ammo]");
if(!IsNumeric(tmp)) Weap = GetWeaponIDFromName(tmp); else Weap = strval(tmp);
if(!IsValidWeapon(Weap)) return SendClientMessage(playerid, colorRed, "Error: Invalid Weapon ID");
if(!strlen(tmp2) || !IsNumeric(tmp2) || strval(tmp2) <= 0 || strval(tmp2) > 99999) Ammo = 500; else Ammo = strval(tmp2);
GetWeaponName(Weap, WeapName, 32);
format(String, sizeof(String), "You have given yourself a %s (%d) with %d rounds of ammo", WeapName, Weap, Ammo);
SendClientMessage(playerid, colorBlue, String);
return GivePlayerWeapon(playerid, Weap, Ammo);
}