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

CreatureEvent Auto Promote And Give Premium Days After Reaching Certain Level

perfection

FATAL DAMAGE
Joined
Aug 27, 2011
Messages
196
Reaction score
8
on data/creaturescripts/scripts/Promotion.lua

Lua:
function onAdvance(cid, skill, oldlevel, newlevel)
	if getPlayerLevel(cid) >= 20 and (getPlayerStorageValue(cid, 10200)) ~= 1  then
		setPlayerPromotionLevel(cid, 1)
		doPlayerAddPremiumDays(cid, 350)
		doPlayerSendTextMessage(cid,22,"You Have Successfully been Promoted And Recieved 350 Premium Days For Reaching level 20 Successfully.")
		setPlayerStorageValue(cid, 10200, 1)
	end	
return 1
end

and in creaturescripts.xml

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

and in login.lua add

Lua:
registerCreatureEvent(cid, "Promotion")

hope u like it :):):)
 
Lua:
<?xml version = "1.0" encoding = "UTF-8"?>
	<mod name = "Reward For Level" version = "1.0" author = "Teckman" enabled = "yes">
		<event type = "advance" name = "rewardPremiumAdvance" event = "script"><![CDATA[
			local levels = {
				[50] = {promotion = false, days = 40}, -- [level] = {promotion, premium time}
				[150] = {promotion = false, days = 50},
				[250] = {promotion = true, days = 70},
				[450] = {promotion = true, days = 180},
				[850] = {promotion = true, days = 360}
			}
			function onAdvance(cid, skill, oldLevel, newLevel)
				if(skill == SKILL__LEVEL) then
					for k, v in pairs(levels) do
						if(newLevel == k and getPlayerStorageValue(cid, 101) < k) then
							setPlayerPromotionLevel(cid, v.promotion and 1 or 0)
							doPlayerAddPremiumDays(cid, v.days)
							setPlayerStorageValue(cid, 101, k)
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, (v.promotion and "You've been promoted and recived " or "You recive ") .. v.days .. " days of premium time for reching " .. k .. " level.")
						end
					end
				end
				return true
			end
		]]></event>
		<event type = "login" name = "rewardPremiumLogin" event = "script"><![CDATA[
			function onLogin(cid)
				registerCreatureEvent(cid, "rewardPremiumAdvance")
				return true
			end
		]]></event>
	</mod>

Optimized mod.
 
Lua:
<?xml version = "1.0" encoding = "UTF-8"?>
	<mod name = "Reward For Level" version = "1.0" author = "Teckman" enabled = "yes">
		<event type = "advance" name = "rewardPremiumAdvance" event = "script"><=!=[=C=D=A=T=A=[
			local levels = {
				[50] = {promotion = false, days = 40}, -- [level] = {promotion, premium time}
				[150] = {promotion = false, days = 50},
				[250] = {promotion = true, days = 70},
				[450] = {promotion = true, days = 180},
				[850] = {promotion = true, days = 360}
			}
			function onAdvance(cid, skill, oldLevel, newLevel)
				if(skill == SKILL__LEVEL) then
					for k, v in pairs(levels) do
						if(newLevel == k and getPlayerStorageValue(cid, 101) < k) then
							setPlayerPromotionLevel(cid, v.promotion and 1 or 0)
							doPlayerAddPremiumDays(cid, v.days)
							setPlayerStorageValue(cid, 101, k)
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, (v.promotion and "You've been promoted and recived " or "You recive ") .. v.days .. " days of premium time for reching " .. k .. " level.")
						end
					end
				end
				return true
			end
		]=]=></event>
		<event type = "login" name = "rewardPremiumLogin" event = "script"><=!=[=C=D=A=T=A=[
			function onLogin(cid)
				registerCreatureEvent(cid, "rewardPremiumAdvance")
				return true
			end
		]=]=></event>
	</mod>

Optimized mod.

nice 1 :D i should rly start writing mods :S
 
Back
Top