Hello Everyone
I have Script Auto Open Castle, but Have a erro globalevents
(OTX 2- Clinet 8.60)
I have Script Auto Open Castle, but Have a erro globalevents
(OTX 2- Clinet 8.60)
Lua:
local config = {
pos = {x=145, y=44, z=7},
topos = {x=1675, y=1478, z=4},
tpid = 1387,
time = 60
}
function DelTp()
local t = getTileItemById(config.pos, config.tpid)
if t then
doRemoveItem(t.uid, 1)
doBroadcastMessage("Castle24h Event is offline (last Guild Stand Is Winner)")
doSendMagicEffect(config.pos, CONST_ME_POFF)
end
end
function countPos(pos, tempo)
if tempo > 0 then
doSendAnimatedText(pos, tempo, TEXTCOLOR_YELLOW)
addEvent(countPos, 1000, pos, tempo - 1)
else
doSendMagicEffect(pos, 2)
end
end
function onTime(interval)
doItemSetAttribute(doCreateTeleport(config.tpid, config.topos, config.pos), "aid", 1749)
doBroadcastMessage("Event Castle24 open for 60 minutes")
setGlobalStorageValue(16505, 1)
addEvent(DelTp, config.time * 60 * 1000)
addEvent(setGlobalStorageValue, config.time * 60 * 1000, 16505, -1)
addEvent(countPos, 0, config.pos, 3553) -- Iniciar a contagem de posição imediatamente
return true
end