• 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!

Seller Tile

mesosot

Member
Joined
Aug 16, 2007
Messages
356
Reaction score
5
hello

i wanna something like that if some one could do it

have bp of different loot i throw it on a tile it take the bp and give me the loot price

like

bp have

2x knight armor = 2k
1x golden armor = 5k
6x boh = 12k
1x demon legs = 50k

so the tile add me 50+12+5+2 = 69K
 
You should make a price table like this (better if in a lib):
Lua:
local prices = {
[itemid]=price,
[item2id]=price2
}

And you can make it in two different ways, one you'll need the 'autoloot' function which checks everything inside a container, so you can sell infinite items (that may be a problem someday) or simply with a single backpack script:
Lua:
function onAddItem(params I don't remember)
for slot=1,getContainerSize(itemEx.uid)-1 do
if prices[getContainerItem(itemEx.uid, slot).itemid] then
doRemoveItem(getContainerItem(itemEx.uid, slot).uid)
doPlayerAddMoney(cid, prices[getContainerItem(itemEx.uid, slot).itemid])
end
end
return true
end

Here is the function you need by the way:
Lua:
function getItemsInContainerById(container, itemid)
    local items = {}
    if getContainerSize(container) > 0 then
        for slot=0, (getContainerSize(container)-1) do
            local item = getContainerItem(container, slot)
            if isContainer(item.uid) then
                local itemsbag = getItemsInContainerById(item.uid, itemid)
                for i=0, #itemsbag do
                    table.insert(items, itemsbag[i])
                end
            else
                if itemid == item.itemid then
                    table.insert(items, item.uid)
                end
            end
        end
    end
    return items
end

And you also need this:
Lua:
local sellableItems = {}
for i,_ in ipairs(prices) do
table.insert(sellableItems, i)
end

Which makes a list of sellable items.
 
Back
Top