Just change SKILL__LEVEL to SKILL_LEVEL xd
Awesome, no errors but it gives 3x rewards hehe.
It only gave me the reward once when I tested the script, have you tried with another character?
local t, storage = {
{20, 2160, 2},
{30, 2160, 3},
{40, 2160, 5}
}, 1234
function onAdvance(cid, skill, oldLevel, newLevel)
local player = Player(cid)
if skill ~= SKILL_LEVEL then
return true
end
for i = 1, #t do
local v = t[i]
if newLevel >= v[1] and player:getStorageValue(storage) < i then
player:addItem(v[2], v[3])
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been rewarded with " .. (isItemStackable(v[2]) and v[3] .. "" or getItemDescriptions(v[2]).article ~= "" and getItemDescriptions(v[2]).article .. " " or "") .. " " .. getItemDescriptions(v[2]).plural .. " for reaching level " .. v[1] .. "!")
player:setStorageValue(storage, i)
break
end
end
return true
end
Code:local t, storage = { {20, 2160, 2}, {30, 2160, 3}, {40, 2160, 5} }, 1234 function onAdvance(cid, skill, oldLevel, newLevel) local player = Player(cid) if skill ~= SKILL_LEVEL then return true end for i = 1, #t do local v = t[i] if newLevel >= v[1] and player:getStorageValue(storage) < i then player:addItem(v[2], v[3]) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been rewarded with " .. (isItemStackable(v[2]) and v[3] .. "" or getItemDescriptions(v[2]).article ~= "" and getItemDescriptions(v[2]).article .. " " or "") .. " " .. getItemDescriptions(v[2]).plural .. " for reaching level " .. v[1] .. "!") player:setStorageValue(storage, i) break end end return true end