Sigoles
Discord: @sigoles
- Joined
- Nov 20, 2015
- Messages
- 1,209
- Solutions
- 2
- Reaction score
- 154
The system works, but appears on screen this error:
Script:
Font: http://www.tibiaking.com/forum/forums/topic/63838-tfs-1x-autoloot-system/
Help to solve this error please
Code:
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>
Script:
Code:
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 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)
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
Font: http://www.tibiaking.com/forum/forums/topic/63838-tfs-1x-autoloot-system/
Help to solve this error please