LUA Kód:
local hatar = createObject(ObjectID, xPos, yPos, zPos, xRot, yRot, zRot) --Ez helyezi le
local open = false
local which = 0
-- Gate code
function useHatarGate(thePlayer) --Ez nyitja ki
local x, y, z = getElementPosition(thePlayer)
local distance1 = getDistanceBetweenPoints3D(xPos, yPos, zPos, x, y, z) --Melyik ponttól érzékelje a hatótávolságot
if (distance1<=10) and (open==false) then
open = true
which = 1
outputChatBox(\"Sorompó nyitva!\", thePlayer, 0, 255, 0)
moveObject(hatar, 1000, xPos, yPos, zPos, xRot, yRot, zRot)
setTimer(closePDSideGarageGate, 5000, 1, thePlayer)
end
end
addCommandHandler(\"gate\", useHatarGate)
function closeHatarGate(thePlayer) --Ez csukja be
setTimer(resetState7, 1000, 1)
if (which==1) then
which = 0
moveObject(hatar, 1000, xPos, yPos, zPos, xRot, yRot, zRot)
end
end
function resetState7()
open = false
end
<meta>
<scipt src=\"script.lua\" type=\"server\" />
</meta>