HellO! I have this creaturescript:
I got sometimes these errors:
What can it be?
Code:
local stor = 7590
function autoloot(cid, target, pos)
if not isPlayer(cid) then
return
end
local function scanContainer(cid, uid, list)
for k = (getContainerSize(uid) - 1), 0, -1 do
local tmp = getContainerItem(uid, k)
if (isInArray(list, tmp.itemid)) then
local item = doCreateItemEx(tmp.itemid, tmp.type)
doPlayerAddItemEx(cid, item, true)
doRemoveItem(tmp.uid)
elseif isContainer(tmp.uid) then
scanContainer(cid, tmp.uid, list)
end
end
end
local items = {}
for i = getTileInfo(pos).items, 1, -1 do
pos.stackpos = i
items[i] = getThingFromPos(pos)
end
if (#items == 0) then
return
end
local corpse = -1
for _, item in pairs(items) do
if not isCreature(item.uid) then
local name = getItemName(item.uid):lower()
if name:find(target:lower()) then
corpse = item.uid
break
end
end
end
if (corpse ~= -1) and isContainer(corpse) and (getItemAttribute(corpse, "corpseowner") == getPlayerGUID(cid)) then
scanContainer(cid, corpse, tostring(getPlayerStorageValue(cid, stor)):gsub('_', ''):explode(','))
end
end
function onKill(cid, target, lastHit)
if not isPlayer(target) then
local infos = getPlayerStorageValue(cid, stor)
if (infos == -1) then
return true
end
local list = tostring(infos):explode(',')
if (#list == 0) then
return true
end
local puta = getCreatureName(target)
local par = string.explode(puta, " ")
if isInArray(pokesOutland, puta) then
puta = par[2]
end
addEvent(autoloot, 150, cid, puta, getCreaturePosition(target))
end
return true
end
I got sometimes these errors:
Code:
[28/6/2016 3:13:37] [Error - CreatureScript Interface]
[28/6/2016 3:13:37] In a timer event called from:
[28/6/2016 3:13:37] data/creaturescripts/scripts/autoloot.lua:onKill
[28/6/2016 3:13:37] Description:
[28/6/2016 3:13:37] (LuaInterface::luaGetThing) Thing not found
[28/6/2016 3:13:37] [Error - CreatureScript Interface]
[28/6/2016 3:13:38] In a timer event called from:
[28/6/2016 3:13:38] data/creaturescripts/scripts/autoloot.lua:onKill
[28/6/2016 3:13:38] Description:
[28/6/2016 3:13:38] data/lib/100-shortcut.lua:272: attempt to index a boolean value
[28/6/2016 3:13:38] stack traceback:
[28/6/2016 3:13:38] data/lib/100-shortcut.lua:272: in function 'getItemName'
[28/6/2016 3:13:38] data/creaturescripts/scripts/autoloot.lua:34: in function <data/creaturescripts/scripts/autoloot.lua:3>
What can it be?