if & else

Have questions about CoD/UO mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
Rukariox
CJ Wannabe
CJ Wannabe
Posts: 34
Joined: July 30th, 2009, 7:30 pm

if & else

Post by Rukariox » April 10th, 2010, 12:29 pm

I'm creating a script with "if"in it.

so i have

Code: Select all

if(user isTouching(trigger))
//do things//
but i wan't to have something executed if he is not touching the trigger to.
i tried with else { but it gave a script compile error can anyone tell me how to do this?

User avatar
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: if & else

Post by waywaaaard » April 10th, 2010, 1:34 pm

Code: Select all

if(statement){
 // TODO

}else{
 // TODO

}


or

if(statement){
 // TODO

}else if(statement){

 // TODO
}else{
 // TODO


}
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: if & else

Post by megazor » April 11th, 2010, 11:37 am

or

Code: Select all

if (!statement)
{
   //do stuff
}
"!" means "not", so

Code: Select all

if (!user isTouching(entity))
{
   //do stuff
}

Post Reply

Who is online

Users browsing this forum: No registered users and 44 guests