• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Help with LUA

spice

CABS ARE HERE
Joined
Apr 5, 2009
Messages
1,226
Reaction score
15
Location
Göteborg, Sweden
Hello, I tried to make a script. This is how it should work:

1, The player that have the vocation ID 1,2,3 level up to 120.
2, At level 120, the exp will be set to 0.
3, When they get the level 120 promotion, their new vocation ID will be 4,5 or 6. Then they have the normal exp back,(the right one in the stages).

I have talked with some scripters, and they say that i should use:
Code:
doPlayerSetExperience(cid, 0)

But when I look in the LUA_FUNCTIONS there is not anything like that. What should I use?

This is the code I have right now:
Code:
function onAdvance(cid, skill, oldLevel, newLevel)
	if (getPlayerLevel(cid) >= 120) then
			if isArcher(cid) then
				doPlayerSendTextMessage(cid, 22, "You have now reached level 120. To be able to get more exp you have to buy the next promotion.")
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)
				doPlayerSetExperience(cid, 0)

			elseif isWarrior(cid) then
				doPlayerSendTextMessage(cid, 22, "You have now reached level 120. To be able to get more exp you have to buy the next promotion.")
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)
				doPlayerSetExperience(cid, 0)

			elseif isMage(cid) then
				doPlayerSendTextMessage(cid, 22, "You have now reached level 120. To be able to get more exp you have to buy the next promotion.")
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)
				doPlayerSetExperience(cid, 0)
			end
	return True
end
 
Last edited:
You should use this function (you already have it in your 050-function.lua):
Code:
function [B][COLOR="Red"]doPlayerSetExperienceRate(cid, value)[/COLOR][/B]
	return doPlayerSetRate(cid, SKILL__LEVEL, value)
end
 
Back
Top