Ir para conteúdo

Featured Replies

Postado

.Qual servidor ou website você utiliza como base?. OtservBr Tsf: 1.3x

 

Qual o motivo deste tópico?

Como interpretar o codigo destacado em anexo, e como eu coloco para entrar menos de 5 player (tipo 1 ou 2...)

 

Está surgindo algum erro? Se sim coloque-o aqui. 

Citar

 

 

Você tem o código disponível? Se tiver publique-o aqui: 

local setting = {
    timeToFightAgain = 20,
    clearRoomTime = 60, -- In hour
    centerRoom = {x = 33364, y = 31318, z = 9},
    range = 10,
    storage = Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer,
    clearRoomStorage = GlobalStorage.OberonEventTime,
    bossName = "grand master oberon",
    bossPosition = {x = 33364, y = 31317, z = 9}
}

local playerPositions = {
    {fromPos = {x = 33364, y = 31344, z = 9}, toPos = {x = 33364, y = 31321, z = 9}},
    {fromPos = {x = 33363, y = 31344, z = 9}, toPos = {x = 33363, y = 31321, z = 9}},
    {fromPos = {x = 33365, y = 31344, z = 9}, toPos = {x = 33365, y = 31321, z = 9}},
    {fromPos = {x = 33362, y = 31344, z = 9}, toPos = {x = 33362, y = 31321, z = 9}},
    {fromPos = {x = 33366, y = 31344, z = 9}, toPos = {x = 33366, y = 31321, z = 9}}
}

-- Start Script
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 1945 and item.actionid == 57605 then
        for i = 1, #playerPositions do
            local creature = Tile(playerPositions.fromPos):getTopCreature()
            if not creature then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need 5 players to fight with this boss.")
                return true
            end
        end

        if roomIsOccupied(setting.centerRoom, setting.range, setting.range)
                    or Game.getStorageValue(setting.clearRoomStorage) == 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting against the boss! You need wait awhile.")
            return true
        end

        for i = 1, #playerPositions do
            local creature = Tile(playerPositions.fromPos):getTopCreature()
            if creature and creature:isPlayer() then
                if not creature:getStorageValue(setting.storage) >= os.time() then
                    creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have faced this boss in the last " .. setting.timeToFightAgain .. " hours.")
                    return true
                end
                if creature:getStorageValue(setting.storage) < os.time() then
                    creature:setStorageValue(setting.storage, os.time() + setting.timeToFightAgain * 60 * 60)
                    creature:teleportTo(playerPositions.toPos)
                    creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
                end
            else
                return false
            end
        end
        -- One hour for clean the room and other time goto again
        addEvent(clearRoom, setting.clearRoomTime * 60 * 1000, setting.centerRoom,
                    setting.range, setting.range, setting.clearRoomStorage)
        Game.createMonster(setting.bossName, setting.bossPosition)
        Game.setStorageValue(setting.clearRoomStorage, 1)
    end
    return true
end

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

 

codigo.png

Editado por lipyxxx (veja o histórico de edições)

  • Respostas 5
  • Visualizações 1.6k
  • Created
  • Última resposta

Top Posters In This Topic

Posted Images

Postado

@lipyxxx,

Não entendi direito o problema, você quer que o limite seja fixo a menos jogadores?
Ou você não quer que tenha um limite de jogadores, mas sim um número máximo? Podendo funcionar com um, dois, três ou quatro... (No máximo cinco, por exemplo) 

Postado
  • Autor
11 minutos atrás, Jazz disse:

@lipyxxx,

Não entendi direito o problema, você quer que o limite seja fixo a menos jogadores?
Ou você não quer que tenha um limite de jogadores, mas sim um número máximo? Podendo funcionar com um, dois, três ou quatro... (No máximo cinco, por exemplo) 

isso quero que com menos jogadores seja possivel acessar a sala do boss, podendo funcionar ate 5 player, o codigo apresentada só libera acesso a sala apenas quando entra com 5 player, quero que seja possivel entrar 1 ou 2 ou3 ate 5

 

Postado

@lipyxxx,
 

local setting = {
    timeToFightAgain = 20,
    clearRoomTime = 60, -- In hour
    centerRoom = {x = 33364, y = 31318, z = 9},
    range = 10,
    storage = Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer,
    clearRoomStorage = GlobalStorage.OberonEventTime,
    bossName = "grand master oberon",
    bossPosition = {x = 33364, y = 31317, z = 9}
}

local playerPositions = {
    {fromPos = {x = 33364, y = 31344, z = 9}, toPos = {x = 33364, y = 31321, z = 9}},
    {fromPos = {x = 33363, y = 31344, z = 9}, toPos = {x = 33363, y = 31321, z = 9}},
    {fromPos = {x = 33365, y = 31344, z = 9}, toPos = {x = 33365, y = 31321, z = 9}},
    {fromPos = {x = 33362, y = 31344, z = 9}, toPos = {x = 33362, y = 31321, z = 9}},
    {fromPos = {x = 33366, y = 31344, z = 9}, toPos = {x = 33366, y = 31321, z = 9}}
}

-- Start Script
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 1945 and item.actionid == 57605 then
        if roomIsOccupied(setting.centerRoom, setting.range, setting.range)
                    or Game.getStorageValue(setting.clearRoomStorage) == 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting against the boss! You need wait awhile.")
            return true
        end

        for i = 1, #playerPositions do
            local creature = Tile(playerPositions.fromPos):getTopCreature()
            if creature:isPlayer() then
                if not creature:getStorageValue(setting.storage) >= os.time() then
                    creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have faced this boss in the last " .. setting.timeToFightAgain .. " hours.")
                    return true
                end
                if creature:getStorageValue(setting.storage) < os.time() then
                    creature:setStorageValue(setting.storage, os.time() + setting.timeToFightAgain * 60 * 60)
                    creature:teleportTo(playerPositions.toPos)
                    creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
                end
            else
                return false
            end
        end
        -- One hour for clean the room and other time goto again
        addEvent(clearRoom, setting.clearRoomTime * 60 * 1000, setting.centerRoom,
                    setting.range, setting.range, setting.clearRoomStorage)
        Game.createMonster(setting.bossName, setting.bossPosition)
        Game.setStorageValue(setting.clearRoomStorage, 1)
    end
    return true
end


Tenta assim, se não funcionar me avisa
 

Postado
  • Autor
20 horas atrás, Jazz disse:

@lipyxxx,
 


local setting = {
    timeToFightAgain = 20,
    clearRoomTime = 60, -- In hour
    centerRoom = {x = 33364, y = 31318, z = 9},
    range = 10,
    storage = Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer,
    clearRoomStorage = GlobalStorage.OberonEventTime,
    bossName = "grand master oberon",
    bossPosition = {x = 33364, y = 31317, z = 9}
}

local playerPositions = {
    {fromPos = {x = 33364, y = 31344, z = 9}, toPos = {x = 33364, y = 31321, z = 9}},
    {fromPos = {x = 33363, y = 31344, z = 9}, toPos = {x = 33363, y = 31321, z = 9}},
    {fromPos = {x = 33365, y = 31344, z = 9}, toPos = {x = 33365, y = 31321, z = 9}},
    {fromPos = {x = 33362, y = 31344, z = 9}, toPos = {x = 33362, y = 31321, z = 9}},
    {fromPos = {x = 33366, y = 31344, z = 9}, toPos = {x = 33366, y = 31321, z = 9}}
}

-- Start Script
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 1945 and item.actionid == 57605 then
        if roomIsOccupied(setting.centerRoom, setting.range, setting.range)
                    or Game.getStorageValue(setting.clearRoomStorage) == 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting against the boss! You need wait awhile.")
            return true
        end

        for i = 1, #playerPositions do
            local creature = Tile(playerPositions.fromPos):getTopCreature()
            if creature:isPlayer() then
                if not creature:getStorageValue(setting.storage) >= os.time() then
                    creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have faced this boss in the last " .. setting.timeToFightAgain .. " hours.")
                    return true
                end
                if creature:getStorageValue(setting.storage) < os.time() then
                    creature:setStorageValue(setting.storage, os.time() + setting.timeToFightAgain * 60 * 60)
                    creature:teleportTo(playerPositions.toPos)
                    creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
                end
            else
                return false
            end
        end
        -- One hour for clean the room and other time goto again
        addEvent(clearRoom, setting.clearRoomTime * 60 * 1000, setting.centerRoom,
                    setting.range, setting.range, setting.clearRoomStorage)
        Game.createMonster(setting.bossName, setting.bossPosition)
        Game.setStorageValue(setting.clearRoomStorage, 1)
    end
    return true
end


Tenta assim, se não funcionar me avisa
 

brow nao funcionou, peguei o script do serv do malucoo e funcionou, vlws pela atenção

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.9k

Informação Importante

Confirmação de Termo