Command not returning a weapon
#1

Код:
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.
Reply
#2

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

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)