Booms Posted November 21, 2019 Share Posted November 21, 2019 local gate = createObject (10558, 1588.6999511719, -1638.5, 14.39999961853, 0, 0, 270); function handleGate(player) gX, gY, gZ = getElementPosition(gate); if ( (gX >= 1588.6999511719) and (gY >= -1638.5) and (gZ >= 14.39999961853) ) then -- HA a kapu csukva van moveObject(gate, 5000, 1588.6999511719, -1638.5, 10, 0, 0, 0); elseif ( (gX >= 1588.6999511718) and (gY >= -1638.5) and (gZ <= 10.00002) ) then moveObject(gate, 5000, 1588.6999511719, -1638.5, 14.39999961853, 0, 0, 0); end end addCommandHandler("gate", handleGate, false, false); Link to comment
Addlibs Posted November 21, 2019 Share Posted November 21, 2019 (edited) The if checks are unnecessarily complicated. All you need to test for is z position. if (gZ >= 14.39999961853) then -- if it's up at or above Z=14.4 moveObject(gate, 5000, 1588.6999511719, -1638.5, 10, 0, 0, 0) -- move it down to z=10 elseif (gZ <= 10) then -- if it's down at or below Z=10 moveObject(gate, 5000, 1588.6999511719, -1638.5, 14.39999961853, 0, 0, 0) -- move it to Z=14.4 end Edited November 21, 2019 by MrTasty 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