Coloquei pra rodar, ele parou de regenerar a vida =/
local regenEvent = {} -- Tabela para armazenar os identificadores de eventos por jogador.
function onEquip(cid, item, position, fromPosition)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.")
doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210)
doPlayerSay(cid, "POWER-UP!", 16)
doSendMagicEffect(getPlayerPosition(cid), 95)
local function regenVida(cid)
if isPlayer(cid) then
doPlayerAddHealth(cid, 1000) -- Adiciona vida ao jogador.
regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Reagendar o evento com o `cid`.
end
end
regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Inicializa o evento com o `cid`.
return TRUE
end
function onDeEquip(cid, item, position, fromPosition)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.")
-- Check if the event exists before trying to remove it
if regenEvent[cid] then
removeEvent(regenEvent[cid]) -- Cancels the event in execution.
regenEvent[cid] = nil -- Remove the identifier to avoid future use.
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Event removed successfully.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "No event to remove.")
end
return TRUE
end
Esse aqui quando eu removo o item ele diz ( 17:15 No event to remove. ) e continua regenerando e quadno deslogo da aquele erro