Advertisement
Skymagnum

Untitled

May 13th, 2013
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. --[[ REGENERATION SYSTEM
  2. SCRIPT BY: SKYFOREVER/SKYMAGNUM
  3. NÃO POSTE EM OUTROS FÓRUNS SEM AUTORIZAÇÃO
  4. ]]
  5.  
  6. function onThink(cid)
  7.  
  8. local vocations = {
  9.  [1] = {
  10.             {levelmin = 0, levelmax = 10, lifeReg = 10, secondRegHp = 1, manaReg = 5, secondRegMana = 1},
  11.             {levelmin = 11, levelmax = 30, lifeReg = 50, secondRegHp = 0.2, manaReg = 10, secondRegMana = 2}
  12.     }
  13. }
  14.  
  15. local mana, manaMax = getCreatureMana(cid), getCreatureMaxMana(cid)
  16. local health, healthMax = getCreatureHealth(cid), getCreatureMaxHealth(cid)
  17. local level = getPlayerLevel(cid)
  18.  
  19.     local V = vocations[getPlayerVocation(cid)]
  20.  
  21.     if (getTileInfo(getThingPos(cid)).protection) then
  22.         return
  23.     end
  24.  
  25.     if (health ~= healthMax) or (mana ~= maxMana) then
  26.         for _, I in pairs(V) do
  27.             if (level >= I.levelmin) and (level <= I.levelmax) then
  28.                 addEvent(doCreatureAddHealth, I.secondRegHp * 1000, cid, I.lifeReg)
  29.                 addEvent(doCreatureAddMana, I.secondRegMana * 1000, cid, I.manaReg)
  30.             end
  31.         end
  32.     end
  33.  
  34.     return true
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement