• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Auto loot system

TopllDan

Football <3
Joined
May 14, 2015
Messages
66
Reaction score
0
Hello I am using a self loot system 100% that zipter98 posted here in the forum, plus it is just pulling an item at a time to backpack, I would like to put to pull all the loots that are in Pokémon body to the backpack?

part in lib:

Code:
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

the action script:

Code:
--local toloot = {11441, 11441, 11443, 11444, 11445, 11446, 11447, 11448, 11449,11450, 11451, 11452, 11453, 11454, 12618, 12232, 12244}
function onUse(cid, item, frompos, item2, topos)
    if getItemAttribute(item.uid, "corpseowner") ~= cid then
        doPlayerSendCancel(cid, "Não foi você que matou esse pokemon.")
        return true
    end
        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
        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
 
Last edited:
Hello I am using a self loot system 100% that zipter98 posted here in the forum, plus it is just pulling an item at a time to backpack, I would like to put to pull all the loots that are in Pokémon body to the backpack?

part in lib:

Code:
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

the action script:

Code:
--local toloot = {11441, 11441, 11443, 11444, 11445, 11446, 11447, 11448, 11449,11450, 11451, 11452, 11453, 11454, 12618, 12232, 12244}
function onUse(cid, item, frompos, item2, topos)
    if getItemAttribute(item.uid, "corpseowner") ~= cid then
        doPlayerSendCancel(cid, "Não foi você que matou esse pokemon.")
        return true
    end
        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
        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

i'd help you but I literally have no idea what your wanting
 
Last edited:
i'd help you but I literally have no idea what your wanting
Looking at the request I think I understand what he wants.

Currently it auto loots 1 item at a time. So if 7 items drop, you need to collect each item.
What he wants is to loop through the body collecting everything, until it's empty, with 1 auto loot.


(If this isn't what he means, I have no idea either.)
 
Looking at the request I think I understand what he wants.

Currently it auto loots 1 item at a time. So if 7 items drop, you need to collect each item.
What he wants is to loop through the body collecting everything, until it's empty, with 1 auto loot.


(If this isn't what he means, I have no idea either.)

certain:D
 
Back
Top