Meatball0311 79 Posted November 2, 2015 I need a variable that will be equal to several types of gear. How do i make an array? _gear = ["gear1classname", "gear2classname", "gear3classname".... etc]; Is that correct? _uniform = uniform player; if (_uniform == _gear) then { hint "CHECK ONE"; Sleep 1; } else { hint "CHECK TWO"; Sleep 1; }; }; Share this post Link to post Share on other sites
haleks 8212 Posted November 2, 2015 Not sure I got your question right, is this what you mean? if (_uniform in _gear) then { hint "this uniform is present in the array"; } else { hint "this uniform is absent from the array"; }; 1 Share this post Link to post Share on other sites
Meatball0311 79 Posted November 3, 2015 == I think means equal to. the question is how do I make a variable that is of several things _gear = ["gear1classname", "gear2classname", "gear3classname".... etc]; is that the way that I would do it, because I get an error when i have it that way. Share this post Link to post Share on other sites
Ranwer135 308 Posted November 3, 2015 When comparing a string with other strings in an array, you need to use in to check if the classname is in the array. Try this: (Take not the below will return as fail, because you have not defined the specific classname in _gear) _gear = ["gear1classname", "gear2classname", "gear3classname"]; if (uniform player in _gear) then { hint "CHECK SUCCESS!"; sleep 1; } else { hint "CHECK FAIL!"; sleep 1; }; EDIT: Pretty much what Heleks just said.. Share this post Link to post Share on other sites
Meatball0311 79 Posted November 3, 2015 Thanks.. got it working. Now how would i make it check all of the time incase the gear gets dropped then picked up again? Share this post Link to post Share on other sites
haleks 8212 Posted November 3, 2015 while {true} do { waitUntil {uniform player in _gear}; hint "player is wearing an allowed uniform."; waitUntil !{uniform player in _gear}; hint "player is no longer wearing an allowed uniform."; }; Not tested but it should work - note that it only checks for the uniform/gear the player is actually wearing, not the stuff in his inventory.EDIT : Not tested either : _condition = { _x player in _gear } forEach [uniform, headgear, goggles, backpack, vest]; while {true} do { waitUntil {_condition}; hint "player is wearing allowed items."; waitUntil !{_condition}; hint "player is wearing a restricted item!"; }; Not sure about this one, feel free to correct guys! ^^ Share this post Link to post Share on other sites
Meatball0311 79 Posted November 3, 2015 This is the loop that I have going on atm. It works fine. I need it to be running at all times to check to see if the piece of gear is in the player's inventory. while {alive player} do { _uniform = uniform player; if (uniform player in _crye) then { hint "UNIFORM SUCCESS!"; } else { hint "UNIFORM FAIL!"; }; sleep 1; }; it constantly checks the units inventory for the uniform even after it is dropped and picked back up. Share this post Link to post Share on other sites