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

[ACTION][HELP] How to set a specific storage and time

Hyagosrs

Member
Joined
Mar 10, 2018
Messages
94
Solutions
1
Reaction score
12
How to set a specific storage "8091" in this script, and a cooldown of 3 hours for this storage:

LUA:
    if item:getActionId() == 5500 then -- Essence of Malice
        if player:getPosition() == Position(33095, 31943, 15) and item:getId() == 9826 then
            local teleport = 0
            for i = 31943, 31947, 1 do
                local newpos = Position(33095, i, 15)
                local nplayer = Tile(newpos):getTopCreature()
                if nplayer and nplayer:isPlayer() then
                    teleport = teleport + 1
                end
            end

            local frompos = Position(33084, 31907, 15) -- Checagem
            local topos = Position(33114, 31933, 15) -- Checagem

            if(isPlayerInArea(frompos, topos)) then
                player:sendCancelMessage('It looks like there is someone inside.')
                return true
            end

            for _x= frompos.x, topos.x, 1 do
                for _y= frompos.y, topos.y, 1 do
                    for _z= frompos.z, topos.z, 1 do
                        local tile = Tile(Position(_x, _y, _z))
                        if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then
                            tile:getTopCreature():remove()
                        end
                    end
                end
            end

            for i = 31943, 31947, 1 do
                local newpos = Position(33095, i, 15)
                local nplayer = Tile(newpos):getTopCreature()
                if nplayer and nplayer:isPlayer() then
                    nplayer:setStorageValue(Storage.CultsOfTibia.Humans.bossTimer, os.time() + 20 * 60 * 60 * 1 * 1000)
                    nplayer:teleportTo(Position(33098, 31921, 15),true)
                    convertTable[#convertTable + 1] = nplayer:getId()
                    player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
                end
            end
        kickerPlayerRoomAfferMin(convertTable, frompos, topos, Position(33091, 31963, 15), "You were kicked for exceeding the time limit within the boss room.", '', 60, true, ittable, blockmonsters)
        Game.createMonster("Pillar of Summoning", Position(33093, 31919, 15))
        Game.createMonster("Pillar of Death", Position(33098, 31915, 15))
        Game.createMonster("Pillar of Protection", Position(33103, 31919, 15))
        Game.createMonster("Pillar of Healing", Position(33101, 31925, 15))
        Game.createMonster("Pillar of Draining", Position(33095, 31925, 15))
        Game.createMonster("Dorokoll The Mystic STOP", Position(33095, 31924, 15)):registerEvent("pilaresHealth")
        Game.createMonster("Eshtaba The Conjurer STOP", Position(33094, 31919, 15)):registerEvent("pilaresHealth")
        Game.createMonster("Eliz The Unyielding STOP", Position(33102, 31919, 15)):registerEvent("pilaresHealth")
        Game.createMonster("Mezlon The Defiler STOP", Position(33101, 31924, 15)):registerEvent("pilaresHealth")
        Game.createMonster("Malkhar Deathbringer STOP", Position(33098, 31916, 15)):registerEvent("pilaresHealth")
        end
    end
Please heeeeeeeeeeeelp me <3
 
Solution
This script is using the following setstorage line:
LUA:
nplayer:setStorageValue(Storage.CultsOfTibia.Humans.bossTimer, os.time() + 20 * 60 * 60 * 1 * 1000)

Only change to:
LUA:
nplayer:setStorageValue(8091, os.time() + 3 * 60 * 60)
LUA:
local 3_hours_in_seconds = 10800
local current_time = os.time()

local storage = 8091
local storage_value = current_time + 3_hours_in_seconds

-- how to set the storage.
creature:setStorageValue(storage, storage_value)

---------------------
-- checking against the timed storage.

if creature:getStorageValue(storage) >= current_time then
    -- it has been less then 3 hours.
end

if creature:getStorageValue(storage) < current_time then
   -- it has been more then 3 hours.
end
 
This script is using the following setstorage line:
LUA:
nplayer:setStorageValue(Storage.CultsOfTibia.Humans.bossTimer, os.time() + 20 * 60 * 60 * 1 * 1000)

Only change to:
LUA:
nplayer:setStorageValue(8091, os.time() + 3 * 60 * 60)
 
Solution
This script is using the following setstorage line:
LUA:
nplayer:setStorageValue(Storage.CultsOfTibia.Humans.bossTimer, os.time() + 20 * 60 * 60 * 1 * 1000)

Only change to:
LUA:
nplayer:setStorageValue(8091, os.time() + 3 * 60 * 60)

Thanks!!
 
Back
Top