I need help to add time for levers to return to ID (1945) after 5 minutes the player enters the teleport .. sorry i'n newbie
Lua:
local pos_certa = {x = 33368, y = 32805, z = 14} -- Correct Position
local pos_errada = {x = 33399, y = 32801, z = 14} -- Wrong Position
local alavancas = {
[1] = {x = 33320, y = 32682, z = 14},
[2] = {x = 33349, y = 32680, z = 14},
[3] = {x = 33358, y = 32701, z = 14},
[4] = {x = 33338, y = 32702, z = 14},
[5] = {x = 33305, y = 32734, z = 14},
[6] = {x = 33357, y = 32749, z = 14},
[7] = {x = 33368, y = 32763, z = 14},
[8] = {x = 33382, y = 32786, z = 14},
}
local levers = { -- Initial state
[1] = "d",
[2] = "d",
[3] = "d",
[4] = "d",
[5] = "d",
[6] = "d",
[7] = "d",
[8] = "d",
}
local aux = {"d", "e"}
function onStepIn(cid, item, position, fromPosition)
for id, pos in ipairs(alavancas) do
local itemid = levers[id] == "d" and 1946 or 1945
if getTileItemById(pos, itemid).uid < 100 then
doSendMagicEffect(getThingPos(cid), 10)
doTeleportThing(cid, pos_errada)
doSendMagicEffect(getThingPos(cid), 10)
doPlayerSendCancel(cid,"Sorry not possible, you need to pull all the levers.")
return true
end
end
for id, pos in ipairs(alavancas) do
local itemid = levers[id] == "d" and 1946 or 1945
if getTileItemById(pos, itemid).uid > 100 then
doSendMagicEffect(getThingPos(cid), 10)
doTeleportThing(cid, pos_certa, true)
doSendMagicEffect(getThingPos(cid), 10)
end
end
return true
end