• 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!

Player reach x level, broadcast it.

LUA:
local storage = 100

function onAdvance(cid, skill, oldLevel, newLevel)
	if skill == SKILL__LEVEL and newLevel > oldLevel and isInArray({210,220,230}, newLevel) and getPlayerStorageValue(cid, storage) < newLevel then
		setPlayerStorageValue(cid, storage, newLevel)
		doBroadcastMessage(getCreatureName(cid) .. ' has reached Level ' .. newLevel .. ', congratulations!')
	end
	return true
end
 
I forgot to mention that it's for a war server in which levels reset every time they logout. Could you remove the storage part please, and what do I put in creaturescripts.lua?
 
advance.lua
LUA:
function onAdvance(cid, skill, oldLevel, newLevel)
	if skill == SKILL__LEVEL and newLevel > oldLevel and isInArray({210,220,230}, newLevel) then
		doBroadcastMessage(getCreatureName(cid) .. ' has reached Level ' .. newLevel .. ', congratulations!')
	end
	return true
end
creaturescripts.xml
Code:
	<event type="advance" name="Advance" event="script" value="advance.lua"/>
login.lua
LUA:
	registerCreatureEvent(cid, 'Advance')
 
Hey, I messed up in items.xml and when I turn on the server, it says its in line 17760. Do you know how I can jump to that line?
 
Back
Top