function doAddPoints(cid, points)
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
local config = {
{level = 250, storage = 89964, reward = 2160, howmanyreward = 5},
{level = 300, storage = 89965, reward = 2160, howmanyreward = 8},
{level = 330, storage = 89966, reward = 2160, howmanyreward = 10}
}
function onAdvance(cid, skill, oldLevel, newLevel)
for i = 1, #config do
if(getPlayerStorageValue(cid, config[i].storage) ~= 1 and getPlayerLevel(cid) >= config[i].level) then
local itemname = getItemNameById(config[i].reward)
doAddPoints(cid, config[i].howmanyreward)
setPlayerStorageValue(cid, config[i].storage, 1)
doPlayerSendTextMessage(cid, 22, "You have gained " .. config[i].howmanyreward .. " premium points for advancing to level " .. config[i].level .. ".")
end
end
return TRUE
end