IMORTALIDADE
local config = { storage = 13546, effect1 = 2 --- efeito ao ser atacado estando invulnerável } function onStatsChange(cid, attacker, type, combat, value) if value >= 1 and (type == STATSCHANGE_HEALTHLOSS or (getCreatureCondition(cid, CONDITION_MANASHIELD) and type == STATSCHANGE_MANALOSS)) then if getPlayerStorageValue(cid,config.storage) - os.time() > 0 and isCreature(attacker) then doSendMagicEffect(getCreaturePosition(cid), config.effect1) doSendAnimatedText(getCreaturePosition(cid), "0", 180) return false end end return true end
IMORTALIDADE
local config = { storage = 13546, cooldown = 3, --- tempo entre um uso e outro duration = 86400, --- duração effect1 = 26 -- efeito que sai ao falar a spell } function onCastSpell(cid, var) if getPlayerStorageValue(cid, 13546) < 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você precisa ser DONATE para usar esta Magia.") doSendMagicEffect(getThingPos(cid), 2) return true end if os.time() - getPlayerStorageValue(cid, 13546) >= config.cooldown then setPlayerStorageValue(cid, 13546, os.time()) doSendMagicEffect(getCreaturePosition(cid), config.effect1) setPlayerStorageValue(cid, config.storage, os.time() + config.duration) doCreatureSay(cid,"24 HORAS DE INVENCIBILIDADE!!!", 19) doPlayerSendTextMessage(cid, 26, "You have now ".. config.duration .." seconds of invulnerability.") else doPlayerSendCancel(cid, "Your skill is in cooldown, you must wait "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, 13546))).." seconds.") return false end return true end
REFLECTION
function onCastSpell(cid, var) -- Check if the player has the required storage for the spell if getPlayerStorageValue(cid, 12789) < 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need storage spell donate.") doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF) return false end -- Register the statschange event registerCreatureEvent(cid, "Reflection/statschange") -- Registers the statschange event -- Set the duration for the Reflection effect (24 hours) setPlayerStorageValue(cid, 12789, os.time() + 86400) -- Sets the duration (24 hours) -- Apply the visual effect doSendMagicEffect(getThingPosition(cid), CONST_ME_HOLYDAMAGE) -- Inform the player that they have gained the Reflection effect doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have 24 hours of Reflection.") return true end
function onStatsChange(cid, attacker, type, combat, value) -- Verificar se o Reflection está ativo if getPlayerStorageValue(cid, 12789) > os.time() then -- Garantir que o atacante é válido e está vivo if isCreature(attacker) and getCreatureHealth(attacker) > 0 then doCreatureAddHealth(attacker, -getCreatureHealth(attacker)) -- Matar atacante doSendMagicEffect(getThingPosition(attacker), CONST_ME_HOLYDAMAGE) doSendAnimatedText(getThingPosition(attacker), "[OWNED!]", 35) end return false -- Impede que o jogador perca vida else -- Desativar evento quando o Reflection expira unregisterCreatureEvent(cid, "Reflection/statschange") setPlayerStorageValue(cid, 12789, -1) end return true end
REFLECTION
function onLogin(cid) -- Verificar se o Reflection ainda está ativo if getPlayerStorageValue(cid, 12789) > os.time() then -- Registrar o evento statschange novamente registerCreatureEvent(cid, "Reflection/statschange") else -- Remover o armazenamento caso o efeito tenha expirado setPlayerStorageValue(cid, 12789, -1) end return true end