here is an example
local gate1 = createObject(980, 2610.001953125, 1918.07421875, 11.0234375) --the gate pos
local Status = "closed"
function Gate1()
if (Status == "closed") then
moveObject(gate1, 2000, 2637.943359375, 1920.3759765625, 11.0234375, 0, 0, 0)-- this is when the gate close position
Status = "open"
elseif (Status == "open") then
moveObject(gate1, 2000, 2610.001953125, 1918.07421875, 11.0234375, 0, 0, 0)-- this is when gate open position
Status = "closed"
end
end
addCommandHandler ("gate", Gate1) -- to open the gate