Eu só usaria o stopEvent caso não estivesse verificando a storage do player, nesse caso não há necessidade.
E agora um detalhe muito importante: Sempre que usar addEvent com player, é bom criar condição para verificar se ele está online, caso contrário o servidor poderá crashar.
local MAX_HEAL_LEVEL = 717217
local STORAGE_VALUE = 98910
local HEAL_INTERVAL = 4 * 1000
local HEAL_AMOUNT = 1000000000
local HEAL_TEXT = "|ROX|..."
function doHealPlayer(cid)
if not cid or not isPlayer(cid) then
return true
end
if getPlayerStorageValue(cid, STORAGE_VALUE) == 1 then
doCreatureAddHealth(cid, HEAL_AMOUNT)
doPlayerAddMana(cid, HEAL_AMOUNT)
doSendAnimatedText(getCreaturePos(cid), HEAL_TEXT, 138)
doSendMagicEffect(getCreaturePosition(cid), 53)
addEvent(doHealPlayer, HEAL_INTERVAL, cid)
end
return true
end
function onStepIn(cid, item, position, lastPosition, fromPosition)
if getPlayerLevel(cid) >= MAX_HEAL_LEVEL then
doPlayerSendCancel(cid, "Você já está acima do nível " .. MAX_HEAL_LEVEL .. ", portanto não será curado.")
return true
end
setPlayerStorageValue(cid, STORAGE_VALUE, 1)
doHealPlayer(getPlayerGUID(cid))
return true
end
function onStepOut(cid, item, position, lastPosition, fromPosition)
setPlayerStorageValue(cid, STORAGE_VALUE, 0)
return true
end