You must use onAdvance function written in LUA by niller:
http://otland.net/f163/release-onadvance-1607/
I can tell you I used this function on TFS 0.2.3 and it doesn't make high CPU use (some scripters think that any lua function can laaag server <_<) with 150 players online.
For test I ran globalevent that execute maximum number of lua functions [7 functions used - addHP, show magic effect, show distance effect, get random position of effect...] and my 2.33GHz CPU execute ~330.000 functions / second :thumbup:
OLD_LEVELS[cid] = getPlayerLevel(cid)
OLD_MAGLEVELS[cid] = getPlayerMagLevel(cid)
OLD_FIST[cid] = getPlayerSkill(cid,SKILL_FIST)
OLD_CLUB[cid] = getPlayerSkill(cid,SKILL_CLUB)
OLD_AXE[cid] = getPlayerSkill(cid,SKILL_AXE)
OLD_SWORD[cid] = getPlayerSkill(cid,SKILL_SWORD)
OLD_DISTANCE[cid] = getPlayerSkill(cid,SKILL_DISTANCE)
OLD_SHIELD[cid] = getPlayerSkill(cid,SKILL_SHIELD)
OLD_FISHING[cid] = getPlayerSkill(cid,SKILL_FISHING)
OLD_LEVELS[cid] = getPlayerLevel(cid)
OLD_MAGLEVELS[cid] = getPlayerMagLevel(cid)
OLD_FIST[cid] = getPlayerSkill(cid,SKILL_FIST)
OLD_CLUB[cid] = getPlayerSkill(cid,SKILL_CLUB)
OLD_AXE[cid] = getPlayerSkill(cid,SKILL_AXE)
OLD_SWORD[cid] = getPlayerSkill(cid,SKILL_SWORD)
OLD_DISTANCE[cid] = getPlayerSkill(cid,SKILL_DISTANCE)
OLD_SHIELD[cid] = getPlayerSkill(cid,SKILL_SHIELD)
OLD_FISHING[cid] = getPlayerSkill(cid,SKILL_FISHING)