Ir para conteúdo

Featured Replies

Postado

Alguem poderia converter esse script que esta em dias para horas pf ?

desde de ja, grato ! 

 

Citar

local config = {
    daily = "no", -- allow only one enter per day? (like in global Tibia)
    level = 100,
    storage = 30015,
    entry =
    {
        {x = 247, y = 659, z = 13},
        {x = 247, y = 660, z = 13},
        {x = 247, y = 661, z = 13},
        {x = 247, y = 662, z = 13}
    },
    destination =
    {
        {x = 189, y = 650, z = 13},
        {x = 189, y = 651, z = 13},
        {x = 189, y = 652, z = 13},
        {x = 189, y = 653, z = 13}
    }
}

config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 1946) then
        if(config.daily) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        else
            doTransformItem(item.uid, item.itemid - 1)
        end

        return true
    end

    if(item.itemid ~= 1945) then
        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) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
            return true
        end

        table.insert(players, pid)
    end

    for i, pid in ipairs(players) do
        doSendMagicEffect(config.entry[i], CONST_ME_POFF)
        doTeleportThing(pid, config.destination[i], false)
        doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
    end

    doTransformItem(item.uid, item.itemid + 1)
    return true
end
 

 

  • 4 weeks later...
Postado

é isso que precisa?

local config = {
    hourly = "no", -- permitir apenas uma entrada por hora?
    level = 100,
    storage = 30015,
    entry =
    {
        {x = 247, y = 659, z = 13},
        {x = 247, y = 660, z = 13},
        {x = 247, y = 661, z = 13},
        {x = 247, y = 662, z = 13}
    },
    destination =
    {
        {x = 189, y = 650, z = 13},
        {x = 189, y = 651, z = 13},
        {x = 189, y = 652, z = 13},
        {x = 189, y = 653, z = 13}
    }
}

config.hourly = getBooleanFromString(config.hourly)

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if (item.itemid == 1946) then
        if (config.hourly) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        else
            doTransformItem(item.uid, item.itemid - 1)
        end

        return true
    end

    if (item.itemid ~= 1945) then
        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) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
            return true
        end

        table.insert(players, pid)
    end

    for i, pid in ipairs(players) do
        doSendMagicEffect(config.entry[i], CONST_ME_POFF)
        doTeleportThing(pid, config.destination[i], false)
        doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
    end

    doTransformItem(item.uid, item.itemid + 1)
    return true
end

 

Postado

A cada 1 hora

 

local config = {
    hourly = "yes", -- allow only one enter per hour?
    level = 100,
    storage = 30015,
    entry =
    {
        {x = 247, y = 659, z = 13},
        {x = 247, y = 660, z = 13},
        {x = 247, y = 661, z = 13},
        {x = 247, y = 662, z = 13}
    },
    destination =
    {
        {x = 189, y = 650, z = 13},
        {x = 189, y = 651, z = 13},
        {x = 189, y = 652, z = 13},
        {x = 189, y = 653, z = 13}
    }
}

config.hourly = getBooleanFromString(config.hourly)
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 1946) then
        if(config.hourly) then
            local lastEnter = getPlayerStorageValue(cid, config.storage)
            if lastEnter ~= -1 and os.time() - lastEnter < 3600 then -- 3600 seconds = 1 hour
                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You can only enter once per hour.")
                return true
            else
                setPlayerStorageValue(cid, config.storage, os.time())
            end
        end
        doTransformItem(item.uid, item.itemid - 1)
        return true
    end

    if(item.itemid ~= 1945) then
        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) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
            return true
        end

        table.insert(players, pid)
    end

    for i, pid in ipairs(players) do
        doSendMagicEffect(config.entry[i], CONST_ME_POFF)
        doTeleportThing(pid, config.destination[i], false)
        doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
    end

    doTransformItem(item.uid, item.itemid + 1)
    return true
end
 

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuiçã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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 520.2k

Informação Importante

Confirmação de Termo