• 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 Lever Boss Helppp

trcuser

New Member
Joined
Mar 25, 2018
Messages
5
Reaction score
0
Good evening guys, how are you? hope so.

I need your help guys.

I have a script to use the lever and go to the boss room, but I'm not able to check if there is a player in the room before entering.

so if one person is doing the boss and another wants to enter, he can do it.

Can someone help me ?


Script:
local t = {
players = { -- posições que os players devem ficar ao puxar a alavanca
[1] = Position(33395,32661,6),
[2] = Position(33394,32662,6),
[3] = Position(33395,32662,6),
[4] = Position(33395,32663,6),
[5] = Position(33396,32662,6)
},

boss = {name = "Scarlett Etzel", create_pos = Position(33396,32642,6)},

destination = Position(33395,32656,6), -- posição para qual os players serão teleportados

cooldown = {20, "hour"}, -- tempo para ser teleportado novamente. Ex.: {2, "sec"}, {5, "min"}, {10, "hour"}, {3, "day"}

storage = 56482 -- storage não utilizado no seu servidor
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local players, tab = {}, t.players
for i = 1, #tab do
local tile = Tile(tab)
if tile then
local p = Player(tile:getTopCreature())
if p then
if p:getStorageValue(t.storage) <= os.time() then
players[#players + 1] = p:getId()
end
end
end
end
if #players == 0 then
player:sendCancelMessage("One or all players did not wait " .. getStrTime(t.cooldown) .. " to go again.")
return true
end
for i = 1, #tab do
local playerTile = Tile(tab)
local playerToGo = Player(playerTile:getTopCreature())
if playerToGo then
if isInArray(players, playerToGo:getId()) then
playerToGo:setStorageValue(t.storage, mathtime(t.cooldown) + os.time())
playerTile:relocateTo(t.destination)
tab:sendMagicEffect(CONST_ME_POFF)
end
end
end
t.destination:sendMagicEffect(CONST_ME_TELEPORT)
Game.createMonster(t.boss.name, t.boss.create_pos)
item:transform(item.itemid == 36319 or 1946 or 1945)
return true
end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1](60^(v == unit[4] and 2 or i-1))(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end

function getStrTime(table) -- by dwarfer
local unit = {["sec"] = "second",["min"] = "minute",["hour"] = "hour",["day"] = "day"}
return tostring(table[1].." "..unit[table[2]]..(table[1] > 1 and "s" or ""))
end
 
Try something like this and change boss_room XYZ.
Lua:
local t = {
players = { -- posições que os players devem ficar ao puxar a alavanca
[1] = Position(33395,32661,6),
[2] = Position(33394,32662,6),
[3] = Position(33395,32662,6),
[4] = Position(33395,32663,6),
[5] = Position(33396,32662,6)
},

boss = {name = "Scarlett Etzel", create_pos = Position(33396,32642,6)},

destination = Position(33395,32656,6), -- posição para qual os players serão teleportados

cooldown = {20, "hour"}, -- tempo para ser teleportado novamente. Ex.: {2, "sec"}, {5, "min"}, {10, "hour"}, {3, "day"}

storage = 56482 -- storage não utilizado no seu servidor
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local players, tab = {}, t.players
for i = 1, #tab do
local tile = Tile(tab)
if tile then
local p = Player(tile:getTopCreature())
if p then
if p:getStorageValue(t.storage) <= os.time() then
players[#players + 1] = p:getId()
end
end
end
end
if #players == 0 then
player:sendCancelMessage("One or all players did not wait " .. getStrTime(t.cooldown) .. " to go again.")
return true
end
for i = 1, #tab do
local playerTile = Tile(tab)
local playerToGo = Player(playerTile:getTopCreature())
if playerToGo then
if isInArray(players, playerToGo:getId()) then
playerToGo:setStorageValue(t.storage, mathtime(t.cooldown) + os.time())
playerTile:relocateTo(t.destination)
tab:sendMagicEffect(CONST_ME_POFF)
end
end
end
t.destination:sendMagicEffect(CONST_ME_TELEPORT)
Game.createMonster(t.boss.name, t.boss.create_pos)
item:transform(item.itemid == 36319 or 1946 or 1945)
return true
end

local boss_room = {fromPos = Position(1000, 1000, 7), toPos = Position(1000, 1000, 7)}
local bossplayer = Player(cid)

if bossplayer and isInRange(bossplayer:getPosition(), boss_room.fromPos, quest_range.toPos) then
   return player:sendCancelMessage(bossplayer:getName() .. " Boss room is full.")
        end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1](60^(v == unit[4] and 2 or i-1))(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end

function getStrTime(table) -- by dwarfer
local unit = {["sec"] = "second",["min"] = "minute",["hour"] = "hour",["day"] = "day"}
return tostring(table[1].." "..unit[table[2]]..(table[1] > 1 and "s" or ""))
end
 
Post automatically merged:

Try something like this and change boss_room XYZ.
Lua:
local t = {
players = { -- posições que os players devem ficar ao puxar a alavanca
[1] = Position(33395,32661,6),
[2] = Position(33394,32662,6),
[3] = Position(33395,32662,6),
[4] = Position(33395,32663,6),
[5] = Position(33396,32662,6)
},

boss = {name = "Scarlett Etzel", create_pos = Position(33396,32642,6)},

destination = Position(33395,32656,6), -- posição para qual os players serão teleportados

cooldown = {20, "hour"}, -- tempo para ser teleportado novamente. Ex.: {2, "sec"}, {5, "min"}, {10, "hour"}, {3, "day"}

storage = 56482 -- storage não utilizado no seu servidor
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local players, tab = {}, t.players
for i = 1, #tab do
local tile = Tile(tab)
if tile then
local p = Player(tile:getTopCreature())
if p then
if p:getStorageValue(t.storage) <= os.time() then
players[#players + 1] = p:getId()
end
end
end
end
if #players == 0 then
player:sendCancelMessage("One or all players did not wait " .. getStrTime(t.cooldown) .. " to go again.")
return true
end
for i = 1, #tab do
local playerTile = Tile(tab)
local playerToGo = Player(playerTile:getTopCreature())
if playerToGo then
if isInArray(players, playerToGo:getId()) then
playerToGo:setStorageValue(t.storage, mathtime(t.cooldown) + os.time())
playerTile:relocateTo(t.destination)
tab:sendMagicEffect(CONST_ME_POFF)
end
end
end
t.destination:sendMagicEffect(CONST_ME_TELEPORT)
Game.createMonster(t.boss.name, t.boss.create_pos)
item:transform(item.itemid == 36319 or 1946 or 1945)
return true
end

local boss_room = {fromPos = Position(1000, 1000, 7), toPos = Position(1000, 1000, 7)}
local bossplayer = Player(cid)

if bossplayer and isInRange(bossplayer:getPosition(), boss_room.fromPos, quest_range.toPos) then
   return player:sendCancelMessage(bossplayer:getName() .. " Boss room is full.")
        end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1](60^(v == unit[4] and 2 or i-1))(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end

function getStrTime(table) -- by dwarfer
local unit = {["sec"] = "second",["min"] = "minute",["hour"] = "hour",["day"] = "day"}
return tostring(table[1].." "..unit[table[2]]..(table[1] > 1 and "s" or ""))
end

1581296864711.png

@M0ustafa
can still enter several chares at the same time :(
help plxx :'((((
 
You changed this to the xyz range of your boss room?
Lua:
local boss_room = {fromPos = Position(1000, 1000, 7), toPos = Position(1000, 1000, 7)}
 
Ok try this one
Lua:
local t = {
players = { -- posições que os players devem ficar ao puxar a alavanca
[1] = Position(33395,32661,6),
[2] = Position(33394,32662,6),
[3] = Position(33395,32662,6),
[4] = Position(33395,32663,6),
[5] = Position(33396,32662,6)
},

boss = {name = "Scarlett Etzel", create_pos = Position(33396,32642,6)},

destination = Position(33395,32656,6), -- posição para qual os players serão teleportados

cooldown = {20, "hour"}, -- tempo para ser teleportado novamente. Ex.: {2, "sec"}, {5, "min"}, {10, "hour"}, {3, "day"}

storage = 56482 -- storage não utilizado no seu servidor
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local players, tab = {}, t.players
for i = 1, #tab do
local tile = Tile(tab)
if tile then
local p = Player(tile:getTopCreature())
if p then
if p:getStorageValue(t.storage) <= os.time() then
players[#players + 1] = p:getId()
end
end
end
end
if #players == 0 then
player:sendCancelMessage("One or all players did not wait " .. getStrTime(t.cooldown) .. " to go again.")
return true
end
for i = 1, #tab do
local playerTile = Tile(tab)
local playerToGo = Player(playerTile:getTopCreature())
if playerToGo then
if isInArray(players, playerToGo:getId()) then
playerToGo:setStorageValue(t.storage, mathtime(t.cooldown) + os.time())
playerTile:relocateTo(t.destination)
tab:sendMagicEffect(CONST_ME_POFF)
end
end
end
t.destination:sendMagicEffect(CONST_ME_TELEPORT)
Game.createMonster(t.boss.name, t.boss.create_pos)
item:transform(item.itemid == 36319 or 1946 or 1945)
return true
end

local boss_room = {fromPos = Position(1000, 1000, 7), toPos = Position(1000, 1000, 7)}
local bossplayer = Player(cid)
local exit = Position(1000, 1000, 7)

if bossplayer and isInRange(bossplayer:getPosition(), boss_room.fromPos, quest_range.toPos) then
   bossplayer:teleportTo(exit)
        end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1](60^(v == unit[4] and 2 or i-1))(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end

function getStrTime(table) -- by dwarfer
local unit = {["sec"] = "second",["min"] = "minute",["hour"] = "hour",["day"] = "day"}
return tostring(table[1].." "..unit[table[2]]..(table[1] > 1 and "s" or ""))
end
Lua:
local boss_room = {fromPos = Position(1000, 1000, 7), toPos = Position(1000, 1000, 7)}
boss_room is the boss room xyz range from northwest to southeast
Lua:
local exit = Position(1000, 1000, 7)
Exit is the xyz where players get TPed after killing the boss.
 
Ok try this one
Lua:
local t = {
players = { -- posições que os players devem ficar ao puxar a alavanca
[1] = Position(33395,32661,6),
[2] = Position(33394,32662,6),
[3] = Position(33395,32662,6),
[4] = Position(33395,32663,6),
[5] = Position(33396,32662,6)
},

boss = {name = "Scarlett Etzel", create_pos = Position(33396,32642,6)},

destination = Position(33395,32656,6), -- posição para qual os players serão teleportados

cooldown = {20, "hour"}, -- tempo para ser teleportado novamente. Ex.: {2, "sec"}, {5, "min"}, {10, "hour"}, {3, "day"}

storage = 56482 -- storage não utilizado no seu servidor
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local players, tab = {}, t.players
for i = 1, #tab do
local tile = Tile(tab)
if tile then
local p = Player(tile:getTopCreature())
if p then
if p:getStorageValue(t.storage) <= os.time() then
players[#players + 1] = p:getId()
end
end
end
end
if #players == 0 then
player:sendCancelMessage("One or all players did not wait " .. getStrTime(t.cooldown) .. " to go again.")
return true
end
for i = 1, #tab do
local playerTile = Tile(tab)
local playerToGo = Player(playerTile:getTopCreature())
if playerToGo then
if isInArray(players, playerToGo:getId()) then
playerToGo:setStorageValue(t.storage, mathtime(t.cooldown) + os.time())
playerTile:relocateTo(t.destination)
tab:sendMagicEffect(CONST_ME_POFF)
end
end
end
t.destination:sendMagicEffect(CONST_ME_TELEPORT)
Game.createMonster(t.boss.name, t.boss.create_pos)
item:transform(item.itemid == 36319 or 1946 or 1945)
return true
end

local boss_room = {fromPos = Position(1000, 1000, 7), toPos = Position(1000, 1000, 7)}
local bossplayer = Player(cid)
local exit = Position(1000, 1000, 7)

if bossplayer and isInRange(bossplayer:getPosition(), boss_room.fromPos, boss_room.toPos) then
   bossplayer:teleportTo(exit)
        end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1](60^(v == unit[4] and 2 or i-1))(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end

function getStrTime(table) -- by dwarfer
local unit = {["sec"] = "second",["min"] = "minute",["hour"] = "hour",["day"] = "day"}
return tostring(table[1].." "..unit[table[2]]..(table[1] > 1 and "s" or ""))
end
Lua:
local boss_room = {fromPos = Position(1000, 1000, 7), toPos = Position(1000, 1000, 7)}
boss_room is the boss room xyz range from northwest to southeast
Lua:
local exit = Position(1000, 1000, 7)
Exit is the xyz where players get TPed after killing the boss.

no :'(.
i put this code, and now i cant enter in room, even without anyone inside.


Lua:
local t = {
players = { -- posições que os players devem ficar ao puxar a alavanca
[1] = Position(33395,32661,6),
[2] = Position(33394,32662,6),
[3] = Position(33395,32662,6),
[4] = Position(33395,32663,6),
[5] = Position(33396,32662,6)
},

boss = {name = "Scarlett Etzel", create_pos = Position(33396,32642,6)},

destination = Position(33395,32656,6), -- posição para qual os players serão teleportados

cooldown = {0, "sec"}, -- tempo para ser teleportado novamente. Ex.: {2, "sec"}, {5, "min"}, {10, "hour"}, {3, "day"}

storage = 56482 -- storage não utilizado no seu servidor
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local players, tab = {}, t.players
for i = 1, #tab do
local tile = Tile(tab)
if tile then
local p = Player(tile:getTopCreature())
if p then
if p:getStorageValue(t.storage) <= os.time() then
players[#players + 1] = p:getId()
end
end
end
end
if #players == 0 then
player:sendCancelMessage("One or all players did not wait " .. getStrTime(t.cooldown) .. " to go again.")
return true
end
for i = 1, #tab do
local playerTile = Tile(tab)
local playerToGo = Player(playerTile:getTopCreature())
if playerToGo then
if isInArray(players, playerToGo:getId()) then
playerToGo:setStorageValue(t.storage, mathtime(t.cooldown) + os.time())
playerTile:relocateTo(t.destination)
tab:sendMagicEffect(CONST_ME_POFF)
end
end
end
t.destination:sendMagicEffect(CONST_ME_TELEPORT)
Game.createMonster(t.boss.name, t.boss.create_pos)
item:transform(item.itemid == 36319 or 1946 or 1945)
return true
end

local boss_room = {fromPos = Position(33386, 32639, 6), toPos = Position(33405, 32659, 6)}
local bossplayer = Player(cid)
local exit = Position(33395, 32659, 6)

if bossplayer and isInRange(bossplayer:getPosition(), boss_room.fromPos, quest_range.toPos) then
   bossplayer:teleportTo(exit)
        end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1](60^(v == unit[4] and 2 or i-1))(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end

function getStrTime(table) -- by dwarfer
local unit = {["sec"] = "second",["min"] = "minute",["hour"] = "hour",["day"] = "day"}
return tostring(table[1].." "..unit[table[2]]..(table[1] > 1 and "s" or ""))
end
 
I had a typo since I copied lines from my server, Try now.
Lua:
local t = {
players = { -- posições que os players devem ficar ao puxar a alavanca
[1] = Position(33395,32661,6),
[2] = Position(33394,32662,6),
[3] = Position(33395,32662,6),
[4] = Position(33395,32663,6),
[5] = Position(33396,32662,6)
},

boss = {name = "Scarlett Etzel", create_pos = Position(33396,32642,6)},

destination = Position(33395,32656,6), -- posição para qual os players serão teleportados

cooldown = {0, "sec"}, -- tempo para ser teleportado novamente. Ex.: {2, "sec"}, {5, "min"}, {10, "hour"}, {3, "day"}

storage = 56482 -- storage não utilizado no seu servidor
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local players, tab = {}, t.players
for i = 1, #tab do
local tile = Tile(tab)
if tile then
local p = Player(tile:getTopCreature())
if p then
if p:getStorageValue(t.storage) <= os.time() then
players[#players + 1] = p:getId()
end
end
end
end
if #players == 0 then
player:sendCancelMessage("One or all players did not wait " .. getStrTime(t.cooldown) .. " to go again.")
return true
end
for i = 1, #tab do
local playerTile = Tile(tab)
local playerToGo = Player(playerTile:getTopCreature())
if playerToGo then
if isInArray(players, playerToGo:getId()) then
playerToGo:setStorageValue(t.storage, mathtime(t.cooldown) + os.time())
playerTile:relocateTo(t.destination)
tab:sendMagicEffect(CONST_ME_POFF)
end
end
end
t.destination:sendMagicEffect(CONST_ME_TELEPORT)
Game.createMonster(t.boss.name, t.boss.create_pos)
item:transform(item.itemid == 36319 or 1946 or 1945)
return true
end

local boss_room = {fromPos = Position(33386, 32639, 6), toPos = Position(33405, 32659, 6)}
local bossplayer = Player(cid)
local exit = Position(33395, 32659, 6)

if bossplayer and isInRange(bossplayer:getPosition(), boss_room.fromPos, boss_room.toPos) then
   bossplayer:teleportTo(exit)
        end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1](60^(v == unit[4] and 2 or i-1))(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end

function getStrTime(table) -- by dwarfer
local unit = {["sec"] = "second",["min"] = "minute",["hour"] = "hour",["day"] = "day"}
return tostring(table[1].." "..unit[table[2]]..(table[1] > 1 and "s" or ""))
end
 
I had a typo since I copied lines from my server, Try now.
Lua:
local t = {
players = { -- posições que os players devem ficar ao puxar a alavanca
[1] = Position(33395,32661,6),
[2] = Position(33394,32662,6),
[3] = Position(33395,32662,6),
[4] = Position(33395,32663,6),
[5] = Position(33396,32662,6)
},

boss = {name = "Scarlett Etzel", create_pos = Position(33396,32642,6)},

destination = Position(33395,32656,6), -- posição para qual os players serão teleportados

cooldown = {0, "sec"}, -- tempo para ser teleportado novamente. Ex.: {2, "sec"}, {5, "min"}, {10, "hour"}, {3, "day"}

storage = 56482 -- storage não utilizado no seu servidor
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local players, tab = {}, t.players
for i = 1, #tab do
local tile = Tile(tab)
if tile then
local p = Player(tile:getTopCreature())
if p then
if p:getStorageValue(t.storage) <= os.time() then
players[#players + 1] = p:getId()
end
end
end
end
if #players == 0 then
player:sendCancelMessage("One or all players did not wait " .. getStrTime(t.cooldown) .. " to go again.")
return true
end
for i = 1, #tab do
local playerTile = Tile(tab)
local playerToGo = Player(playerTile:getTopCreature())
if playerToGo then
if isInArray(players, playerToGo:getId()) then
playerToGo:setStorageValue(t.storage, mathtime(t.cooldown) + os.time())
playerTile:relocateTo(t.destination)
tab:sendMagicEffect(CONST_ME_POFF)
end
end
end
t.destination:sendMagicEffect(CONST_ME_TELEPORT)
Game.createMonster(t.boss.name, t.boss.create_pos)
item:transform(item.itemid == 36319 or 1946 or 1945)
return true
end

local boss_room = {fromPos = Position(33386, 32639, 6), toPos = Position(33405, 32659, 6)}
local bossplayer = Player(cid)
local exit = Position(33395, 32659, 6)

if bossplayer and isInRange(bossplayer:getPosition(), boss_room.fromPos, boss_room.toPos) then
   bossplayer:teleportTo(exit)
        end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1](60^(v == unit[4] and 2 or i-1))(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end

function getStrTime(table) -- by dwarfer
local unit = {["sec"] = "second",["min"] = "minute",["hour"] = "hour",["day"] = "day"}
return tostring(table[1].." "..unit[table[2]]..(table[1] > 1 and "s" or ""))
end

I still can't get into the room. D:
no errors in the log too
 
Back
Top