• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Advance level, reward points.

Pedrook

Advanced OT User
Joined
May 24, 2009
Messages
442
Solutions
3
Reaction score
183
Location
Brazil
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
 
Back
Top