Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/creaturescripts/scripts/autoloot.lua:13: attempt to call method 'getSize' (a nil value)
stack traceback:
[C]: in function 'getSize'
data/creaturescripts/scripts/autoloot.lua:13: in function <data/creaturescripts/scripts/autoloot.lua:1>
autoloot.lua
local function scanContainer(cid, position)
local player = Player(cid)
if not player then
return
end
local corpse = Tile(position):getTopDownItem()
if not corpse then
return
end
if corpse:getType():isCorpse() and corpse:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == cid then
for i = corpse:getSize() - 1, 0, -1 do
local containerItem = corpse:getItem(i)
if containerItem then
for i = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
if player:getStorageValue(i) == containerItem:getId() then
containerItem:moveTo(player)
end
end
end
end
end
end
function onKill(player, target)
if not target:isMonster() then
return true
end
addEvent(scanContainer, 100, player:getId(), target:getPosition())
return true
end