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

rewards at lvls

oualidboy1996

Member
Joined
Aug 4, 2009
Messages
60
Reaction score
6
does anyone have a script that gives items and not premium points at different levels??
and not when the player dies and lvls again that he gets the reward again.
 
PHP:
<?xml version = "1.0" encoding = "UTF-8"?>
	<mod name = "Reward For Level" version = "1.0" author = "Teckman" enabled = "yes">
		<event type = "advance" name = "rewardAdvance" event = "script"><![CDATA[
			local levels = {
				[30] = {2160, 5},
				[40] = {2160, 5},
				[50] = {2160, 5},
				[60] = {2160, 5},
				[70] = {2160, 5},
				[80] = {2160, 5},
				[90] = {2160, 5},
				[100] = {2160, 10}
			}
			function onAdvance(cid, skill, oldLevel, newLevel)
				if(skill == SKILL__LEVEL) then
					for k, v in pairs(levels) do
						if(newLevel == k and getPlayerStorageValue(cid, 100) < k) then
							setPlayerStorageValue(cid, 100, k)
							doPlayerAddItem(cid, v[1], v[2])
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You recive " .. v[2] .. "x " .. getItemNameById(v[1]) .. "(s) for reaching " .. k .. " level.")
						end
					end
				end
				return true
			end
		]]></event>
		<event type = "login" name = "rewardLogin" event = "script"><![CDATA[
			function onLogin(cid)
				registerCreatureEvent(cid, "rewardAdvance")
				return true
			end
		]]></event>
	</mod>

save this in mods, called advance_rewards.xml
--
level = reward, count
[30] = {2160, 5}
 
ok, if you have not carpet mods, need add this in creatureevents
first, copy all code and save in the name of: advance_rewards.lua
PHP:
            local levels = { 
                [30] = {2160, 5}, 
                [40] = {2160, 5}, 
                [50] = {2160, 5}, 
                [60] = {2160, 5}, 
                [70] = {2160, 5}, 
                [80] = {2160, 5}, 
                [90] = {2160, 5}, 
                [100] = {2160, 10} 
            } 
            function onAdvance(cid, skill, oldLevel, newLevel) 
                if(skill == SKILL__LEVEL) then 
                    for k, v in pairs(levels) do 
                        if(newLevel == k and getPlayerStorageValue(cid, 100) < k) then 
                            setPlayerStorageValue(cid, 100, k) 
                            doPlayerAddItem(cid, v[1], v[2]) 
                            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You recive " .. v[2] .. "x " .. getItemNameById(v[1]) .. "(s) for reaching " .. k .. " level.") 
                        end 
                    end 
                end 
                return true 
            end
now add this in creatureevents.xml
PHP:
	<event type="advance" name="advance_rewards" event="script" value="advance_rewards.lua"/>
and find
Code:
	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
and add under, this:
PHP:
	registerCreatureEvent(cid, "advance_rewards")
^^
 
Back
Top