Pedrook
Advanced OT User
- Joined
- May 24, 2009
- Messages
- 442
- Solutions
- 3
- Reaction score
- 183
- Location
- Brazil
- GitHub
- pedrogiampietro
someone can help me to change, instead of level right I would like to put level in level to gain 5 premium points.
Lua:
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