Jump to content

[HELP] BASE


1LoL1

Recommended Posts

Hello anyone can help me with this my code?

function openMyGate ( ) 
 moveObject ( Gate, 2000, 1534.5999755859, -1451.5, 19.89999961853 ) 
 end 
 addCommandHandler("test",openMyGate) 
  
 function movingMyGateBack () 
 moveObject ( Gate, 2000, 1534.5999755859, -1451.5, 14.89999961853 ) 
 end 
 addCommandHandler("test1",movingMyGateBack) 

now its when i use /test gate will opened and when i use /test1 gate will closed. How to change only on 1 command? when i use /test gate will opened and when i use /test gate will closed.

Link to comment

Do it with a "state" like:

function openMyGate() 
            state = not state 
            if state == true then 
                         moveObject ( Gate, 2000, 1534.5999755859, -1451.5, 19.89999961853 ) 
            elseif state == false then 
                         moveObject ( Gate, 2000, 1534.5999755859, -1451.5, 14.89999961853 ) 
            end 
end 

Link to comment
Do it with a "state" like:
function openMyGate() 
            state = not state 
            if state == true then 
                         moveObject ( Gate, 2000, 1534.5999755859, -1451.5, 19.89999961853 ) 
            elseif state == false then 
                         moveObject ( Gate, 2000, 1534.5999755859, -1451.5, 14.89999961853 ) 
            end 
end 

Thank works!. :D

Link to comment

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...