Ir para conteúdo

Featured Replies

Postado

Tá errado aí

 topLeftPos = {x = 1736, y = 1855, z = 8},

É a posição do canto superior esquerdo da sala, perto do pilar lá

 

bottomRightPos = {x = 1736, y = 1855, z = 8}

 

É a posição do canto inferior direito da sala, perto do ultimo pilar.

 

bQRE1de.png

 

 

E usa esse aqui, configura ali o monstro e tals

 

Spoiler

 local config = {
    money = 1000,
    daily = "no",
    level = 5,
    storage = 30015,
    areas = {
        [1] = {
            topLeftPos = {x = 1736, y = 1855, z = 8},
            bottomRightPos = {x = 1736, y = 1855, z = 8},
        },
        [2] = {
            topLeftPos = {x = 1736, y = 1855, z = 8},
            bottomRightPos = {x = 1736, y = 1855, z = 8},
        },
    },
    entry = {
        {x = 1085, y = 1145, z = 6},
    },
    destination = {
        {x = 1082, y = 11144, z = 6},
    }
}

local posmonstro = {x = 1083. y = 11144, z = 6}
local monstro = "Nome"
 
config.daily = getBooleanFromString(config.daily)

local function CheckAnihilationInUse()
    for i = 1, #config.areas do
        for x = config.areas.topLeftPos.x, config.areas.bottomRightPos.x do
            for y = config.areas.topLeftPos.y, config.areas.bottomRightPos.y do
                for z = config.areas.topLeftPos.z, config.areas.bottomRightPos.z do
                    local creature = getTopCreature({x = x, y = y, z = z}).uid
                    if isPlayer(creature) then
                        return true
                    end
                end
            end
        end
    end
    return false
end

local function RemoveMonsters()
    local monsters = {}
    for i = 1, #config.areas do
        for x = config.areas.topLeftPos.x, config.areas.bottomRightPos.x do
            for y = config.areas.topLeftPos.y, config.areas.bottomRightPos.y do
                for z = config.areas.topLeftPos.z, config.areas.bottomRightPos.z do
                    local position = {x = x, y = y, z = z, stackpos = 253}
                    local creature = getThingfromPos(position)
                    if isMonster(creature.uid) then
                        table.insert(monsters, creature.uid)
                    end
                end
            end
        end
    end
    for m in pairs(monsters) do
        doRemoveCreature(m)
    end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 6265) then
        if(config.daily) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        else
            doTransformItem(item.uid, item.itemid - 1)
        end
        return true
    end
     
    if(item.itemid ~= 6265) then
        return true
    end
    
    if CheckAnihilationInUse() then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "A arena esta em uso, espere.")
        return true
    end
    
    local players = {}
    for _, position in ipairs(config.entry) do
        local pid = getTopCreature(position).uid
        if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level or getPlayerMoney(cid) < config.money) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "No minimo players de level ".. config.level .." e possuir ".. config.money .." gold coins.")
            return true
        end
        table.insert(players, pid)
    end
    RemoveMonsters()
    doCreateMonster(monstro, posmonstro)
    doSendMagicEffect(config.entry, CONST_ME_POFF)
    doTeleportThing(cid, config.destination, false)
    doSendMagicEffect(config.destination, CONST_ME_ENERGYAREA)        
    
    doTransformItem(item.uid, item.itemid + 1)
    return true
end 

 

 

 

 

 

 

 

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

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

  • Respostas 17
  • Visualizações 722
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Como assim não precisa estar na mão? Você colocou no tópico que "o Player clicka na porta com o XXX Item na mão", da próxima vez tente deixar seu pedido bem detalhado. Fiz a alteração para verificar s

Posted Images

Postado
Spoiler


 local config = {
    money = 1000,
    daily = "no",
    level = 5,
    storage = 30015,
    areas = {
        [1] = {
            topLeftPos = {x = 1736, y = 1855, z = 8},
            bottomRightPos = {x = 1736, y = 1855, z = 8},
        },
        [2] = {
            topLeftPos = {x = 1736, y = 1855, z = 8},
            bottomRightPos = {x = 1736, y = 1855, z = 8},
        },
    },
    entry = {
        {x = 1085, y = 1145, z = 6},
    },
    destination = {
        {x = 1082, y = 11144, z = 6},
    }
}

local posmonstro = {x = 1083. y = 11144, z = 6}
local monstro = "Nome"
 
config.daily = getBooleanFromString(config.daily)

local function CheckAnihilationInUse()
    for i = 1, #config.areas do
        for x = config.areas.topLeftPos.x, config.areas.bottomRightPos.x do
            for y = config.areas.topLeftPos.y, config.areas.bottomRightPos.y do
                for z = config.areas.topLeftPos.z, config.areas.bottomRightPos.z do
                    local creature = getTopCreature({x = x, y = y, z = z}).uid
                    if isPlayer(creature) then
                        return true
                    end
                end
            end
        end
    end
    return false
end

local function RemoveMonsters()
    local monsters = {}
    for i = 1, #config.areas do
        for x = config.areas.topLeftPos.x, config.areas.bottomRightPos.x do
            for y = config.areas.topLeftPos.y, config.areas.bottomRightPos.y do
                for z = config.areas.topLeftPos.z, config.areas.bottomRightPos.z do
                    local position = {x = x, y = y, z = z, stackpos = 253}
                    local creature = getThingfromPos(position)
                    if isMonster(creature.uid) then
                        table.insert(monsters, creature.uid)
                    end
                end
            end
        end
    end
    for m in pairs(monsters) do
        doRemoveCreature(m)
    end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 6265) then
        if(config.daily) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
      return true
        else
            doTransformItem(item.uid, item.itemid - 1)
        end        
    end
     
    if(item.itemid ~= 6265) then
        return true
    end
    
    if CheckAnihilationInUse() then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "A arena esta em uso, espere.")
        return true
    end
    
    local players = {}
    for _, position in ipairs(config.entry) do
        local pid = getTopCreature(position).uid
        if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level or getPlayerMoney(cid) < config.money) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "No minimo players de level ".. config.level .." e possuir ".. config.money .." gold coins.")
            return true
        end
        table.insert(players, pid)
    end
    RemoveMonsters()
    doCreateMonster(monstro, posmonstro)
    doSendMagicEffect(config.entry, CONST_ME_POFF)
    doTeleportThing(cid, config.destination, false)
    doSendMagicEffect(config.destination, CONST_ME_ENERGYAREA)        
    
    doTransformItem(item.uid, item.itemid + 1)
    return true
end 

soh mudei uma linha de lugar

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

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