Spell with Error tfs 1.2

115820

New Member
Joined
Feb 27, 2011
Messages
137
Best answers
1
Reaction score
0
Code:
local config ={
cooldown = 120, -- tempo entre uma magia e outra
storage = 19330,
tempo = 250, --- tempo que vai durar a spell
percent = 35, -- quanto % vai aumentar hp
percent2 = 60, -- quanto % vai aumentar mana
hp = 35000, -- quanto de hp ganha a cada intervalo
mana = 50000, -- quanto de mana ganha a cada intervalo
intervalo = 2,  --- intervalo que leva pra recuperar X de mana
ml = 30, -- quantos ira aumentar o skill de ML
sword = 0, -- quantos ira aumentar o skill de Sword
shield = 100 -- quantos ira aumentar o skill de Shield
} 

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, 17)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local speed = createConditionObject(CONDITION_HASTE)
setConditionParam(speed, CONDITION_PARAM_TICKS, config.tempo*1000)
setConditionFormula(speed, 0.8, 72, 0.8, 72)
setCombatCondition(combat, speed)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, config.tempo*1000)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANAPERCENT, 100+config.percent2)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 100+config.percent)
setConditionParam(condition, CONDITION_PARAM_STAT_PROTECTIONALL, 100)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, config.ml)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, config.sword)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, config.shield)
setCombatCondition(combat, condition)

function onCastSpell(cid, var) 
if os.time() - getPlayerStorageValue(cid, config.storage) >= config.cooldown then 
for i = 1, config.tempo do 
addEvent(function() 
if isPlayer(cid) then 
local pos = getPlayerPosition(cid) 
doPlayerAddMana(cid,config.mana) 
doCreatureAddHealth(cid, config.hp)
end 
end, 1000*i) 
end
 
setPlayerStorageValue(cid, config.storage, os.time()) 
       setPlayerStorageValue(cid, config.storage, os.time()+config.cooldown)
   doPlayerSendTextMessage(cid, 19, "DarkLord Buff: Heal 35k HP e 50k MANA em 2s / 35% a mais HP 60% a mais de MANA / Magic: +30 e Def: +100 / Tempo: 5min") 
   return doCombat(cid, combat, var)
else 
doPlayerSendCancel(cid, "Your Mass Healing is at cooldown, you must wait "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, config.storage))).." seconds.") 
end 
return true
end

I have this script, when i use works fine, but if i logout my TFS CLOSE, and no show error.
 
Top