• 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!

How to add Exp boost time to otclient?

sevengym

Member
Joined
Aug 27, 2014
Messages
84
Reaction score
8
Location
Poland
I'm trying to add exp boost time to otclient. Any tips how to do it properly? Thats my Exp boost script. I added this in skills.lua onExpBoostChange = onExpBoostChange, and also this onExpBoostChange(player, player:getStorageValue()) and then i made a function with storage. I also tried adding a new function in compat.lua so i don't need to use storage. Nothing seems to work so far. Ofc i added the button in skills.otui
LUA:
local boostStorage = 693690
local boostDuration = 18000 -- 5 hours in seconds

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    local currentBoostEnd = player:getStorageValue(boostStorage)
    local currentStamina = player:getStamina()

    if currentBoostEnd >= os.time() and currentStamina > 14 * 60 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You already have an EXP boost active!")
        return true
    end

    local newBoostEnd = os.time() + boostDuration

    if currentStamina <= 14 * 60 then
        local remainingStaminaTime = currentStamina * 60
        newBoostEnd = os.time() + remainingStaminaTime
    end

    player:setStorageValue(boostStorage, newBoostEnd)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Your 5 hours EXP boost has started! You will gain 25% extra experience.")
    item:remove(1)
    return true
end
 

Similar threads

Back
Top