local rewards = {
-- Level, points
{160, 5},
{200, 10},
{245, 15}
}
function onAdvance(player, skill, oldLevel, newLevel)
if skill ~= SKILL__LEVEL then
return true
end
for i = 1, #rewards do
local reward = rewards[i]
if newLevel >= reward[1] and player:getStorageValue(21352) < i then
db.query("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. reward[2] .. " WHERE `id` = '" .. player:getAccountId() .. "';")
player:setStorageValue(21352, i)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. reward[1] .. ' and you have earned '.. reward[2] ..' points!')
break
end
end
return true
end