SA-MP Forums Archive
Command not returning a weapon - 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: Command not returning a weapon (/showthread.php?tid=613159)



Command not returning a weapon - Avetsky - 25.07.2016

Код:
CMD:knife(playerid, params[])
{
	if (IsAHitman(playerid))
		{
			if(PlayerInfo[playerid][pKnife] == 1 && GetPlayerWeapon(playerid) == 4)
			{
				PlayerInfo[playerid][pKnifeHidden] = 1;
				RemovePlayerWeapon(playerid, 4);
				SendClientMessageEx(playerid, COLOR_YELLOW, "You have hidden your knife.");
			}
			if(PlayerInfo[playerid][pKnifeHidden] == 1 && !GetPlayerWeapon(playerid) == 4)
			{
				PlayerInfo[playerid][pKnifeHidden] = -1;
				GivePlayerValidWeapon(playerid, 4);
				SendClientMessageEx(playerid, COLOR_YELLOW, "You have pulled out your knife.");
			}
		}
	else 
	{
		SendClientMessageEx(playerid, COLOR_GREY, "You are not a member of the hitman agency!");
	}
	return 1;
}
Код:
	pKnife,
	pKnifeGet,
	pKnifeHidden,
I don't know what I am doing wrong. Whenever I acquire a knife, hiding it works fine but it doesn't come back when I execute the command again.


Re: Command not returning a weapon - Konstantinos - 25.07.2016

Код:
if(PlayerInfo[playerid][pKnifeHidden] == 1 && !GetPlayerWeapon(playerid) == 4)
This has no effect, you have to check if the weapon returned is not (!=) 4.


Re: Command not returning a weapon - Avetsky - 25.07.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Код:
if(PlayerInfo[playerid][pKnifeHidden] == 1 && !GetPlayerWeapon(playerid) == 4)
This has no effect, you have to check if the weapon returned is not (!=) 4.
Works great, thanks a lot!