Postado Fevereiro 9, 2020 5 anos como eu faço pra utilizar a restrição de players ? digo, nao preciso dos 5 players para fazer, se tiver só 1 ja vai, mas o maximo é 5 mesmo.
Postado Fevereiro 9, 2020 5 anos local t = { players = { -- posições que os players devem ficar ao puxar a alavanca [1] = Position(1,1,1), [2] = Position(1,1,1), [3] = Position(1,1,1), [4] = Position(1,1,1), [5] = Position(1,1,1) }, No caso se quiser 3 deixa assim: local t = { players = { -- posições que os players devem ficar ao puxar a alavanca [1] = Position(1,1,1), [2] = Position(1,1,1), [3] = Position(1,1,1) },
Postado Fevereiro 9, 2020 5 anos Em 09/02/2020 em 17:43, trc.user disse: como eu faço pra utilizar a restrição de players ? digo, nao preciso dos 5 players para fazer, se tiver só 1 ja vai, mas o maximo é 5 mesmo. local t = { players = { [1] = Position(1,1,1), [2] = Position(1,1,1), [3] = Position(1,1,1), [4] = Position(1,1,1), [5] = Position(1,1,1) }, boss = {name = "Dwarf Guard", create_pos = Position(1,1,1)}, destination = Position(1,1,1), cooldown = {20, "hour"}, storage = 56482 } 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("None of the players did not wait " .. getStrTime(t.cooldown) .. " to go again.") 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
Postado Fevereiro 9, 2020 5 anos @Dwarfer funcionou perfeitamente aqui. agora pode fazer o boss com 1 ou mais players.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.