Ir para conteúdo

Featured Replies

Postado

Alguem modifica esse script, ele esta em dias, quero em horas.

e pra ser puxado tem que ter cobrar um item (6527)

caso o player n tenha o item, nao da pra puxar a alavanca.


Grato desde de ja !

 

Citar

local config = {
    daily = "no",
    level = 100,
    storage = 30015
}

local playerPosition =
{
    {x = 247, y = 659, z = 13},
    {x = 247, y = 660, z = 13},
    {x = 247, y = 661, z = 13},
    {x = 247, y = 662, z = 13}
}

local newPosition =
{
    {x = 189, y = 650, z = 13},
     {x = 189, y = 651, z = 13},
    {x = 189, y = 652, z = 13},
    {x = 189, y = 653, z = 13}
}

-- Do not modify the declaration lines below.
local players = {}
local failed = true
config.daily = getBooleanFromString(config.daily)

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 1946) then
        if(config.daily) then
            doPlayerSendCancel(cid, "Sorry, not possible.")
        else
            doTransformItem(item.uid, item.itemid - 1)
        end

        return true
    end

    if(item.itemid ~= 1945) then
        return true
    end

    for i, pos in ipairs(playerPosition) do
        pos.stackpos = STACKPOS_TOP_CREATURE
        players = getThingFromPos(playerPosition).uid
        if(players > 0 and
            isPlayer(players) and
            getPlayerStorageValue(players.uid, config.storage) == -1 and
            getPlayerLevel(players.uid) >= config.level)
        then
            failed = false
        end

        if(failed) then
            doPlayerSendCancel(cid, "Sorry, not possible.")
            return true
        end

        failed = true
    end

    for i, pid in ipairs(players) do
        doSendMagicEffect(playerPosition, CONST_ME_POFF)
        doTeleportThing(pid, newPosition, false)
        doSendMagicEffect(newPosition, CONST_ME_ENERGYAREA)
    end

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

 

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

Postado

Salve man!, testa ai


local config = {

cooldownHours = 6, -- tempo em horas para usar novamente

level = 100,

storage = 30015, -- armazena o timestamp da última vez que usou

requiredItem = 6527,

playerPositions = {

{x = 247, y = 659, z = 13},

{x = 247, y = 660, z = 13},

{x = 247, y = 661, z = 13},

{x = 247, y = 662, z = 13}

},

teleportPositions = {

{x = 189, y = 650, z = 13},

{x = 189, y = 651, z = 13},

{x = 189, y = 652, z = 13},

{x = 189, y = 653, z = 13}

}

}

function onUse(cid, item, fromPosition, itemEx, toPosition)

if item.itemid == 1946 then

doTransformItem(item.uid, 1945)

return true

end

local players = {}

for i, pos in ipairs(config.playerPositions) do

local creature = getTopCreature(pos).uid

if creature > 0 and isPlayer(creature) then

-- Verificações individuais

if getPlayerLevel(creature) < config.level then

doPlayerSendCancel(cid, "Todos os jogadores precisam ter level " .. config.level .. " ou mais.")

return true

end

if getPlayerItemCount(creature, config.requiredItem) < 1 then

doPlayerSendCancel(cid, "Todos os jogadores precisam ter o item necessário (ID: " .. config.requiredItem .. ").")

return true

end

local lastUse = getPlayerStorageValue(creature, config.storage)

if lastUse ~= -1 and os.time() - lastUse < (config.cooldownHours * 3600) then

local remaining = math.ceil(((lastUse + config.cooldownHours * 3600) - os.time()) / 60)

doPlayerSendCancel(cid, "Todos os jogadores devem esperar " .. remaining .. " minutos para usar novamente.")

return true

end

table.insert(players, creature)

else

doPlayerSendCancel(cid, "Todos os quadrados precisam estar ocupados por jogadores.")

return true

end

end

-- Tudo ok, teleporta e consome o item

for i, player in ipairs(players) do

doTeleportThing(player, config.teleportPositions[i], false)

doSendMagicEffect(config.playerPositions[i], CONST_ME_POFF)

doSendMagicEffect(config.teleportPositions[i], CONST_ME_ENERGYAREA)

doPlayerRemoveItem(player, config.requiredItem, 1)

setPlayerStorageValue(player, config.storage, os.time())

end

doTransformItem(item.uid, 1946)

return true

end


Editado por Darcio Antonio
Tentando colocar codigo! para ficar bonitinho! (veja o histórico de ediçõ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