Jump to content
notproplayer3

check if an object is in the player inventory

Recommended Posts

The situation is simple: in a trigger I put

 

 _backpack = backpackItems player;                                

"rhs_weapon_svdp_wd" in _backpack;

 

as the condition and in the activation I just put       hint "hi";

so you probably guessed that the trigger is supposed to activate when the player has picked up this specific weapon, but for some reason it won't work 

Share this post


Link to post
Share on other sites

check also uniformItems and vestItems 

 

"rhs_weapon_svdp_wd" in ((vestItems player) + (uniformItems player) + (backpackItems player))

 

Share this post


Link to post
Share on other sites

still isn't working, I don't know if it is related to the fact that the gun is equipped and not in a backpack or in a vest but I tried putting it in the inventory and sill it wouldn't work

Share this post


Link to post
Share on other sites

@notproplayer3, in command compares strings using case sensitive basis. So use either correctly class name or case insensitive comparing.

Share this post


Link to post
Share on other sites

Thanks, I have fixed the classname but now there's another problem, the trigger is now activating when I've got my gun in my backpack or in another place, but it isn't activating when I've got it equiped

Share this post


Link to post
Share on other sites

For any weapon (not only primary one) in its slot (not in backpack), you can use hasWeapon command (not case sensitive).

Share this post


Link to post
Share on other sites

Ok, it is always good to know, I used the weapons command coupled with the in command like gr8 suggested it to me but I think your's is much better in that specific scenario where we need to check if a unit has a specific type of gun. 

Thanks for your post 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×