Hello guys, im useing this Script and i have some issues with it... For example... At level 30 it must give dwarven fang, knight axe and dragon hammer to Knights... But script execute itself when Knight reach 30 SKILLS...
Could someone check what's wrong ?
Could someone check what's wrong ?
local config, storage = {
[{1, 5}] = {
[20] = {
{
{2188, 1}
}
},
[35] = {
{
{2187, 1}
}
},
[50] = {
{
{8871, 1}, {8902, 1}
}
}
},
[{2, 6}] = {
[20] = {
{
{2185, 1}
}
},
[35] = {
{
{2183, 1}
}
},
[50] = {
{
{8871, 1}, {8902, 1}
}
}
},
[{3, 7}] = {
[15] = {
{
{2389, 10}
}
},
[25] = {
{
{2455, 1}, {2543, 200}
}
},
[35] = {
{
{7378, 10}
}
}
},
[55] = {
{
{15644, 1}, {2547, 200}
}
},
[{4, 8}] = {
[30] = {
{
{7408, 1}, {7750, 1}, {2434, 1}
}
},
[55] = {
{
{7404, 1}, {15451, 1}, {15647, 1}
}
},
[100] = {
{
{2160, 10}
}
}
}
}, 123
function onAdvance(cid, skill, oldLevel, newLevel)
local player = Player(cid)
if skill ~= 8 then
return true
end
for vocation, k in pairs(config) do
if isInArray(vocation, player:getVocation():getId()) then
for level, v in pairs(k) do
if newLevel >= level and player:getStorageValue(storage + level) ~= 1 then
local text = ""
for i = 1, #v[1] do
local itemType = ItemType(v[1][1])
text = text .. (i ~= 1 and (i == #v[1] and " and " or ", ") or "") .. (v[1][2] > 1 and v[1][2] or itemType:getArticle()) .. " " .. (v[1][2] > 1 and itemType:getPluralName() or itemType:getName())
player:addItem(v[1][1], v[1][2])
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("Congratulations, you reached level %d and received %s.", level, text))
player:setStorageValue(storage + level, 1)
end
end
end
end
return true
end