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

Lua Looking for special chest script

gohamvsgoku

Member
Joined
Aug 21, 2017
Messages
151
Reaction score
9
Hello guys
I need help to create a chest script that give for player 2000 of exp or 3000 of exp random when use, but with interval of 10 minutes to use again the chest, someone can help with this script? I have forgotten server 1.x
 
try
Lua:
local config = {
    delayStorage = 43912,
    delayTime = 10 * 60, -- 10min
    expMin = 2000,
    expMax = 3000
}

function onUse(player, item, fromPosition, itemEx, toPosition)
    local storage = player:getStorageValue(config.delayStorage)
    if storage > os.time() then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You may only use this chest every 10min.')
        return true
    end

    local exp = math.random(config.expMin, config.expMax)
    player:addExperience(exp)
    player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You have received ' .. exp .. ' experience.')
    player:setStorageValue(config.delayStorage, config.delayTime + os.time())
    return true
end
 
Back
Top