• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Item which gives levels

zxzxzx

New Member
Joined
Mar 12, 2011
Messages
334
Reaction score
3
Hello! I'm need simple script item which gives me levels: etc I have 100 level and use item id X which gives me 5 levels and I have 105 level but player can only use 1 level up item of this ID.

Thanks for help ++!
 
you want an item that gives any player 5 lvls, and it can only be used once? 5 lvls no matter lvl? 100-105, 300-305 etc?
 
Hello! I'm need simple script item which gives me levels: etc I have 100 level and use item id X which gives me 5 levels and I have 105 level but player can only use 1 level up item of this ID.
if what you want is that player no matter how much exp. he needs to next level ever grow up 5 levels, try it
Code:
local function t(l)
    local r = ((50 * math.pow(l, 3) / 3) - (100 * math.pow(l, 2)) + ((850 * l) / 3) - 200)
    return r
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local s = 35478
    if player:getStorageValue(s) == 1 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot use this item more than once.")
        return true
    end

    player:addExperience(t(player:getLevel() + 5) - player:getExperience(), true --[[set to false if you don't want to show up the exp animated text to player.]])
    player:setStorageValue(s, 1)
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You grew up 5 levels!")

    return true
end
 
Back
Top