1LoL1 Posted August 13, 2015 Share Posted August 13, 2015 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
Wumbaloo Posted August 13, 2015 Share Posted August 13, 2015 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
1LoL1 Posted August 13, 2015 Author Share Posted August 13, 2015 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!. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now