Errors on sscanf
#10

Quote:
Originally Posted by dice7
what are the lines 781 and 782

nvm, found it

pawn Код:
if(!strlen(Weapon)) return SendClientMessage(playerid, AdministrationError, "USAGE: /weapon [PlayerID] [WeaponID]");
if(!IsNumeric(Weapon)) return SendClientMessage(playerid, AdministrationError, "Error: Invalid WeaponID");
strlen and IsNumeric are functions for strings and Weapon is an integer

You don't need this
pawn Код:
if(!strlen(Weapon)) return SendClientMessage(playerid, AdministrationError, "USAGE: /weapon [PlayerID] [WeaponID]");
sscanf has its inbuilt error check to see if the string typed by the player can be deformated to fit the variables added as the third argument

pawn Код:
if(!IsNumeric(Weapon)) return SendClientMessage(playerid, AdministrationError, "Error: Invalid WeaponID");
Should be
pawn Код:
if(Weapon < 0 || Weapon > 46)return SendClientMessage(playerid, AdministrationError, "Error: Invalid WeaponID");
because valid weapon ids are between 0 and 46
https://sampwiki.blast.hk/wiki/Weapons
Thanks man done the trick.

Thanks, Chris.
Reply


Messages In This Thread
Errors on sscanf - by Christopher. - 21.02.2010, 19:27
Re: Errors on sscanf - by aircombat - 21.02.2010, 19:30
Re: Errors on sscanf - by Christopher. - 21.02.2010, 19:33
Re: Errors on sscanf - by aircombat - 21.02.2010, 19:39
Re: Errors on sscanf - by Christopher. - 21.02.2010, 19:46
Re: Errors on sscanf - by aircombat - 21.02.2010, 19:51
Re: Errors on sscanf - by Christopher. - 23.02.2010, 16:26
Re: Errors on sscanf - by dice7 - 23.02.2010, 16:31
Re: Errors on sscanf - by Miguel - 23.02.2010, 16:40
Re: Errors on sscanf - by Christopher. - 23.02.2010, 17:17

Forum Jump:


Users browsing this thread: 1 Guest(s)