Ir para conteúdo
  • 0

Auto-Loot System Automatico! Help


Luga03

Pergunta

Eae pessoa, estou precisando de um sistema de auto-loot, que ao usar o comando "/autoloot on", todo corpose que ele clicar, vai pegar todos os itens dentro, e se ele usar "/autoloot off" esta função para! o Gabrielbsales, postou este sistema, mas ele precisa colocar corpose por corpose, ai queria que fosse automático help plx

Link para o comentário
Compartilhar em outros sites

Posts Recomendados

  • 0

Use esta versão com proteções:

 

--local toloot = {11441, 11441, 11443, 11444, 11445, 11446, 11447, 11448, 11449,11450, 11451, 11452, 11453, 11454, 12618, 12232, 12244} -- PREFERENCIAL - SE QUISER APENAS COM ALGUNS ITENS
function onUse(cid, item, frompos, item2, topos)
    if getItemAttribute(item.uid, "corpseowner") ~= cid then
        doPlayerSendCancel(cid, "You're not the owner.")
        return true
    end
    if getPlayerStorageValue(cid, 4919) < 1 then
        return false
    else
        local items = {}
        for x=0, (getContainerSize(item.uid)) do
            local itens = getContainerItem(item.uid, 0)
            if itens and itens.uid > 0 and itens.itemid ~= 0 then
                --if isInArray(toloot, itens.itemid) then
                table.insert(items, {i=itens.itemid, q=itens.type})
                doRemoveItem(itens.uid)
                --break
                --end
            end
        end
        for y=1, #items do
            doPlayerAddItemStacking(cid, items[y].i, items[y].q)
            doPlayerSendTextMessage(cid, 20, "Looted "..items[y].q.."x "..getItemNameById(items[y].i)..".")
        end
        if #items > 0 then
            return true
        else
            return false
        end
    end
end
--[[
AUTO LOOT BY GABRIEL SALES
SE QUISER ATIVAR O AUTOLOOT APENAS PARA ALGUNS ITENS, ADICIONE OS IDS NA TABELA toloot E TIRE OS COMENTÁRIOS(--).
--]]
Link para o comentário
Compartilhar em outros sites

  • 1

Não tinha visto ._. malz aew, vo ter aq ´q pq eu sabia que ele tinha postado, ai peguei o primeiro link o sistema dele que achei e mande ^^ vo testar aq


está funcionando! mas ao clicar no corpose do pokémon da este erro:

 

[18/06/2015 19:04:52] [Error - Action Interface]
[18/06/2015 19:04:52] data/actions/scripts/Autoloot.lua:onUse
[18/06/2015 19:04:52] Description:
[18/06/2015 19:04:52] (luaDoRemoveItem) Item not found
[18/06/2015 19:04:52] [Error - Action Interface]
[18/06/2015 19:04:52] data/actions/scripts/Autoloot.lua:onUse
[18/06/2015 19:04:52] Description:
[18/06/2015 19:04:52] (luaDoPlayerAddItem) Item not found
[18/06/2015 19:04:52] [Error - Action Interface]
[18/06/2015 19:04:52] data/actions/scripts/Autoloot.lua:onUse
[18/06/2015 19:04:52] Description:
[18/06/2015 19:04:52] data/lib/050-function.lua:239: attempt to index a boolean value
[18/06/2015 19:04:52] stack traceback:
[18/06/2015 19:04:52] data/lib/050-function.lua:239: in function 'getItemNameById'
[18/06/2015 19:04:52] data/actions/scripts/Autoloot.lua:21: in function <data/actions/scripts/Autoloot.lua:2>
Link para o comentário
Compartilhar em outros sites

  • 0

Talkaction:

function onSay(cid, words, param)
    if param == "" then
        return doPlayerSendCancel(cid, "/autoloot on/off")
    end
    local value = param:lower() == "on" and 1 or param:lower() == "off" and -1 or false
    if not value then
        return doPlayerSendCancel(cid, "/autoloot on/off")
    elseif getPlayerStorageValue(cid, 4919) == value then
        return doPlayerSendCancel(cid, "Your autoloot is already "..param..".")
    end
    setPlayerStorageValue(cid, 4919, value)
    doPlayerSendTextMessage(cid, 27, "Your autoloot is now "..param..".")
    return true
end
Tag da action:
<action actionid="9282" event="script" value="Autoloot.lua"/>
Novo código da action:
--local toloot = {11441, 11441, 11443, 11444, 11445, 11446, 11447, 11448, 11449,11450, 11451, 11452, 11453, 11454, 12618, 12232, 12244} -- PREFERENCIAL - SE QUISER APENAS COM ALGUNS ITENS
function onUse(cid, item, frompos, item2, topos)
    if getItemAttribute(item.uid, "corpseowner") ~= cid then
        doPlayerSendCancel(cid, "You're not the owner.")
        return true
    end
    if getPlayerStorageValue(cid, 4919) < 1 then
        return false
    else
        local items = {}
        for x=0, (getContainerSize(item.uid)) do
            local itens = getContainerItem(item.uid, x)
            --if isInArray(toloot, itens.itemid) then
            table.insert(items, {i=itens.itemid, q=itens.type})
            doRemoveItem(itens.uid)
            --break
            --end
        end
        for y=1, #items do
            doPlayerAddItemStacking(cid, items[y].i, items[y].q)
            doPlayerSendTextMessage(cid, 20, "Looted "..items[y].q.."x "..getItemNameById(items[y].i)..".")
        end
        if #items > 0 then
            return true
        else
            return false
        end
    end
end
--[[
AUTO LOOT BY GABRIEL SALES
SE QUISER ATIVAR O AUTOLOOT APENAS PARA ALGUNS ITENS, ADICIONE OS IDS NA TABELA toloot E TIRE OS COMENTÁRIOS(--).
--]]
Se a base de seu servidor for PDA:
Em data/creaturescripts/scripts, pokeexp.lua:
Abaixo de:
function onDeath(cid, corpse, deathList)
coloque:
doItemSetAttribute(corpse.uid, "aid", 9282)
Se a base do seu servidor não for PDA, avise.
Editado por zipter98
Link para o comentário
Compartilhar em outros sites

  • 0

Eu uso a source do Poke Dash V9, que não é PDA, mas um cara editou a base e tentou chegar bem perto do PDA, mas ele n conseguio, estou usando de base a Poke Dash Advanced 2015 Open Source Pelo Nextbr


está dando este erro:

 

[18/06/2015 08:23:01] [Error - Action Interface]
[18/06/2015 08:23:01] data/actions/scripts/Autoloot.lua:onUse
[18/06/2015 08:23:01] Description:
[18/06/2015 08:23:01] data/actions/scripts/Autoloot.lua:20: attempt to call global 'doPlayerAddItemStacking' (a nil value)
[18/06/2015 08:23:01] stack traceback:
[18/06/2015 08:23:01] data/actions/scripts/Autoloot.lua:20: in function <data/actions/scripts/Autoloot.lua:2>
ai eu removi esta função, ai agora está aparecendo a mensagem no default do player que deu autolooted no item, e na distro deu este erro:
[18/06/2015 08:29:37] [Error - Action Interface]
[18/06/2015 08:29:37] data/actions/scripts/Autoloot.lua:onUse
[18/06/2015 08:29:37] Description:
[18/06/2015 08:29:37] (luaDoRemoveItem) Item not found
[18/06/2015 08:29:37] [Error - Action Interface]
[18/06/2015 08:29:37] data/actions/scripts/Autoloot.lua:onUse
[18/06/2015 08:29:37] Description:
[18/06/2015 08:29:37] data/lib/050-function.lua:239: attempt to index a boolean value
[18/06/2015 08:29:37] stack traceback:
[18/06/2015 08:29:37] data/lib/050-function.lua:239: in function 'getItemNameById'
[18/06/2015 08:29:37] data/actions/scripts/Autoloot.lua:21: in function <data/actions/scripts/Autoloot.lua:2>

 

Editado por Zet0N0Murmurouu
Link para o comentário
Compartilhar em outros sites

  • 0

Se você não colocar a função doPlayerAddItemStacking na lib, como indicado no tópico do sistema, é claro que não vai funcionar.

Também troque esta linha:

 

local itens = getContainerItem(item.uid, x)

por:

 

local itens = getContainerItem(item.uid, 0)
Editado por zipter98
Link para o comentário
Compartilhar em outros sites

  • 0

 

Se você não colocar a função doPlayerAddItemStacking na lib, como indicado no tópico do sistema, é claro que não vai funcionar.

Também troque esta linha:

local itens = getContainerItem(item.uid, x)

por:

local itens = getContainerItem(item.uid, 0)

eu n sei colocar esta função na lib, n tenho o código dela ¬¬

Link para o comentário
Compartilhar em outros sites

  • 0

eu n sei colocar esta função na lib, n tenho o código dela ¬¬

Amigo, ele quis fizer no script.

 

Ficando assim:

--local toloot = {11441, 11441, 11443, 11444, 11445, 11446, 11447, 11448, 11449,11450, 11451, 11452, 11453, 11454, 12618, 12232, 12244} -- PREFERENCIAL - SE QUISER APENAS COM ALGUNS ITENS
function onUse(cid, item, frompos, item2, topos)
    if getItemAttribute(item.uid, "corpseowner") ~= cid then
        doPlayerSendCancel(cid, "You're not the owner.")
        return true
    end
    if getPlayerStorageValue(cid, 4919) < 1 then
        return false
    else
        local items = {}
        for x=0, (getContainerSize(item.uid)) do
            local itens = getContainerItem(item.uid, 0)
            --if isInArray(toloot, itens.itemid) then
            table.insert(items, {i=itens.itemid, q=itens.type})
            doRemoveItem(itens.uid)
            --break
            --end
        end
        for y=1, #items do
            doPlayerAddItemStacking(cid, items[y].i, items[y].q)
            doPlayerSendTextMessage(cid, 20, "Looted "..items[y].q.."x "..getItemNameById(items[y].i)..".")
        end
        if #items > 0 then
            return true
        else
            return false
        end
    end
end
--[[
AUTO LOOT BY GABRIEL SALES
SE QUISER ATIVAR O AUTOLOOT APENAS PARA ALGUNS ITENS, ADICIONE OS IDS NA TABELA toloot E TIRE OS COMENTÁRIOS(--).
--]]
Link para o comentário
Compartilhar em outros sites

  • 0

agora está apenas sumindo o item e dando este erro:

 

[18/06/2015 16:42:32] [Error - Action Interface]
[18/06/2015 16:42:32] data/actions/scripts/Autoloot.lua:onUse
[18/06/2015 16:42:32] Description:
[18/06/2015 16:42:32] (luaDoRemoveItem) Item not found
[18/06/2015 16:42:32] [Error - Action Interface]
[18/06/2015 16:42:33] data/actions/scripts/Autoloot.lua:onUse
[18/06/2015 16:42:33] Description:
[18/06/2015 16:42:33] data/actions/scripts/Autoloot.lua:20: attempt to call global 'doPlayerAddItemStacking' (a nil value)
[18/06/2015 16:42:33] stack traceback:
[18/06/2015 16:42:33] data/actions/scripts/Autoloot.lua:20: in function <data/actions/scripts/Autoloot.lua:2>
Link para o comentário
Compartilhar em outros sites

  • 0

agora está apenas sumindo o item e dando este erro:

 

[18/06/2015 16:42:32] [Error - Action Interface]

[18/06/2015 16:42:32] data/actions/scripts/Autoloot.lua:onUse

[18/06/2015 16:42:32] Description:

[18/06/2015 16:42:32] (luaDoRemoveItem) Item not found

 

[18/06/2015 16:42:32] [Error - Action Interface]

[18/06/2015 16:42:33] data/actions/scripts/Autoloot.lua:onUse

[18/06/2015 16:42:33] Description:

[18/06/2015 16:42:33] data/actions/scripts/Autoloot.lua:20: attempt to call global 'doPlayerAddItemStacking' (a nil value)

[18/06/2015 16:42:33] stack traceback:

[18/06/2015 16:42:33] data/actions/scripts/Autoloot.lua:20: in function <data/actions/scripts/Autoloot.lua:2>

Tenta assim:

 

--local toloot = {11441, 11441, 11443, 11444, 11445, 11446, 11447, 11448, 11449,11450, 11451, 11452, 11453, 11454, 12618, 12232, 12244} -- PREFERENCIAL - SE QUISER APENAS COM ALGUNS ITENS
function onUse(cid, item, frompos, item2, topos)
    if getItemAttribute(item.uid, "corpseowner") ~= cid then
        doPlayerSendCancel(cid, "You're not the owner.")
        return true
    end
    if getPlayerStorageValue(cid, 4919) < 1 then
        return false
    else
        local items = {}
        for x=0, (getContainerSize(item.uid)) do
            local itens = getContainerItem(item.uid, 0)
            --if isInArray(toloot, itens.itemid) then
            table.insert(items, {i=itens.itemid, q=itens.type})
            doRemoveItem(itens.uid)
            --break
            --end
        end
        if #items > 0 then
			for _, y in pairs(items) do
				doPlayerAddItemStacking(cid, items[y].i, items[y].q)
				doPlayerSendTextMessage(cid, 20, "Looted "..items[y].q.."x "..getItemNameById(items[y].i)..".")
			end
            return true
        else
            return false
        end
    end
end
--[[
AUTO LOOT BY GABRIEL SALES
SE QUISER ATIVAR O AUTOLOOT APENAS PARA ALGUNS ITENS, ADICIONE OS IDS NA TABELA toloot E TIRE OS COMENTÁRIOS(--).
--]]

 

Link para o comentário
Compartilhar em outros sites

  • 0

Tenta assim:

 

 

--local toloot = {11441, 11441, 11443, 11444, 11445, 11446, 11447, 11448, 11449,11450, 11451, 11452, 11453, 11454, 12618, 12232, 12244} -- PREFERENCIAL - SE QUISER APENAS COM ALGUNS ITENS
function onUse(cid, item, frompos, item2, topos)
    if getItemAttribute(item.uid, "corpseowner") ~= cid then
        doPlayerSendCancel(cid, "You're not the owner.")
        return true
    end
    if getPlayerStorageValue(cid, 4919) < 1 then
        return false
    else
        local items = {}
        for x=0, (getContainerSize(item.uid)) do
            local itens = getContainerItem(item.uid, 0)
            --if isInArray(toloot, itens.itemid) then
            table.insert(items, {i=itens.itemid, q=itens.type})
            doRemoveItem(itens.uid)
            --break
            --end
        end
        if #items > 0 then
			for _, y in pairs(items) do
				doPlayerAddItemStacking(cid, items[y].i, items[y].q)
				doPlayerSendTextMessage(cid, 20, "Looted "..items[y].q.."x "..getItemNameById(items[y].i)..".")
			end
            return true
        else
            return false
        end
    end
end
--[[
AUTO LOOT BY GABRIEL SALES
SE QUISER ATIVAR O AUTOLOOT APENAS PARA ALGUNS ITENS, ADICIONE OS IDS NA TABELA toloot E TIRE OS COMENTÁRIOS(--).
--]]

 

 

[18/06/2015 18:25:05] [Error - Action Interface]

[18/06/2015 18:25:05] data/actions/scripts/Autoloot.lua:onUse
[18/06/2015 18:25:05] Description:
[18/06/2015 18:25:05] (luaDoRemoveItem) Item not found
[18/06/2015 18:25:05] [Error - Action Interface]
[18/06/2015 18:25:05] data/actions/scripts/Autoloot.lua:onUse
[18/06/2015 18:25:05] Description:
[18/06/2015 18:25:05] data/actions/scripts/Autoloot.lua:21: attempt to index field '?' (a nil value)
[18/06/2015 18:25:05] stack traceback:
[18/06/2015 18:25:05] data/actions/scripts/Autoloot.lua:21: in function <data/actions/scripts/Autoloot.lua:2>
Link para o comentário
Compartilhar em outros sites

  • 0

Zet0N0Murmurouu, suponho que você não tenha lido o conteúdo do tópico que você mesmo enviou (do autoloot escrito pelo Gabrielbsales). Nele, o autor posta o código da função doPlayerAddItemStacking.

function doPlayerAddItemStacking(cid, itemid, quant) 
    local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid)
    local piles = 0
    if #item > 0 then
        for i,x in pairs(item) do
            if getThing(x).type < 100 then
                local it = getThing(x)
                doTransformItem(it.uid, itemid, it.type+quant)
                if it.type+quant > 100 then
                    doPlayerAddItem(cid, itemid, it.type+quant-100)
                end
            else
                piles = piles+1
            end
            break
        end
    else
        return doPlayerAddItem(cid, itemid, quant)
    end
    if piles == #item then
        doPlayerAddItem(cid, itemid, quant)
    end
end

Coloque este código em algum arquivo da lib e depois utilize os scripts que enviei anteriormente.

Editado por zipter98
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...