Ir para conteúdo
  • 0
thibalta

Scripting Kick player da sala do Boss

Pergunta

thibalta    0
thibalta

Antes de fazer a sua pergunta, tenha certeza de ter lido as regras da seção e o guia abaixo:

https://forums.otserv.com.br/index.php?/forums/topic/168583-regras-da-seção/

https://forums.otserv.com.br/index.php?/forums/topic/165121-como-fazer-uma-pergunta-ou-o-grande-guia-do-usuário-com-dúvidas/

Obs: não delete esse formulário pré-definido, preencha-o corretamente para postar o seu tópico!

Descreva em algumas palavras a base utilizada. (Nome do servidor / Nome do cliente / Nome do website / etc.).

Base:  

Servidor Utilizado:

 

Qual é a sua pergunta?

Boa tarde, preciso de um complemento para script para expulsar o player quando der 15 minutos. Os player ficam online travando  a sala.

 

Você tem o código disponível? Se tiver poste-o na caixa de código que está dentro do spoiler abaixo:

Spoiler

-- Codigo Atual

local config = {
    requiredLevel = 150,
    daily = false,
    roomCenterPosition = Position(33711, 31469, 14),
    playerPositions = {
        Position(33734, 31471, 14),
        Position(33735, 31471, 14),
        Position(33736, 31471, 14),
        Position(33737, 31471, 14),
        Position(33738, 31471, 14),
    },
    teleportPosition = Position(33706, 31473, 14),
    bossPosition = Position(33712, 31464, 14)
}

local leverboss = Action()

function leverboss.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 9825 then        
        -- Check if the player that pulled the lever is on the correct position
        if player:getPosition() ~= config.playerPositions[1] then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "You can\'t start the battle.")
            return true
        end
        
        local team, participant = {}

        for i = 1, #config.playerPositions do
            participant = Tile(config.playerPositions):getTopCreature()
            
            -- Check there is a participant player
            if participant and participant:isPlayer() then
                -- Check participant level
                if participant:getLevel() < config.requiredLevel then
                    player:sendTextMessage(MESSAGE_STATUS_SMALL,
                        "All the players need to be level ".. config.requiredLevel .." or higher.")
                    return true
                end

                -- Check participant boss timer
                if config.daily and participant:getStorageValue(Storage.Kilmaresh.OLDTheFearFeaster) > os.time() then
                    player:getPosition():sendMagicEffect(CONST_ME_POFF)
                    player:sendCancelMessage("Not all players are ready yet from last battle.")
                    return true
                end

                team[#team + 1] = participant
            end
        end

        -- Check if a team currently inside the boss room
        local specs, spec = Game.getSpectators(config.roomCenterPosition, false, false, 14, 14, 13, 13)
        for i = 1, #specs do
            spec = specs
            if spec:isPlayer() then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "A team is already inside the boss room.")
                return true
            end

            spec:remove()
        end

        -- Spawn boss
        Game.createMonster("The Fear Feaster", config.bossPosition)

        -- Teleport team participants
        for i = 1, #team do
            team:getPosition():sendMagicEffect(CONST_ME_POFF)
            team:teleportTo(config.teleportPosition)
            -- Assign boss timer
            team:setStorageValue(Storage.Kilmaresh.TheFearFeaster, os.time() + 20*60*60) -- 20 hours
        end
        
        config.teleportPosition:sendMagicEffect(CONST_ME_ENERGYAREA)
        addEvent(kickFromArea, mathtime(timeToKick) * 1000, cid, fromPos_, toPos_, kickPos)
    end

    item:transform(9825)
    return true
end


leverboss:uid(1364)
leverboss:register()
 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, anexe-a dentro do spoiler abaixo:

Spoiler

 

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

1 resposta a esta questão

Recommended Posts

Visitante
Este tópico está impedido de receber novos posts.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×