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

Auto promotion |

Mjmackan

Mapper ~ Writer
Joined
Jul 18, 2009
Messages
1,488
Solutions
18
Reaction score
199
Location
Sweden
As the topic says, i would need help with an script that automatically give you promotion when reaching level XXX.
I have tried a bit, but it just turned out to a piece of junk.
ReP++
 
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"/>

And in login.lua
LUA:
registerCreatureEvent(cid, "autopromo")
 
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"/>

And in login.lua
LUA:
registerCreatureEvent(cid, "autopromo")

Haven't test it or anything but it seems promising.. Thanks!
 
LUA:
doPlayerSetVocation(cid, getPlayerVocation(cid) + 4)
Bad command, you should use this:
LUA:
setPlayerPromotionLevel(cid, 1)
 
Didn't use the script since it had some weird bugs. However took an reward when advance script and remade.

LUA:
doPlayerSetVocation(cid, getPlayerVocation(cid) + 4)
Bad command, you should use this:
LUA:
setPlayerPromotionLevel(cid, 1)
Beside this didn't worked out:
LUA:
setPlayerPromotionLevel(cid, 1)
This worked:
LUA:
doPlayerSetVocation(cid, getPlayerVocation(cid) + 4)

Its because i use an older version of TFS ^^
 
Last edited:
Back
Top