local barrier = createObject(968, -1572.19, 658.79, 6.8, 0, 270, 270)
state = 0
function openb(player)
if state == 0 and getElementPosition(player, -1562.9, 661.9, 7) or getElementPosition(player, -1579.3, 661, 7.1)then
setElementRotation(barrier, 0, 0, 270)
state = 1
outputChatBox("opens the barrier.", getPlayerName(player), player, 0, 255, 255)
else
if state == 1 and getElementPosition(player, -1562.9, 661.9, 7) or getElementPosition(player, -1579.3, 661, 7.1) then
setElementRotation(barrier, 0, 270, 270)
state = 0
outputChatBox("closes the barrier.", getPlayerName(player), player, 0, 255, 255)
end
end
end
addCommandHandler("gate",openb)
getElementPossition a nill value getLocalPlayer a nil lvalue