Jump to content
Sign in to follow this  
cougarxr7

What's the oposite of this array scripting condition?

Recommended Posts

This works fine if your players' name is x,y, or z.

    
_array = ["x","y","z"];

if ((name player) in _array) then {
hint "you are in the array";
};

But what is the opposite of this?? I've tried several conditions only to get errors. Such as, here are a couple.

if (not(name player) in _array) then {<errors
or
if (((name player)not) in _array) then {<errors

Thanks for the help.

Edited by Cougarxr7

Share this post


Link to post
Share on other sites

Thanks! That worked! This syntax is some wierd stuff!!

this ,

if (not(name player) in _array) then {<errors

is not the same as this,

if (!(name player in _array)) then {<works!

Learned something new again!

Again thanks!

Share this post


Link to post
Share on other sites

Well, "!" and "not" are equivalent.

The opposite of "true" is "false", so the opposite of

if (condition)

is

if not(condition)

So your

not(name player) in _array

has a trouble of bracket, which should be placed like this :

not[color="red"]([/color](name player) in _array[color="Red"])[/color]

Cheers !

Share this post


Link to post
Share on other sites

I do not know why but I thought that, not or ! had to be enclosed in parentheses with the condition. But now I know it does not.

 
if (!( (name player) in _array) ) then {

I just tested the line above and it worked too!

Thanks!

Like I said earlier, learning new things everyday!

Edited by Cougarxr7

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  

×