Jump to content

Help


Machine

Recommended Posts

Posted

i make this gate

gate1 = createObject(980,-2085.8994140625,-213,37.099998474121,0,0,0) 
  
function closedoor() 
       moveObject (gate1, 4000, -2085.8999023438, -213, 29.10000038147  ) 
end 
addCommandHandler("move", closedoor) 
function opendoor() 
       moveObject (gate1, 4000, -2085.8999023438, -213, 37.099998474121 ) 
end 
addCommandHandler("move", opendoor) 

problem is i wanna the 2 function with 1 command only

how can i do that cous when i do like this gate dont even move

Posted
local gate1 = createObject ( 980, -2085.8994140625, -213, 37.099998474121, 0, 0, 0 ) 
local status = false 
  
addCommandHandler ( "move", 
    function ( ) 
        if ( status ) then 
            status = false 
            moveObject ( gate1, 4000, -2085.8999023438, -213, 29.10000038147  ) 
        else 
            status = true 
            moveObject ( gate1, 4000, -2085.8999023438, -213, 37.099998474121 ) 
        end 
    end 
) 

Try that.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You didn't put any code to toggle the value of 'status'.

"First they ignore you, then they laugh at you, then they fight you, then you win."

- Mahatma Gandhi (1869-1948)

Posted

Oh, I forgot, I'm doing many things at once. Added it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...