Help with Command Hunted !
#1

Remove -Fixed.
Reply
#2

Which is line 16946?
Reply
#3

Код:
new giveplayerid;
		new weapon[128];
		new price;
		new gun1,
		gun2,
		gun3,
		prizetype,
	    if(PlayerInfo[giveplayerid][pWantedLevel] >= 1 && PlayerInfo[giveplayerid][pWantedLevel] <= 6))
	    {
	        return SendClientMessage(playerid, COLOR_GRAD3, "That player has a wanted level.");
		}

		if(sscanf(params, "uiiii", giveplayerid, gun1, gun2, gun3, prizetype, price))
		{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /hunted [playerid/partofname] [gun] [gun2] [gun3] [prize]");
			SendClientMessage(playerid, COLOR_GREY, "Available weapons: Chainsaw, Flamethrower, Rocketlauncher, Fire Extinguisher, Spas, Deagle");
			SendClientMessage(playerid, COLOR_GREY, "Available prizes: Mats and Crack (400 materials, 20 crack), Jetpack, Full weaponset");
			return 1;

			else if(gun1 > 39 || gun1 < 0) return SendClientMessage(playerid,COLOR_GRAD2,"	Invalid weapon id? Use weapon IDs within 0-39!");
			else if(gun2 > 39 || gun2 < 0) return SendClientMessage(playerid,COLOR_GRAD2,"	Invalid weapon id? Use weapon IDs within 0-39!");
			else if(gun1 > 39 || gun3 < 0) return SendClientMessage(playerid,COLOR_GRAD2,"	Invalid weapon id? Use weapon IDs within 0-39!");
		}
		else
		{
			if(giveplayerid != playerid))
			{
  				GivePlayerValidWeapon(giveplayerid, gun, 60000);
	    		GivePlayerValidWeapon(giveplayerid, gun2, 60000);
		    	GivePlayerValidWeapon(giveplayerid, gun3, 60000);
		    	SetPlayerColor(playerid, 0xFF80FFFF);
		    	hunted = giveplayerid;
		    	Phunted[giveplayerid] = 1;
			}
		}
You create a variable giveplayerid, and don't assign a value to it... Because of that the code is screwed from the start.

You then check giveplayerids wanted level, THEN check if the params for sscanf have anything to assign giveplayerid.

Then your else statement, checks if the playerid != giveplayerid.


This is just bad coding...
Reply
#4

Ok i will change playerid to giveplayerid
Reply
#5

Quote:
Originally Posted by FizzyWalshy
Посмотреть сообщение
Ok i will change playerid to giveplayerid
That's not going to fix this at all...


Not in the slightest.

You're trying to make a command that makes the playerid you input in the command (giveplayerid) to be 'hunted', which, in the command you are creating giveplayerid, yet not setting it.

You then check giveplayerid, when it's not set.

You then use sscanf to check the parameters, for giveplayerid.


This is where copy-pasting gets you... You don't understand the flow of the command, nor how to actually do what you want to do, due to simply modifying commands thinking that it'll work, when it doesn't.

Another problem is this...

Код:
new gun1,
		gun2,
		gun3,
		prizetype,
It should be

Код:
new gun1,
		gun2,
		gun3,
		prizetype;
This is another issue...

Код:
if(sscanf(params, "uiiii", giveplayerid, gun1, gun2, gun3, prizetype, price))
You have user, int, int, int, int... Matching out to giveplayerid, gun1, gun2, gun3, prizetype...

Price is simply you taking /sellgun from a random script and mistakenly leaving that in there, as it should throw an error saying there's too many arguments on that function.

With what you've put in the command help, you can't simply make an assumption that you can put in words into the command and have it output correctly... It's not going to pick up that you want to give 'mats' 'crack' weaponset' magically.

Not to mention, you have this prizetype variable created, yet you also don't even use it at all in the command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)