local time = 4000 -- time for the gate open and close
local gate = createObject(0, 0, 0, 0, 0, 0, 0) --(object id, x, y, z, rx, ry, rz)
local marker = createMarker(0, 0, 0, "cylinder", 13, 255, 0, 0, 0) --(x, y, z,
function moveGate(hitPlayer, matchingDimension)
moveObject(gate, time, 0, 0, 0, 0, 0, 0) --(position when the gate is open (gate, time, x, y, z, rx, ry, rz)
end
addEventHandler("onMarkerHit", marker, moveGate)
function moveBack()
moveObject(gate, time, 0, 0, 0, 0, 0, 0) --(position when the gate is close same of "local gate = createObject..." but just(x, y, z, rx, ry, rz) not put id
end
addEventHandler("onMarkerLeave", marker, moveBack)
-- for work with commands put addCommandHandler("open", moveGate) and addCommandHandler("close", moveBack)
You need create a files with meta.xml and gate.lua, and put in meta.xml <script src="gates.lua" type="server"></script>