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

item on level up?

p41nwithoutlove

New Member
Joined
Aug 12, 2008
Messages
216
Reaction score
0
can some 1 make me a script for when u level up u get like a bag with 4-6 items in it?

rep ++ for help
 
Lua:
  backpack = {
   {id = 2798, amount = 1},
   {id = 7759, amount = 1},
   {id = 7761, amount = 1},
   {id = 7760, amount = 1},
   {id = 7762, amount = 1},
  }
  level = 50

function onAdvance(cid, newlevel, oldlevel)
	if newlevel == level then
		for _, i in ipairs(backpack) do
		  bp = doPlayerAddItem(cid, 1988, 1)
		  doAddContainerItem(bp, i.id, i.amount)
		end
	end
return TRUE
end
 
@up
fix script:
* only when advance IN level, not skill/mlvl
* maybe author of first post want bag with items every level not only on XX level :p
and onAdvance has parameters:
PHP:
function onAdvance(cid, skill, oldLevel, newLevel)
SKILL__LEVEL = 8
PHP:
if skill == 8 then --advance in level
...
dont forget to add it in login.lua (register event)
example of onAdvance:
http://otland.net/f82/skills-magic-level-stages-49165/
 
Lua:
  backpack = {
   {id = 2798, amount = 1},
   {id = 7759, amount = 1},
   {id = 7761, amount = 1},
   {id = 7760, amount = 1},
   {id = 7762, amount = 1},
  }
  level = 50

function onAdvance(cid, skill, oldLevel, newLevel)
        if skill == 8 then
                for _, i in ipairs(backpack) do
                  bp = doPlayerAddItem(cid, 1988, 1)
                  doAddContainerItem(bp, i.id, i.amount)
                end
        end
return TRUE
end

I think this is what Gesior said:p
 
Code:
local items = {
	[50] = {
		{2160, 100},
		{2152, 100}
	},
	[100] = {
		{2160, 255},
		{2160, 255}
	}
}

function onAdvance(cid, skill, oldLevel, newLevel)
	local now = items[newLevel]
	if (not now) then
		return true
	end

	for i = 1, #now do
		doPlayerAddItem(cid, now[i][1], now[i][2])
	end
	return true
end
 
@Gesior.pl:
I did not read the first post, just checked 2 post above mine <lol>.

Here's version with container:
Code:
local items = {
	[50] = {
		{2160, 100},
		{2152, 100}
	},
	[100] = {
		{2160, 255},
		{2160, 255}
	}
}
local containerId = 1988

function onAdvance(cid, skill, oldLevel, newLevel)
	local now = items[newLevel]
	if (not now) then
		return true
	end

	local container = doPlayerAddItem(cid, containerId)
	for i = 1, #now do
		doContainerAddItem(container, now[i][1], now[i][2])
	end
	return true
end

It haven't cap check etc., but i think it's no problem for you ;p
 
@Gesior.pl:
I did not read the first post, just checked 2 post above mine <lol>.

Here's version with container:
Code:
local items = {
	[50] = {
		{2160, 100},
		{2152, 100}
	},
	[100] = {
		{2160, 255},
		{2160, 255}
	}
}
local containerId = 1988

function onAdvance(cid, skill, oldLevel, newLevel)
	local now = items[newLevel]
	if (not now) then
		return true
	end

	local container = doPlayerAddItem(cid, containerId)
	for i = 1, #now do
		doContainerAddItem(container, now[i][1], now[i][2])
	end
	return true
end

It haven't cap check etc., but i think it's no problem for you ;p



can you make it so it gives every level? the only reason i need a container is that the item that im using isnt stackable :/ thanks so much in advance if u can
 
Back
Top