Hi guys!
this script works like this, you run it, and you gain a certain percentage of mana for a few seconds ... But I wanted it to be used in the area, so the whole team could heal mana too
im not so good with LUA thats why i came here and ask help from you guys
this script works like this, you run it, and you gain a certain percentage of mana for a few seconds ... But I wanted it to be used in the area, so the whole team could heal mana too
im not so good with LUA thats why i came here and ask help from you guys
local config = {
cooldown = 10, -- tempo entre uma magia e outra
time = 10, -- tempo em segundos que ficará healando
percent = 25, --- porcentagem da vida que cura
storage = 19330,
effect = 12, --- efeito que vai sair
mana = 40 -- quanto custa de mana
}
function onCastSpell(cid, var)
if getCreatureMana(cid) >= config.mana then
if os.time() - getPlayerStorageValue(cid, config.storage) >= config.cooldown then
doPlayerSetStorageValue(cid, config.storage, os.time())
local i = 0
doCreatureAddMana(cid, -config.mana, 0)
while i < config.time do
i = i+1
addEvent(function()
if isCreature(cid) then
if getCreatureMaxMana(cid) ~= getCreatureMana(cid) then
local manadraw = math.ceil(getCreatureMaxMana(cid) * (config.percent)/100)
local pos = getPlayerPosition(cid)
doCreatureAddMana(cid, manadraw, 1)
doSendAnimatedText(pos, "+"..manadraw , TEXTCOLOR_GREEN)
doSendMagicEffect(pos, config.effect)
end
end
end, 1000*i)
end
else
doPlayerSendCancel(cid, "Your Mass Healing is at cooldown, you must wait "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, config.storage))).." seconds.")
end
else
doPlayerSendCancel(cid, 36)
end
return false
end