local COLOR_RED = 180 -- Defina a cor que você está usando
local tableBoss = {
["Amazon"] = {seconds = 10, newBoss = "Amazon"}
}
local function timer(position, duration)
local t = duration
addEvent(function()
if t > 0 then
doSendAnimatedText(position, tostring(t), COLOR_RED)
t = t - 1
timer(position, t)
else
-- Respawn do boss após a contagem regressiva
addEvent(doCreateMonster, 1000, tableBoss["Amazon"].newBoss, position)
end
end, 1000)
end
function onKill(cid, target, damage, flags)
if isPlayer(target) then
return true
end
local boss = tableBoss[getCreatureName(target)]
if not boss then
return true
end
local position = getCreaturePosition(target)
local timeLeft = boss.seconds
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "O boss renascerá em " .. timeLeft .. " segundos na posição: " .. position.x .. ", " .. position.y .. ", " .. position.z) -- Exibe a posição no texto
timer(position, boss.seconds)
-- Inicia o contador regressivo para o respawn do boss
addEvent(function()
for i = 1, boss.seconds do
addEvent(function()
local remainingTime = timeLeft - i
if remainingTime > 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "O boss renascerá em " .. remainingTime .. " segundos na posição: " .. position.x .. ", " .. position.y .. ", " .. position.z) -- Exibe a posição no texto
end
end, i * 1000)
end
end, 1)
return true
end