.Qual servidor ou website você utiliza como base?
tfs 1.3
Qual o motivo deste tópico?
Preciso que esse script verifique se tem players na room do boss e tbm que remova o boss caso o player saia da sala ou morra.
Está surgindo algum erro? Se sim coloque-o aqui.
Você tem o código disponível? Se tiver publique-o aqui:
local t = {
players = { -- posições que os players devem ficar ao puxar a alavanca
[1] = Position(33918,31626,8),
[2] = Position(33919,31626,8),
[3] = Position(33920,31626,8),
[4] = Position(33921,31626,8),
[5] = Position(33922,31626,8)
},
boss = {name = "Urmahlullu the Weakened", create_pos = Position(33919,31648,8)},
destination = Position(33919,31657,8), -- posição para qual os players serão teleportados
cooldown = {4, "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[i])
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("Um ou mais players devem esperar " .. getStrTime(t.cooldown) .. " para fazer novamente.")
return true
end
for i = 1, #tab do
local playerTile = Tile(tab[i])
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[i]: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 == 1945 and 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