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

Lua Help onLogin

murilow1

Member
Joined
Dec 2, 2011
Messages
37
Reaction score
9
Well, trying to do players(if is premium) when reaches level 20 get promotion automatically, i've tried this before the last return TRUE on login.lua:

Code:
if getPlayerLevel(cid) >= 20 then
doPlayerSetPromotionLevel(cid, isPremium(cid) == FALSE and 0 or 1)
end

but seems not work, players still getting promotion(if is premium), on every lvl, like 1 or 19 or 100

Thanks :p
 
Lua:
local cfg{
level = 20,
text = "You have been automaticly promoted for reaching level " .. level .. "!"
}
function onAdvance(cid, skill, oldLevel, newLevel)
	if skill == SKILL__LEVEL and newLevel >= cfg.level and oldLevel < cfg.level then
		doPlayerSetVocation(cid, getPlayerVocation(cid) + 4)
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, cfg.text)
	end
	return true
end

XML:
<event type="advance" name="autopromo" event="script" value="promo.lua"/>

login.lua add:
Lua:
registerCreatureEvent(cid, "autopromo")
 
Hey Tai, thanks, but this script works for free account too... i need only for premium and its onAdvance, i need onLogin..

Thanks anyway
 
@Tai
Check if isPremium(cid) and use doPlayerSetPromotionLevel not doPlayerSetVocation
 
Back
Top