Ir para conteúdo
  • Cadastre-se

(Resolvido)Script alavanca


Ir para solução Resolvido por Dwarfer,

Posts Recomendados

  • Respostas 14
  • Created
  • Última resposta

Top Posters In This Topic

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)

},

Link para o post
Compartilhar em outros sites
  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.

 

Expand   Mostrar mais  
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

 

Contato:

  • Email: dwarfer@sapo.pt
  • Discord: Dwarfer#2715

 

Link para o post
Compartilhar em outros sites
  • 4 weeks later...

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Estatísticas dos Fóruns

    96844
    Tópicos
    519599
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo