Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function heal(uid, info, mana)
- if not isCreature(uid) then
- return true
- end
- local level = getPlayerLevel(uid)
- for _, v in ipairs(info) do
- if level >= v.level.min and level <= v.level.max then
- if mana then
- if not getTileInfo(getThingPos(uid)).protection then
- doCreatureAddMana(uid, v.mana.reg)
- end
- addEvent(heal, v.mana.interval * 1000, uid, info, true)
- else
- if not getTileInfo(getThingPos(uid)).protection then
- doCreatureAddHealth(uid, v.hp.reg)
- end
- addEvent(heal, v.hp.interval * 1000, uid, info)
- end
- break
- end
- end
- return true
- end
- function onLogin(cid)
- local vocations = {
- [1] = {
- {level = {min = 0, max = 10}, hp = {reg = 10, interval = 1}, mana = {reg = 5, interval = 1}},
- {level = {min = 11, max = 30}, hp = {reg = 50, interval = 0.2}, mana = {reg = 10, interval = 2}},
- }
- }
- if vocations[getPlayerVocation(cid)] then
- heal(cid, vocations[getPlayerVocation(cid)], true)
- heal(cid, vocations[getPlayerVocation(cid)])
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment