Hello, I have a problem with script advance reward. it functions normally but for the reward function, the character needs to level up the exact level ...
example: i am lvl 49, kill monster and up to level 50 = win reward
but if i am lvl 49, kill monster and up to level 51 = dont win reward
this is bad because as I said my server is different and in some cases like invasions, the players evolve 2-3 level at once, but he wanted them to win the reward of the previous level...
example: i am lvl 49, kill monster and up to level 50 = win reward
but if i am lvl 49, kill monster and up to level 51 = dont win reward
this is bad because as I said my server is different and in some cases like invasions, the players evolve 2-3 level at once, but he wanted them to win the reward of the previous level...
function onAdvance(cid, skill, oldLevel, newLevel)
local storage = 30700
local config = {
[30] = {item = 2160, count = 1},
[50] = {item = 2160, count = 2},
[80] = {item = 2160, count = 3},
[100] = {item = 2157, count = 4},
[150] = {item = 2157, count = 5},
[200] = {item = 2157, count = 100},
}
if(skill == 8)then
for level, info in pairs(config) do
if(newLevel == level and newLevel > getPlayerStorageValue(cid, storage))then
doPlayerAddItem(cid, info.item, info.count)
doPlayerSendTextMessage(cid, 27, "Parabéns você atingiu o level "..newLevel.." e ganhou "..info.count.." "..getItemNameById(info.item)..".")
setPlayerStorageValue(cid, storage, newLevel)
break
end
end
end
return true
end
local storage = 30700
local config = {
[30] = {item = 2160, count = 1},
[50] = {item = 2160, count = 2},
[80] = {item = 2160, count = 3},
[100] = {item = 2157, count = 4},
[150] = {item = 2157, count = 5},
[200] = {item = 2157, count = 100},
}
if(skill == 8)then
for level, info in pairs(config) do
if(newLevel == level and newLevel > getPlayerStorageValue(cid, storage))then
doPlayerAddItem(cid, info.item, info.count)
doPlayerSendTextMessage(cid, 27, "Parabéns você atingiu o level "..newLevel.." e ganhou "..info.count.." "..getItemNameById(info.item)..".")
setPlayerStorageValue(cid, storage, newLevel)
break
end
end
end
return true
end