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
rep ++ for help
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
function onAdvance(cid, skill, oldLevel, newLevel)
if skill == 8 then --advance in level
...
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
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
@Chojrakcan 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
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
@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