Ir para conteúdo

Featured Replies

Postado

alguém poderia me ajudar a editar esse script ?

depois de muita procura consegui um script de boss room, mas ele nao kika os jogadores da sala em um tempo X

alguem poderia me ajudar com isso ?

adicionar o removePlayersTime desse script:

Spoiler

-- Diiego Liima

local posInicio = {x = 1353, y = 908, z = 6} --pos inicio da sala
local posFim = {x = 1371, y = 921, z = 6}--pos final inicio da sala
local posExitTime = {x = 1358, y = 915, z = 7}-- pos para onde o player vai sair

local function verificaPlayers()
    for x = posInicio.x, posFim.x do
        for y = posInicio.y, posFim.y do
               if isPlayer(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then
                return 1
            end
        end
    end
end

local function verificaBoss()
    for x = posInicio.x, posFim.x  do
        for y = posInicio.y, posFim.y do
            if isMonster(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then
                doRemoveCreature(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid)
            end
        end
    end
end

local function removePlayersTime()
    for x = posInicio.x, posFim.x  do
        for y = posInicio.y, posFim.y do
            local remove, clean = true, true
            local pos = {x = x, y = y, z = posInicio.z}
            local m = getTopCreature(pos).uid
            if m ~= 0 and isPlayer(m) then
                doTeleportThing(m, posExitTime)
            end
        end
    end
    doSendMagicEffect(posExitTime, 10)
    return true
end

function onUse(cid, item, frompos, item2, topos)

    -- Lever Boss
    if item.aid == 2320 then -- action id da alavanca
        local playerChecked = false
        local teleportToRoom = false

        local stoExhaust = 5534241 -- staorage de segurança para exhaust
        local stoExhaustPlayer = getPlayerStorageValue(cid, stoExhaust)
        if stoExhaustPlayer > os.time() then
            doPlayerSendCancel(cid, "You have to wait " .. stoExhaustPlayer - os.time() .. " seconds to try again.")
            return true
        end
        if verificaPlayers() then
            doPlayerSendCancel(cid, "There are other players inside the room at the moment.")
            doSendMagicEffect(topos,2)
            setPlayerStorageValue(cid, stoExhaust, os.time()+5)
            return true
        end

        local config = {
            [1] = {pos = {x = 1356, y = 915, z = 7}}, --posições dos pisos
            [2] = {pos = {x = 1357, y = 915, z = 7}},
            [3] = {pos = {x = 1358, y = 915, z = 7}},
            [4] = {pos = {x = 1359, y = 915, z = 7}},
            [5] = {pos = {x = 1360, y = 915, z = 7}},
        }

        local storageTime = 5534240 -- storage de tempo
        

        for i, v in pairs(config) do
            if isPlayer(getTopCreature(config[i].pos).uid) then
                player = getTopCreature(config[i].pos).uid
                if getPlayerStorageValue(player, storageTime) > os.time() then
                    time = (getPlayerStorageValue(player, storageTime)-os.time())/60
                    str = "minutes"
                    if time > 60 then
                        time = time/60
                        str = "hours"
                        end
                    if player == cid then name = "You" else name = getCreatureName(player) end
                    doPlayerSendCancel(cid, name .. " need to wait more " .. math.floor(time+0.5) .. " " .. str .. " to do again.")
                    doSendMagicEffect(topos,2)
                    return true
                end
                if player == cid then
                    playerChecked = true
                end
            end
        end

        if playerChecked then
            for i, v in pairs(config) do
                if isPlayer(getTopCreature(config[i].pos).uid) then
                    player = getTopCreature(config[i].pos).uid
                    doSendMagicEffect(getCreaturePosition(player), 2)
                    doTeleportThing(player, {x = 1358, y = 917, z = 6}) -- posiçao que player vai cair dentro da sala
                    setPlayerStorageValue(player, storageTime, os.time()+72000) -- 20 horas
                    teleportToRoom = true
                end
            end

            if teleportToRoom then
                stopEvent(ResetArea)
                verificaBoss()
                doSendMagicEffect({x = 1357, y = 914, z = 6}, 10) -- efeito aonde o boss nasce
                doCreateMonster("Brother Freeze", {x = 1357, y = 914, z = 6}) -- onde o boss nasce
                ResetArea = addEvent(function()
                    removePlayersTime()
                end, 20 * 60 * 1000) -- tempo dentro da sala
                return false
            end
        else
            doPlayerSendCancel(cid, "Wouldn't you like to go too?")
            doSendMagicEffect(topos,2)
        end

        return true
    end

end

e colocar nesse :

Spoiler

-- CONFIG --
    local playersOnly = "no"
    local questLevel = 1
    local STORAGE_BOSS_CD = 22117
    local cdtime = 1 * 1 * 2 -- exhaust in seconds

    local room = {     -- boss room
        fromX = 4467,
        fromY = 8211,
        fromZ = 7,
        --------------
        toX = 4486,
        toY = 8230,
        toZ = 7
    }

    local monster_pos = {
        [1] = {pos = {4476, 8222, 7}, monster = "Flame Crystal"}
    }

    local players_pos = {
        {x = 4496, y = 8230, z = 7, stackpos = 253},
        {x = 4496, y = 8231, z = 7, stackpos = 253},
        {x = 4496, y = 8232, z = 7, stackpos = 253},
        {x = 4496, y = 8233, z = 7, stackpos = 253},
        {x = 4496, y = 8234, z = 7, stackpos = 253}
    }

    local new_player_pos = {
        {x = 4478, y = 8226, z = 7},
        {x = 4479, y = 8226, z = 7},
        {x = 4480, y = 8226, z = 7},
        {x = 4481, y = 8226, z = 7},
        {x = 4482, y = 8226, z = 7}
    }
-- CONFIG END --

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local all_ready, monsters, player, level = 0, 0, {}, 0

    if item.itemid == 9826 then
        for i = 1, #players_pos do
            table.insert(player, 0)
        end
        for i = 1, #players_pos do
            player[i] = getThingfromPos(players_pos[i])
            if player[i].itemid > 0 then
                if string.lower(playersOnly) == "yes" then
                    if isPlayer(player[i].uid) == true then
                        all_ready = all_ready+1
                    else
                        monsters = monsters+1
                    end
                else
                    all_ready = all_ready+1
                end
            end
        end
        if all_ready == #players_pos then
            for i = 1, #players_pos do
                player[i] = getThingfromPos(players_pos[i])
                if isPlayer(player[i].uid) == true then
                    if getPlayerStorageValue(player[i].uid,STORAGE_BOSS_CD) > os.time() then
                        doPlayerSendCancel(cid,"Acesso so liberado a cada 20h.")
                        return false
                    end
                    if getPlayerLevel(player[i].uid) >= questLevel then
                        level = level+1
                    end
                else
                    level = level+1
                end
            end
            if level == #players_pos then
                if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then
                    for _, area in pairs(monster_pos) do
                        doSummonCreature(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]})
                    end
                    for i = 1, #players_pos do
                        doSendMagicEffect(players_pos[i], CONST_ME_POFF)
                        doTeleportThing(player[i].uid, new_player_pos[i])
                        doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA)
                        setPlayerStorageValue(player[i].uid,STORAGE_BOSS_CD,os.time() + cdtime)
                    end
                    doTransformItem(item.uid,9825)
                else
                    doPlayerSendTextMessage(cid,19,"Only players can do this quest.")
                    return false
                end
            else
                doPlayerSendTextMessage(cid,19,"All Players have to be level "..questLevel.." to do this quest.")
                return false
            end
        else
            doPlayerSendCancel(cid,"You need "..table.getn(players_pos).." players to do this quest.")
            return false
        end
    elseif item.itemid == 9825 then
        local player_room = 0
        for x = room.fromX, room.toX do
            for y = room.fromY, room.toY do
                for z = room.fromZ, room.toZ do
                    local pos = {x=x, y=y, z=z,stackpos = 253}
                    local thing = getThingfromPos(pos)
                    if thing.itemid > 0 then
                        if isPlayer(thing.uid) == true then
                            player_room = player_room+1
                        end
                    end
                end
            end
        end
        if player_room >= 1 then
            doPlayerSendTextMessage(cid,19,"There is already a team in the quest room.")
            return false
        elseif player_room == 0 then
            for x = room.fromX, room.toX do
                for y = room.fromY, room.toY do
                    for z = room.fromZ, room.toZ do
                        local pos = {x=x, y=y, z=z,stackpos = 253}
                        local thing = getThingfromPos(pos)
                        if thing.itemid > 0 then
                            doRemoveCreature(thing.uid)
                        end
                    end
                end
            end
            doTransformItem(item.uid,9826)
        end
    end

    return true
end

FICAREI MUITO GRATO!

pois, ja tentei de varias formas e nao consegui.

  • Respostas 8
  • Visualizações 641
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

Postado
  • Autor
21 horas atrás, El Capitchi disse:

Não consegui entender o que você quer fazer , o player fica online e não sai por exemplo ele da exit e continua online?

bom dia amigo, muito grato pela atencao.

Se trata de um script de BOSSROOM tipo anihi, esse SEGUNDO escript nao remove os jogadores da sala do boss com um determinado tempo, ou seja, o jogador pode ficar la bloqueando a sala.

já nesse PRIMEIRO tem uma parte que remove o jogadores da sala em uma tempo X, eu queria que o SEGUNDO script fosse igual o PRIMEIRO contendo essa parte de remover os playes. e quando passasse 15 minutos dentro da sala todos os jogadores fosse kikados da sala do boss.

PRIMEIRO (está com um bug na parte de remover o boss e criar um novo quando puxa a alavanca mas o resto funciona)

Spoiler

-- Diiego Liima

local posInicio = {x = 1353, y = 908, z = 6} --pos inicio da sala
local posFim = {x = 1371, y = 921, z = 6}--pos final inicio da sala
local posExitTime = {x = 1358, y = 915, z = 7}-- pos para onde o player vai sair

local function verificaPlayers()
    for x = posInicio.x, posFim.x do
        for y = posInicio.y, posFim.y do
               if isPlayer(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then
                return 1
            end
        end
    end
end

local function verificaBoss()
    for x = posInicio.x, posFim.x  do
        for y = posInicio.y, posFim.y do
            if isMonster(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then
                doRemoveCreature(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid)
            end
        end
    end
end

local function removePlayersTime()
    for x = posInicio.x, posFim.x  do
        for y = posInicio.y, posFim.y do
            local remove, clean = true, true
            local pos = {x = x, y = y, z = posInicio.z}
            local m = getTopCreature(pos).uid
            if m ~= 0 and isPlayer(m) then
                doTeleportThing(m, posExitTime)
            end
        end
    end
    doSendMagicEffect(posExitTime, 10)
    return true
end

function onUse(cid, item, frompos, item2, topos)

    -- Lever Boss
    if item.aid == 2320 then -- action id da alavanca
        local playerChecked = false
        local teleportToRoom = false

        local stoExhaust = 5534241 -- staorage de segurança para exhaust
        local stoExhaustPlayer = getPlayerStorageValue(cid, stoExhaust)
        if stoExhaustPlayer > os.time() then
            doPlayerSendCancel(cid, "You have to wait " .. stoExhaustPlayer - os.time() .. " seconds to try again.")
            return true
        end
        if verificaPlayers() then
            doPlayerSendCancel(cid, "There are other players inside the room at the moment.")
            doSendMagicEffect(topos,2)
            setPlayerStorageValue(cid, stoExhaust, os.time()+5)
            return true
        end

        local config = {
            [1] = {pos = {x = 1356, y = 915, z = 7}}, --posições dos pisos
            [2] = {pos = {x = 1357, y = 915, z = 7}},
            [3] = {pos = {x = 1358, y = 915, z = 7}},
            [4] = {pos = {x = 1359, y = 915, z = 7}},
            [5] = {pos = {x = 1360, y = 915, z = 7}},
        }

        local storageTime = 5534240 -- storage de tempo
        

        for i, v in pairs(config) do
            if isPlayer(getTopCreature(config[i].pos).uid) then
                player = getTopCreature(config[i].pos).uid
                if getPlayerStorageValue(player, storageTime) > os.time() then
                    time = (getPlayerStorageValue(player, storageTime)-os.time())/60
                    str = "minutes"
                    if time > 60 then
                        time = time/60
                        str = "hours"
                        end
                    if player == cid then name = "You" else name = getCreatureName(player) end
                    doPlayerSendCancel(cid, name .. " need to wait more " .. math.floor(time+0.5) .. " " .. str .. " to do again.")
                    doSendMagicEffect(topos,2)
                    return true
                end
                if player == cid then
                    playerChecked = true
                end
            end
        end

        if playerChecked then
            for i, v in pairs(config) do
                if isPlayer(getTopCreature(config[i].pos).uid) then
                    player = getTopCreature(config[i].pos).uid
                    doSendMagicEffect(getCreaturePosition(player), 2)
                    doTeleportThing(player, {x = 1358, y = 917, z = 6}) -- posiçao que player vai cair dentro da sala
                    setPlayerStorageValue(player, storageTime, os.time()+72000) -- 20 horas
                    teleportToRoom = true
                end
            end

            if teleportToRoom then
                stopEvent(ResetArea)
                verificaBoss()
                doSendMagicEffect({x = 1357, y = 914, z = 6}, 10) -- efeito aonde o boss nasce
                doCreateMonster("Brother Freeze", {x = 1357, y = 914, z = 6}) -- onde o boss nasce
                ResetArea = addEvent(function()
                    removePlayersTime()
                end, 20 * 60 * 1000) -- tempo dentro da sala
                return false
            end
        else
            doPlayerSendCancel(cid, "Wouldn't you like to go too?")
            doSendMagicEffect(topos,2)
        end

        return true
    end

end

SEGUNDO

Spoiler

-- CONFIG --
    local playersOnly = "no"
    local questLevel = 1
    local STORAGE_BOSS_CD = 22117
    local cdtime = 1 * 1 * 2 -- exhaust in seconds

    local room = {     -- boss room
        fromX = 4467,
        fromY = 8211,
        fromZ = 7,
        --------------
        toX = 4486,
        toY = 8230,
        toZ = 7
    }

    local monster_pos = {
        [1] = {pos = {4476, 8222, 7}, monster = "Flame Crystal"}
    }

    local players_pos = {
        {x = 4496, y = 8230, z = 7, stackpos = 253},
        {x = 4496, y = 8231, z = 7, stackpos = 253},
        {x = 4496, y = 8232, z = 7, stackpos = 253},
        {x = 4496, y = 8233, z = 7, stackpos = 253},
        {x = 4496, y = 8234, z = 7, stackpos = 253}
    }

    local new_player_pos = {
        {x = 4478, y = 8226, z = 7},
        {x = 4479, y = 8226, z = 7},
        {x = 4480, y = 8226, z = 7},
        {x = 4481, y = 8226, z = 7},
        {x = 4482, y = 8226, z = 7}
    }
-- CONFIG END --

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local all_ready, monsters, player, level = 0, 0, {}, 0

    if item.itemid == 9826 then
        for i = 1, #players_pos do
            table.insert(player, 0)
        end
        for i = 1, #players_pos do
            player[i] = getThingfromPos(players_pos[i])
            if player[i].itemid > 0 then
                if string.lower(playersOnly) == "yes" then
                    if isPlayer(player[i].uid) == true then
                        all_ready = all_ready+1
                    else
                        monsters = monsters+1
                    end
                else
                    all_ready = all_ready+1
                end
            end
        end
        if all_ready == #players_pos then
            for i = 1, #players_pos do
                player[i] = getThingfromPos(players_pos[i])
                if isPlayer(player[i].uid) == true then
                    if getPlayerStorageValue(player[i].uid,STORAGE_BOSS_CD) > os.time() then
                        doPlayerSendCancel(cid,"Acesso so liberado a cada 20h.")
                        return false
                    end
                    if getPlayerLevel(player[i].uid) >= questLevel then
                        level = level+1
                    end
                else
                    level = level+1
                end
            end
            if level == #players_pos then
                if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then
                    for _, area in pairs(monster_pos) do
                        doSummonCreature(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]})
                    end
                    for i = 1, #players_pos do
                        doSendMagicEffect(players_pos[i], CONST_ME_POFF)
                        doTeleportThing(player[i].uid, new_player_pos[i])
                        doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA)
                        setPlayerStorageValue(player[i].uid,STORAGE_BOSS_CD,os.time() + cdtime)
                    end
                    doTransformItem(item.uid,9825)
                else
                    doPlayerSendTextMessage(cid,19,"Only players can do this quest.")
                    return false
                end
            else
                doPlayerSendTextMessage(cid,19,"All Players have to be level "..questLevel.." to do this quest.")
                return false
            end
        else
            doPlayerSendCancel(cid,"You need "..table.getn(players_pos).." players to do this quest.")
            return false
        end
    elseif item.itemid == 9825 then
        local player_room = 0
        for x = room.fromX, room.toX do
            for y = room.fromY, room.toY do
                for z = room.fromZ, room.toZ do
                    local pos = {x=x, y=y, z=z,stackpos = 253}
                    local thing = getThingfromPos(pos)
                    if thing.itemid > 0 then
                        if isPlayer(thing.uid) == true then
                            player_room = player_room+1
                        end
                    end
                end
            end
        end
        if player_room >= 1 then
            doPlayerSendTextMessage(cid,19,"There is already a team in the quest room.")
            return false
        elseif player_room == 0 then
            for x = room.fromX, room.toX do
                for y = room.fromY, room.toY do
                    for z = room.fromZ, room.toZ do
                        local pos = {x=x, y=y, z=z,stackpos = 253}
                        local thing = getThingfromPos(pos)
                        if thing.itemid > 0 then
                            doRemoveCreature(thing.uid)
                        end
                    end
                end
            end
            doTransformItem(item.uid,9826)
        end
    end

    return true
end

 

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

  • 2 weeks later...
Postado
Em 19/10/2022 em 09:27, Carlinhous1996 disse:

bom dia amigo, muito grato pela atencao.

Se trata de um script de BOSSROOM tipo anihi, esse SEGUNDO escript nao remove os jogadores da sala do boss com um determinado tempo, ou seja, o jogador pode ficar la bloqueando a sala.

já nesse PRIMEIRO tem uma parte que remove o jogadores da sala em uma tempo X, eu queria que o SEGUNDO script fosse igual o PRIMEIRO contendo essa parte de remover os playes. e quando passasse 15 minutos dentro da sala todos os jogadores fosse kikados da sala do boss.

PRIMEIRO (está com um bug na parte de remover o boss e criar um novo quando puxa a alavanca mas o resto funciona)

  Mostrar conteúdo oculto

-- Diiego Liima

local posInicio = {x = 1353, y = 908, z = 6} --pos inicio da sala
local posFim = {x = 1371, y = 921, z = 6}--pos final inicio da sala
local posExitTime = {x = 1358, y = 915, z = 7}-- pos para onde o player vai sair

local function verificaPlayers()
    for x = posInicio.x, posFim.x do
        for y = posInicio.y, posFim.y do
               if isPlayer(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then
                return 1
            end
        end
    end
end

local function verificaBoss()
    for x = posInicio.x, posFim.x  do
        for y = posInicio.y, posFim.y do
            if isMonster(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then
                doRemoveCreature(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid)
            end
        end
    end
end

local function removePlayersTime()
    for x = posInicio.x, posFim.x  do
        for y = posInicio.y, posFim.y do
            local remove, clean = true, true
            local pos = {x = x, y = y, z = posInicio.z}
            local m = getTopCreature(pos).uid
            if m ~= 0 and isPlayer(m) then
                doTeleportThing(m, posExitTime)
            end
        end
    end
    doSendMagicEffect(posExitTime, 10)
    return true
end

function onUse(cid, item, frompos, item2, topos)

    -- Lever Boss
    if item.aid == 2320 then -- action id da alavanca
        local playerChecked = false
        local teleportToRoom = false

        local stoExhaust = 5534241 -- staorage de segurança para exhaust
        local stoExhaustPlayer = getPlayerStorageValue(cid, stoExhaust)
        if stoExhaustPlayer > os.time() then
            doPlayerSendCancel(cid, "You have to wait " .. stoExhaustPlayer - os.time() .. " seconds to try again.")
            return true
        end
        if verificaPlayers() then
            doPlayerSendCancel(cid, "There are other players inside the room at the moment.")
            doSendMagicEffect(topos,2)
            setPlayerStorageValue(cid, stoExhaust, os.time()+5)
            return true
        end

        local config = {
            [1] = {pos = {x = 1356, y = 915, z = 7}}, --posições dos pisos
            [2] = {pos = {x = 1357, y = 915, z = 7}},
            [3] = {pos = {x = 1358, y = 915, z = 7}},
            [4] = {pos = {x = 1359, y = 915, z = 7}},
            [5] = {pos = {x = 1360, y = 915, z = 7}},
        }

        local storageTime = 5534240 -- storage de tempo
        

        for i, v in pairs(config) do
            if isPlayer(getTopCreature(config[i].pos).uid) then
                player = getTopCreature(config[i].pos).uid
                if getPlayerStorageValue(player, storageTime) > os.time() then
                    time = (getPlayerStorageValue(player, storageTime)-os.time())/60
                    str = "minutes"
                    if time > 60 then
                        time = time/60
                        str = "hours"
                        end
                    if player == cid then name = "You" else name = getCreatureName(player) end
                    doPlayerSendCancel(cid, name .. " need to wait more " .. math.floor(time+0.5) .. " " .. str .. " to do again.")
                    doSendMagicEffect(topos,2)
                    return true
                end
                if player == cid then
                    playerChecked = true
                end
            end
        end

        if playerChecked then
            for i, v in pairs(config) do
                if isPlayer(getTopCreature(config[i].pos).uid) then
                    player = getTopCreature(config[i].pos).uid
                    doSendMagicEffect(getCreaturePosition(player), 2)
                    doTeleportThing(player, {x = 1358, y = 917, z = 6}) -- posiçao que player vai cair dentro da sala
                    setPlayerStorageValue(player, storageTime, os.time()+72000) -- 20 horas
                    teleportToRoom = true
                end
            end

            if teleportToRoom then
                stopEvent(ResetArea)
                verificaBoss()
                doSendMagicEffect({x = 1357, y = 914, z = 6}, 10) -- efeito aonde o boss nasce
                doCreateMonster("Brother Freeze", {x = 1357, y = 914, z = 6}) -- onde o boss nasce
                ResetArea = addEvent(function()
                    removePlayersTime()
                end, 20 * 60 * 1000) -- tempo dentro da sala
                return false
            end
        else
            doPlayerSendCancel(cid, "Wouldn't you like to go too?")
            doSendMagicEffect(topos,2)
        end

        return true
    end

end

SEGUNDO

  Mostrar conteúdo oculto

-- CONFIG --
    local playersOnly = "no"
    local questLevel = 1
    local STORAGE_BOSS_CD = 22117
    local cdtime = 1 * 1 * 2 -- exhaust in seconds

    local room = {     -- boss room
        fromX = 4467,
        fromY = 8211,
        fromZ = 7,
        --------------
        toX = 4486,
        toY = 8230,
        toZ = 7
    }

    local monster_pos = {
        [1] = {pos = {4476, 8222, 7}, monster = "Flame Crystal"}
    }

    local players_pos = {
        {x = 4496, y = 8230, z = 7, stackpos = 253},
        {x = 4496, y = 8231, z = 7, stackpos = 253},
        {x = 4496, y = 8232, z = 7, stackpos = 253},
        {x = 4496, y = 8233, z = 7, stackpos = 253},
        {x = 4496, y = 8234, z = 7, stackpos = 253}
    }

    local new_player_pos = {
        {x = 4478, y = 8226, z = 7},
        {x = 4479, y = 8226, z = 7},
        {x = 4480, y = 8226, z = 7},
        {x = 4481, y = 8226, z = 7},
        {x = 4482, y = 8226, z = 7}
    }
-- CONFIG END --

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local all_ready, monsters, player, level = 0, 0, {}, 0

    if item.itemid == 9826 then
        for i = 1, #players_pos do
            table.insert(player, 0)
        end
        for i = 1, #players_pos do
            player[i] = getThingfromPos(players_pos[i])
            if player[i].itemid > 0 then
                if string.lower(playersOnly) == "yes" then
                    if isPlayer(player[i].uid) == true then
                        all_ready = all_ready+1
                    else
                        monsters = monsters+1
                    end
                else
                    all_ready = all_ready+1
                end
            end
        end
        if all_ready == #players_pos then
            for i = 1, #players_pos do
                player[i] = getThingfromPos(players_pos[i])
                if isPlayer(player[i].uid) == true then
                    if getPlayerStorageValue(player[i].uid,STORAGE_BOSS_CD) > os.time() then
                        doPlayerSendCancel(cid,"Acesso so liberado a cada 20h.")
                        return false
                    end
                    if getPlayerLevel(player[i].uid) >= questLevel then
                        level = level+1
                    end
                else
                    level = level+1
                end
            end
            if level == #players_pos then
                if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then
                    for _, area in pairs(monster_pos) do
                        doSummonCreature(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]})
                    end
                    for i = 1, #players_pos do
                        doSendMagicEffect(players_pos[i], CONST_ME_POFF)
                        doTeleportThing(player[i].uid, new_player_pos[i])
                        doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA)
                        setPlayerStorageValue(player[i].uid,STORAGE_BOSS_CD,os.time() + cdtime)
                    end
                    doTransformItem(item.uid,9825)
                else
                    doPlayerSendTextMessage(cid,19,"Only players can do this quest.")
                    return false
                end
            else
                doPlayerSendTextMessage(cid,19,"All Players have to be level "..questLevel.." to do this quest.")
                return false
            end
        else
            doPlayerSendCancel(cid,"You need "..table.getn(players_pos).." players to do this quest.")
            return false
        end
    elseif item.itemid == 9825 then
        local player_room = 0
        for x = room.fromX, room.toX do
            for y = room.fromY, room.toY do
                for z = room.fromZ, room.toZ do
                    local pos = {x=x, y=y, z=z,stackpos = 253}
                    local thing = getThingfromPos(pos)
                    if thing.itemid > 0 then
                        if isPlayer(thing.uid) == true then
                            player_room = player_room+1
                        end
                    end
                end
            end
        end
        if player_room >= 1 then
            doPlayerSendTextMessage(cid,19,"There is already a team in the quest room.")
            return false
        elseif player_room == 0 then
            for x = room.fromX, room.toX do
                for y = room.fromY, room.toY do
                    for z = room.fromZ, room.toZ do
                        local pos = {x=x, y=y, z=z,stackpos = 253}
                        local thing = getThingfromPos(pos)
                        if thing.itemid > 0 then
                            doRemoveCreature(thing.uid)
                        end
                    end
                end
            end
            doTransformItem(item.uid,9826)
        end
    end

    return true
end

 

Leia com Atenção eu Adicionei um Sistema de Boss Room ! so vc utilizar

 

 

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.6k

Informação Importante

Confirmação de Termo