Ir para conteúdo

Featured Replies

Postado

alguem me ajudar a colocar esse script

Spoiler

local fromPos_, toPos_, kickPos = {x=1,y=1,z=1}, {x=1,y=1,z=1}, {x=1,y=1,z=1} -- canto superior esquerdo, inferior direito da área, posição ao ser kikado
local timeToKick = {5, "min"} -- tempo para ser kikado

-- adicione isso ao usar a alavanca
addEvent(kickFromArea, mathtime(timeToKick) * 1000, cid, fromPos_, toPos_, kickPos)

-- adicione as funções no final
function kickFromArea(cid, fromPos, toPos, kickPos)
    if isPlayer(cid) and isInRange(getPlayerPosition(cid), fromPos, toPos) then
        doTeleportThing(cid, kickPos)
        doSendMagicEffect(kickPos, CONST_ME_TELEPORT)
        doCreatureSay(cid, "Your time is over!", TALKTYPE_ORANGE_1)
    end
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   

dentro desse ?

Spoiler

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

    local room = {     -- boss room
        fromX = 379,
        fromY = 5509,
        fromZ = 7,
        --------------
        toX = 392,
        toY = 5520,
        toZ = 7
    }

    local monster_pos = {
        [1] = {pos = {385, 5514, 7}, monster = "Parasita"},
        [2] = {pos = {389, 5518, 7}, monster = "power hearth"},
        [3] = {pos = {382, 5518, 7}, monster = "power hearth"},
        [4] = {pos = {382, 5511, 7}, monster = "power hearth"},
        [5] = {pos = {389, 5511, 7}, monster = "power hearth"}
    }

    local players_pos = {
        {x = 391, y = 5530, z = 7, stackpos = 253},
        {x = 391, y = 5529, z = 7, stackpos = 253},
        {x = 391, y = 5528, z = 7, stackpos = 253},
        {x = 391, y = 5527, z = 7, stackpos = 253},
        {x = 391, y = 5526, z = 7, stackpos = 253}
    }

    local new_player_pos = {
        {x = 386, y = 5515, z = 7},
        {x = 386, y = 5514, z = 7},
        {x = 386, y = 5513, z = 7},
        {x = 386, y = 5512, z = 7},
        {x = 386, y = 5511, 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

 

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo