Using printer's version of this script i tried to make it search for the bag, seems like i cant even print out that bag id for some reason. Anyone mind taking a look?
What i want: Make the script look through the corpse, any bags inside, send money to the bank and the rest should get to the backpack, depending on your autoloot choices.
What it does right now: Sends money to the bank and loots but just from the corpse.
What i recently tried: Printing out all itemids from the corpse, seeing that the bag id in the corpse didnt show at all.
What distro im using: TFS 1.3
What i want: Make the script look through the corpse, any bags inside, send money to the bank and the rest should get to the backpack, depending on your autoloot choices.
What it does right now: Sends money to the bank and loots but just from the corpse.
What i recently tried: Printing out all itemids from the corpse, seeing that the bag id in the corpse didnt show at all.
What distro im using: TFS 1.3
Lua:
local function scanContainer(cid, position)
local player = Player(cid)
if not player then
return
end
local corpse = Tile(position):getTopDownItem()
if not corpse or not corpse:isContainer() then
return
end
if corpse:getType():isCorpse() and corpse:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == cid then
for a = corpse:getSize() - 1, 0, -1 do
local containerItem = corpse:getItem(a)
if containerItem then
for b = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
if player:getStorageValue(b) == containerItem:getId() then
containerItem:moveTo(player)
print(containerItem:getId())
if containerItem:isContainer() then
print("triue")
for i = containerItem:getSize() - 1, 0, -1 do
local containerBagItem = containerItem:getItem(i)
if containerBagItem then
containerBagItem:moveTo(player)
end
end
end
end
end
if isItemStackable(containerItem:getId()) then
if containerItem:getId() == 2148 then
containerItem:remove()
doPlayerSetBalance(player, getPlayerBalance(player) + containerItem:getCount())
end
if containerItem:getId() == 2152 then
containerItem:remove()
doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 100))
end
if containerItem:getId() == 2160 then
containerItem:remove()
doPlayerSetBalance(player, getPlayerBalance(player) + (containerItem:getCount() * 10000))
end
end
end
end
end
end