function onAdvance(cid, skill, oldLevel, newLevel)
if skill == SKILL__LEVEL then
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
local p = getThingPos(cid)
doSendMagicEffect(p, math.random(28, 30))
doSendAnimatedText(p, 'LEVEL UP', TEXTCOLOR_RED)
end
return true
end
Is this right?
on creaturescripts xml dokument <event type="advance" name="lvlup" event="script" value="lvlup.lua"/>
and on login lua registerCreatureEvent(cid, "Lvlup")
<event type="advance" name="levelUp" event="script" value="custom/levelUp.lua"/>
function onAdvance(cid, skill, oldlevel, newlevel)
local pPos = getPlayerPosition(cid)
if skill == SKILL__LEVEL then
doSendAnimatedText(pPos, "Level Up", 210)
doSendMagicEffect(pPos, 28)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid))
end
return TRUE
end