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

RevScripts Kick Boss Room

adrenysny

Member
Joined
Feb 17, 2021
Messages
140
Reaction score
14
Hello, help me with this script, I want you to kick out of the room after 15 minutes

Lua:
-- FUNCTIONS
local function doCheckArea()
    local upConer = {x = 32424, y = 32507, z = 7} -- upLeftCorner
    local downConer = {x = 32459, y = 32542, z = 7} -- downRightCorner
    for i = upConer.x, downConer.x do
        for j = upConer.y, downConer.y do
            for k = upConer.z, downConer.z do
                local room = {x = i, y = j, z = k}
                local tile = Tile(room)
                if tile then
                    local creatures = tile:getCreatures()
                    if creatures and #creatures > 0 then
                        for _, c in pairs(creatures) do
                            if isPlayer(c) then
                                return true
                            end
                        end
                    end
                end
            end
        end
    end
    return false
end
local function clearArea()
    local upConer = {x = 32424, y = 32507, z = 7} -- upLeftCorner
    local downConer = {x = 32459, y = 32542, z = 7} -- downRightCorner
    for i = upConer.x, downConer.x do
        for j = upConer.y, downConer.y do
            for k = upConer.z, downConer.z do
                local room = {x = i, y = j, z = k}
                local tile = Tile(room)
                if tile then
                    local creatures = tile:getCreatures()
                    if creatures and #creatures > 0 then
                        for _, c in pairs(creatures) do
                            if isPlayer(c) then
                                c:teleportTo({x = 32453, y = 32505, z = 7})
                            elseif isMonster(c) then
                                c:remove()
                            end
                        end
                    end
                end
            end
        end
    end
end
-- FUNCTIONS END
local drume = Action()
function drume.onUse(player, item, fromPosition, itemEx, toPosition)
    local config = {
        playerPositions = {
            Position(32457, 32508, 6),
            Position(32458, 32508, 6),
            Position(32459, 32508, 6),
            Position(32460, 32508, 6),
            Position(32461, 32508, 6)
        },
        newPos = {x = 32453, y = 32509, z = 7}
    }
    local pushPos = {x = 32457, y = 32508, z = 6}
    if item.actionid == 33825 then
        if item.itemid == 36201 then
            if player:getPosition().x == pushPos.x
            and player:getPosition().y == pushPos.y
            and player:getPosition().z == pushPos.z then
                local storePlayers, playerTile = {}
                for i = 1, #config.playerPositions do
                    playerTile = Tile(config.playerPositions):getTopCreature()
                    if isPlayer(playerTile) then
                        storePlayers[#storePlayers + 1] = playerTile
                    end
                end
                if doCheckArea() == false then
                    clearArea()
                    local players
                    for i = 1, #storePlayers do
                        players = storePlayers
                        config.playerPositions:sendMagicEffect(CONST_ME_POFF)
                        players:teleportTo(config.newPos)
                        players:setStorageValue(59950, os.time() + 20 * 60 * 60)
                    end
                    Position(config.newPos):sendMagicEffect(11)
                    Game.setStorageValue(59950, 0) -- Drume Timer
                    Game.createMonster("Usurper Warlock", {x = 32451, y = 32509, z = 7}, false, true)
                    Game.createMonster("Drume", {x = 32440, y = 32523, z = 7}, false, true)
                else
                    player:sendTextMessage(19, "Someone is in the area.")
                end
            else
                return true
            end
        end
        item:transform(item.itemid == 36201 and 36201 or 36201)
    end
    return true
end
drume:aid(33825)
drume:register()
 
Lua:
-- this will call clearArea function after 15 minutes.
addEvent(clearArea, 15 * 60 * 1000)
I already tried adding that and it generates a bug, because every 15 minutes it deletes the room, even if the people are not inside, if the room has 1 minute left and people enter the boss it will remove them
 
Back
Top