darkmu
Well-Known Member
I'm having problems with the moveTo function, in which not only the primary backpack fills and the secondary backpacks don't fill, so I changed the function to addItem, however what happens and the items still remain in the body of the trash, as I do for remove it from the body?
TFS 1.X
TFS 1.X
Lua:
local strLoot = ''
local lootList = self.players[playerId].lootList
if lootList then
for a = corpse:getSize() - 1, 0, -1 do
local containerItem = corpse:getItem(a)
if containerItem then
local containerItemId = containerItem:getId()
for i = 1, #lootList do
if lootList[i].item_id == containerItemId then
local itemCount = containerItem:getCount()
local itemName = containerItem:getName()
local moveItem = player:addItem(lootList[i].item_id, itemCount)
if moveItem then
strLoot = string.format('%s%dx %s, ', strLoot, itemCount, itemName)
end
end
end
end
end
if strLoot ~= '' then
strLoot = strLoot:sub(1, #strLoot-2)
if strLoot:len() >= 250 then
strLoot:sub(1, 250)
strLoot = strLoot .. " ..."
end
player:sendTextMessage(MESSAGE_STATUS_SMALL, string.format('Loot recolhido: %s', strLoot))
end
end