Booms 0 Posted November 21 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); Share this post Link to post
MrTasty 129 Posted November 21 (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 by MrTasty Share this post Link to post