SA-MP Forums Archive
What is wrong with this CMD - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What is wrong with this CMD (/showthread.php?tid=648846)



What is wrong with this CMD - lsfmd - 29.01.2018

Код HTML:
CMD:hunted(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
 		if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6);
	    {
	        SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
			return 1;
	    }
		new giveplayerid;
		new weapon[128];
		new price;
		new gun1,
		gun2,
		gun3,
		prizetype,
		price;
	    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;
			}
		}
	}
	return 1;
}
Not really sure what is wrong with this cmd can someone help me fix it


Re: What is wrong with this CMD - RogueDrifter - 29.01.2018

You're asking us? lol


Re: What is wrong with this CMD - lsfmd - 29.01.2018

Yes please help me.


Re: What is wrong with this CMD - RogueDrifter - 29.01.2018

That's not what i meant my friend, i meant what is wrong with the cmd you are supposed to tell us, what do you get when you compile? what is not working with it exactly? etc


Re: What is wrong with this CMD - lsfmd - 29.01.2018

: error 017: undefined symbol "AdminDuty"
: warning 215: expression has no effect
: error 001: expected token: ";", but found "]"
: error 029: invalid expression, assumed zero
: fatal error 107: too many error messages on one line


Re: What is wrong with this CMD - RogueDrifter - 29.01.2018

Well here's a more readable and fixed the sscanf use you made a mistake with the closing bracket,
PHP код:
CMD:hunted(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] < 4) return 0;
    if(
AdminDuty[playerid] != && PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid,COLOR_WHITE"You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
    new 
giveplayeridweapon[128], pricegun1gun2gun3prizetypeprice;
    if(
PlayerInfo[giveplayerid][pWantedLevel] >= && PlayerInfo[giveplayerid][pWantedLevel] <= 6)) return SendClientMessage(playeridCOLOR_GRAD3"That player has a wanted level.");
    if(
sscanf(params"uiiiii"giveplayeridgun1gun2gun3prizetypeprice))
    {
        
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /hunted [playerid/partofname] [gun] [gun2] [gun3] [prize]");
        
SendClientMessage(playeridCOLOR_GREY"Available weapons: Chainsaw, Flamethrower, Rocketlauncher, Fire Extinguisher, Spas, Deagle");
        
SendClientMessage(playeridCOLOR_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)) return 0;
    
GivePlayerValidWeapon(giveplayeridgun60000);
    
GivePlayerValidWeapon(giveplayeridgun260000);
    
GivePlayerValidWeapon(giveplayeridgun360000);
    
SetPlayerColor(playerid0xFF80FFFF);
    
hunted giveplayerid;
    
Phunted[giveplayerid] = 1;
    return 
1;

But, if you still get the error you got, it simply means AdminDuty is not defined, it doesn't exist see where you're using it if its not used anywhere other than this you need to define it or remove.


Re: What is wrong with this CMD - Mugala - 29.01.2018

for first, u havnt defined AdminDuty.
define it at the top AdminDuty[MAX_PLAYERS]; but when u define this, its seems like you don't have any admin-duty system and this command is just taken from other gamemode, idk.

also check this
Код:
if(sscanf(params, "uiiii", giveplayerid, gun1, gun2, gun3, prizetype, price))
there's one param missing, price. add one more "i" or remove price from params.