• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 0.X Getting this error from my autoloot mod

KingKing

Member
Joined
Nov 6, 2019
Messages
33
Reaction score
6
Hello,

i have this error in my console from autoloot mod.

Code:
[17:18:59.638] [Error - CreatureScript Interface]
[17:18:59.638] In a timer event called from:
[17:18:59.638] domodlib('Loot_func')
[17:18:59.638]     function onDeath(cid, corpse, deathList)
[17:18:59.638]     if isMonster(cid) then
[17:18:59.638]     local killer,pos = deathList[1],getCreaturePosition(cid)
[17:18:59.653]     local lookCorpse = getMonsterInfo(getCreatureName(cid)).lookCorpse
[17:18:59.653]     if isContainerByItemId(lookCorpse) then
[17:18:59.653]         addEvent(corpseRetireItems,1,killer,pos)
[17:18:59.653]     end
[17:18:59.653]     end
[17:18:59.669] return true
[17:18:59.669] end:onDeath
[17:18:59.669] Description:
[17:18:59.669] (LuaInterface::luaGetCreatureStorage) Creature not found

this is the mod

XML:
<?xml version="1.0" encoding="ISO-8859-1"?>  
<mod name="Loot System" version="1.0" author="Vodkart And Mkalo" contact="none.com" enabled="yes">  
<config name="Loot_func"><![CDATA[
                info = {
                        OnlyPremium = true,
                        AutomaticDeposit = false,
                        BlockMonsters = {},
                        BlockItemsList = {}
                        }
                        
 function isContainerByItemId(itemid) -- By SevuEntertainment
    return getItemInfo(itemid).group == 2 and true or false
end
function setPlayerStorageTable(cid, storage, tab)
    local tabstr = "&"
    for i,x in pairs(tab) do
            tabstr = tabstr .. i .. "," .. x .. ";"
    end
    setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))
end
function getPlayerStorageTable(cid, storage)
    local tabstr = getPlayerStorageValue(cid, storage)
    local tab = {}
    if type(tabstr) ~= "string" then
            return {}
    end
    if tabstr:sub(1,1) ~= "&" then
            return {}
    end
    local tabstr = tabstr:sub(2, #tabstr)
    local a = string.explode(tabstr, ";")
    for i,x in pairs(a) do
            local b = string.explode(x, ",")
            tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2]
    end
    return tab
end
function ExistItemByName(name) -- by vodka
    local items = io.open("data/items/items.xml", "r"):read("*all")
    local get = items:match('name="' .. name ..'"')
    if get == nil or get == "" then
        return false
    end
return true
end 
function isInTable(cid, item)
         for _,i in pairs(getPlayerStorageTable(cid, 27000))do
             if tonumber(i) == tonumber(item) then
                return true
             end
         end
return false
end
function addItemTable(cid, item)
         local x = {}
               for i = 1,#getPlayerStorageTable(cid, 27000) do
                   table.insert(x,getPlayerStorageTable(cid, 27000)[i])
               end
               if x ~= 0 then
                  table.insert(x,tonumber(item))
                  setPlayerStorageTable(cid, 27000, x)
               else
                   setPlayerStorageTable(cid, 27000, {item})
               end
end
function removeItemTable(cid, item)
         local x = {}
               for i = 1,#getPlayerStorageTable(cid, 27000) do
                   table.insert(x,getPlayerStorageTable(cid, 27000)[i])
               end
               for i,v in ipairs(x) do 
                   if tonumber(v) == tonumber(item) then
                   table.remove(x,i)
               end
               end
         return setPlayerStorageTable(cid, 27000, x)
end
function ShowItemsTabble(cid)
local str,n = "-- My Loot List --\n\n",0
for i = 1,#getPlayerStorageTable(cid, 27000) do
n = n + 1
str = str..""..n.." - "..getItemNameById(getPlayerStorageTable(cid, 27000)[i]).."\n"
end
return doShowTextDialog(cid, 2471, str)
end
function getContainerItems(containeruid)
    local items = {}
    local containers = {}
    if type(getContainerSize(containeruid)) ~= "number" then
            return false
    end
    for slot = 0, getContainerSize(containeruid)-1 do
            local item = getContainerItem(containeruid, slot)
            if item.itemid == 0 then
                    break
            end
            if isContainer(item.uid) then
                    table.insert(containers, item.uid)
            end
            table.insert(items, item)
    end
    if #containers > 0 then
            for i,x in ipairs(getContainerItems(containers[1])) do
                    table.insert(items, x)
            end
            table.remove(containers, 1)
    end     
    return items
end
function getItemsInContainerById(container, itemid) -- Function By Kydrai
            local items = {}
            if isContainer(container) and getContainerSize(container) > 0 then
                            for slot=0, (getContainerSize(container)-1) do
                                            local item = getContainerItem(container, slot)
                                            if isContainer(item.uid) then
                                                            local itemsbag = getItemsInContainerById(item.uid, itemid)
                                                            for i=0, #itemsbag do
                                                                            table.insert(items, itemsbag[i])
                                                            end
                                            else
                                                            if itemid == item.itemid then
                                                                            table.insert(items, item.uid)
                                                            end
                                            end
                            end
            end
            return items
end
function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo

            return doPlayerAddItem(cid, itemid, quant)

end
function AutomaticDeposit(cid,item,n)
local deposit = item == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n*1)
return doPlayerDepositMoney(cid, deposit)
end
function corpseRetireItems(cid, pos)
        local check = false
        for i = 0, 255 do
        pos.stackpos = i
        tile = getTileThingByPos(pos)
                if tile.uid > 0 and isCorpse(tile.uid) then
                        check = true break
                end
end
                if check == true then
                local items = getContainerItems(tile.uid)
                        for i,x in pairs(items) do
                                if isInArray(getPlayerStorageTable(cid, 27000), tonumber(x.itemid)) then
                                        if isItemStackable(x.itemid) then
                                                doPlayerAddItemStacking(cid, x.itemid, x.type)
                                                if info.AutomaticDeposit == true and isInArray({"2148","2152","2160"},tonumber(x.itemid)) then
                                                AutomaticDeposit(cid,x.itemid,x.type)
                                                end
                                        else
                                                doPlayerAddItem(cid, x.itemid)
                                        end
                                                doRemoveItem(x.uid)
                                end
                        end
                end
end
]]></config>
<event type="login" name="LootLogin" event="script"><![CDATA[
function onLogin(cid)
registerCreatureEvent(cid, "MonsterAttack")
return true
end]]></event>
<event type="death" name="LootEventDeath" event="script"><![CDATA[
domodlib('Loot_func')
    function onDeath(cid, corpse, deathList)
    if isMonster(cid) then
    local killer,pos = deathList[1],getCreaturePosition(cid)
    local lookCorpse = getMonsterInfo(getCreatureName(cid)).lookCorpse
    if isContainerByItemId(lookCorpse) then
        addEvent(corpseRetireItems,1,killer,pos)
    end
    end
return true
end]]></event>
<event type="combat" name="MonsterAttack" event="script"><![CDATA[
domodlib('Loot_func')
                if isPlayer(cid) and isMonster(target) and not isInArray(info.BlockMonsters,string.lower(getCreatureName(target))) then
                        registerCreatureEvent(target, "LootEventDeath")
                                end
return true]]></event>
<talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[
domodlib('Loot_func')
local t = string.explode(string.lower(param), ",")
if info.OnlyPremium == true and not isPremium(cid) then
doPlayerSendCancel(cid, "you must be a premium account.") return true
elseif not t[1] then
ShowItemsTabble(cid) return true
elseif tonumber(t[1]) or tonumber(t[2]) then
doPlayerSendCancel(cid, "enter !autoloot add,name or !autoloot remove,name") return true
elseif isInArray({"add","remove"}, tostring(t[1])) then
local func,check = tostring(t[1]) == "add" and addItemTable or removeItemTable, tostring(t[1]) == "add" and true or false
local item = ExistItemByName(tostring(t[2]))
if not item then
doPlayerSendCancel(cid, "This item does not exist.") return true
end
local itemlist = getItemIdByName(tostring(t[2])) 
if check == true and isInArray(info.BlockItemsList, itemlist) then
doPlayerSendCancel(cid, "You can not add this item in the list!") return true
elseif isInTable(cid, itemlist) == check then
doPlayerSendCancel(cid, "This Item "..(check == true and "already" or "is not").." in your list.") return true
end
func(cid, itemlist)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,check == true and "you added the item "..t[2].." in the list" or "you removed the item "..t[2].." from the list") return true
end
return true]]></talkaction>
</mod>

sometimes i find this error
Tfs 0.3.7 for 8.6
Any help?
 
Solution
change this:
Code:
if isContainerByItemId(lookCorpse) then
addEvent(corpseRetireItems,1,killer,pos)
end
to this:
Code:
if killer ~= nil then
if isPlayer(killer) == true then
if isContainerByItemId(lookCorpse) then
addEvent(corpseRetireItems,1,killer,pos)
end
end
end
change this:
Code:
if isContainerByItemId(lookCorpse) then
addEvent(corpseRetireItems,1,killer,pos)
end
to this:
Code:
if killer ~= nil then
if isPlayer(killer) == true then
if isContainerByItemId(lookCorpse) then
addEvent(corpseRetireItems,1,killer,pos)
end
end
end
 
Solution
change this:
Code:
if isContainerByItemId(lookCorpse) then
addEvent(corpseRetireItems,1,killer,pos)
end
to this:
Code:
if killer ~= nil then
if isPlayer(killer) == true then
if isContainerByItemId(lookCorpse) then
addEvent(corpseRetireItems,1,killer,pos)
end
end
end
Thanks man, i will try it to check if this error will disappear.
But do you know when this error happens?
Also can you help me in adding a command to clear this items list like ( !autoloot clear ) ?
 
Try to kill monster with your summon or kill monster with firefield but before monster death you have to logout (or die and not login back).
 
Hello @andu again,

today i found this error, anything.
any info about it ?

Code:
[21:52:41.186] [Error - TalkAction Interface]
[21:52:41.186] local cid = 268456425
[21:52:41.186] local words = "!autoloot"
[21:52:41.186] local param = "add ,"
[21:52:41.186] local channel = 65534
[21:52:41.186] domodlib('Loot_func')
[21:52:41.186] local t = string.explode(string.lower(param), ",")
[21:52:41.186] if info.OnlyPremium == true and not isPremium(cid) then
[21:52:41.186] doPlayerSendCancel(cid, "you must be a premium account.") return true
[21:52:41.186] elseif not t[1] then
[21:52:41.186] ShowItemsTabble(cid) return true
[21:52:41.186] elseif tonumber(t[1]) or tonumber(t[2]) then
[21:52:41.186] doPlayerSendCancel(cid, "enter !autoloot add,name or !autoloot remove,name") return true
[21:52:41.186] elseif isInArray({"add","remove","clear"}, tostring(t[1])) then
[21:52:41.186] if tostring(t[1]) == "clear" then
[21:52:41.186]     for index, itemId in pairs(getPlayerStorageTable(cid, 27000)) do
[21:52:41.186]         removeItemTable(cid, itemId)
[21:52:41.186]     end
[21:52:41.186]     doPlayerSendCancel(cid, "Clear list success!")
[21:52:41.186]     return true
[21:52:41.186] end
[21:52:41.186] local func,check = tostring(t[1]) == "add" and addItemTable or removeItemTable, tostring(t[1]) == "add" and true or false
[21:52:41.186] local item = ExistItemByName(tostring(t[2]))
[21:52:41.186] if not item then
[21:52:41.186] doPlayerSendCancel(cid, "This item does not exist.") return true
[21:52:41.186] end
[21:52:41.186] local itemlist = getItemIdByName(tostring(t[2]))
[21:52:41.186] if check == true and isInArray(info.BlockItemsList, itemlist) then
[21:52:41.186] doPlayerSendCancel(cid, "You can not add this item in the list!") return true
[21:52:41.186] elseif isInTable(cid, itemlist) == check then
[21:52:41.186] doPlayerSendCancel(cid, "This Item "..(check == true and "already" or "is not").." in your list.") return true
[21:52:41.186] end
[21:52:41.186] func(cid, itemlist)
[21:52:41.186] doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,check == true and "you added the item "..t[2].." in the list" or "you removed the item "..t[2].." from the list") return true
[21:52:41.186] end
[21:52:41.187] return true
[21:52:41.187] Description:
[21:52:41.187] (luaGetItemIdByName) Item not found
 
change
Code:
getItemIdByName(tostring(t[2]))
to
Code:
getItemIdByName(tostring(t[2]), false)

When you try to add an item that does not exist, the function generates an error message that no item is found, with the false value sent to the function as the second parameter this message will disappear.
 
change
Code:
getItemIdByName(tostring(t[2]))
to
Code:
getItemIdByName(tostring(t[2]), false)

When you try to add an item that does not exist, the function generates an error message that no item is found, with the false value sent to the function as the second parameter this message will disappear.
After changing this line to be like urs
from
Code:
local itemlist = getItemIdByName(tostring(t[2]))
to
Code:
local itemlist = getItemIdByName(tostring(t[2]), false)
i get the same error with every item i try to add it
if i make !autoloot add, gold coin
i get the error plus item not added to list.
 
Back
Top