Jump to content
Sign in to follow this  
Blanco

array question

Recommended Posts

I got a array with weapons :

_weapons = ["m16","AK74","steyr",etc...]

I wanna check if a unit got one of these weapons in the _Weapons array

I can do it with a cycle loop, but I'm asking : is it's possible with a if, then, else statement?

I tried :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

If ("_unit hasweapon _x" count _weapons > 0) then {hint "_unit has one of those weapons in the array"}

But it doesn't work...

Is it possible in a single condition code line?

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{IF (_unit hasweapon _X) THEN {hint "Weapon found"}} foreach _weapons

Should work smile_o.gif

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
Sign in to follow this  

×