function onCastSpell(cid, var)
if not isCreature(cid) then
return false
end
local storage, storage2 = 55512, 55513
local stage = getPlayerStorageValue(cid, storage) or 0
local waittimes = {30, 30, 40, 50, 60}
local waittime3 = 310
if exhaustion.check(cid, storage2) then
doPlayerSendCancel(cid, "Aguarde " .. exhaustion.get(cid, storage2) .. " segundos para usar a spell novamente.")
return false
end
if stage > 0 then
doPlayerSendCancel(cid, "Você já está sob o efeito da spell.")
return false
end
setPlayerStorageValue(cid, storage, 1)
local function advanceStage()
if not isCreature(cid) then
return
end
local currentStage = getPlayerStorageValue(cid, storage)
if currentStage < #waittimes then
setPlayerStorageValue(cid, storage, currentStage + 1)
addEvent(advanceStage, waittimes[currentStage + 1] * 1000)
else
setPlayerStorageValue(cid, storage, -1)
end
end
addEvent(advanceStage, waittimes[1] * 1000)
exhaustion.set(cid, storage2, waittime3)
OpenGate(cid, Select_Stages(getCreatureOutfit(cid).lookType), 1)
addEvent(function()
if isCreature(cid) then
setPlayerStorageValue(cid, storage, -1)
end
end, waittimes[1] * 1000)
return true
end