Qual TFS Você Usa?
OBS: Pode Ser Erro Com A Versão DO TFS Do Server
info
Grupo: Artesão
Registrado: 20/11/12
Posts: 142
Reputação: +19
Char no Tibia: Deleted

Qual TFS Você Usa?
OBS: Pode Ser Erro Com A Versão DO TFS Do Server
Essa script dá muitos loops... eu não sei ao certo o que está causando esse erro, mas provavelmente não deve dar mais nenhum erro (coloquei também pra parar de continuar procurando o corpse quando já é certeza que não vai encontrar):
local configs = {
ids = {2148, 2152, 2160, 7588, 7589, 7590, 7591, 7618, 7620, 8473},
premium = true -- só premium usar o auto loot ? [true ou false]
}
function getItemsInContainerById(container, itemid)
local items = {}
if 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 autoGold(cid, pos, stack)
if not isCreature(cid) then return end
if stack > 200 then
return true
end
local position = {x = pos.x, y = pos.y, z = pos.z, stackpos = stack}
local tile = getThingFromPos(position)
if tile.uid <= 1 then return end
local corpse = nil
if isCorpse(tile.uid) then
corpse = tile
else
autoGold(cid, pos, stack + 1)
return
end
if corpse then
for _, idmoney in pairs(configs.ids) do
tab = getItemsInContainerById(corpse.uid, idmoney)
if #tab ~= 0 then
for _, uid in pairs(tab) do
money = getPlayerMoney(cid)
doPlayerRemoveMoney(cid, money)
doPlayerAddMoney(cid, money+item.type)
doRemoveItem(item.uid, item.type)
end
end
end
end
end
function onKill(cid, target)
if not isPremium(cid) and configs.premium then
return true
end
local pos = getCreaturePosition(target)
return addEvent(autoGold, 10, cid, pos, 1)
end
se quiser pode usar um que eu fiz aqui agora, tá mais limpo:
function onKill(cid, target)
if not isMonster(target) then return true end
local configs = {
ids = {2148, 2152, 2160, 7588, 7589, 7590, 7591, 7618, 7620, 8473},
premium = true -- só premium usar o auto loot ? [true ou false]
}
if configs.premium and not isPremium(cid) then return true end
local function gatherGold(cid, corpseId, corpsePosition)
if not isCreature(cid) then return end
local corpse = getTileItemById(corpsePosition, corpseId).uid
if corpse <= 1 or not isCorpse(corpse) then return end
local slot, corpseMoney = 0, 0
for times = 1, getContainerSize(corpse) do
local corpseItem = getContainerItem(corpse, slot)
if not isInArray(configs.ids, corpseItem.itemid) then
slot = slot + 1
else
corpseMoney = corpseMoney + corpseItem.type
doRemoveItem(corpseItem.uid)
end
end
corpseMoney = corpseMoney + getPlayerMoney(cid)
doPlayerRemoveMoney(cid, getPlayerMoney(cid))
doPlayerAddMoney(cid, corpseMoney)
end
local name, pos = getCreatureName(target), getThingPos(target)
addEvent(gatherGold, 10, cid, getMonsterInfo(name).lookCorpse, pos)
return true
end
info
Grupo: Campones
Registrado: 02/01/11
Posts: 11
Reputação: 0
Char no Tibia: Imperador de Além-Mar

Meu Server É - The OTX Server Version: (2.42 - 1404)
O Do Spoiler Não Funcionou T.T
Não Pegava Nada E Dava Esse Erro.
[29/11/2012 10:15:30] [Error - CreatureScript Interface]
[29/11/2012 10:15:30] In a timer event called from:
[29/11/2012 10:15:30] data/creaturescripts/scripts/autoloot.lua:onKill
[29/11/2012 10:15:30] Description:
[29/11/2012 10:15:30] data/creaturescripts/scripts/autoloot.lua:46: attempt to index global 'item' (a nil value)
[29/11/2012 10:15:30] stack traceback:
[29/11/2012 10:15:30] data/creaturescripts/scripts/autoloot.lua:46: in function 'autoGold'
[29/11/2012 10:15:30] data/creaturescripts/scripts/autoloot.lua:36: in function 'autoGold'
[29/11/2012 10:15:30] data/creaturescripts/scripts/autoloot.lua:36: in function 'autoGold'
[29/11/2012 10:15:30] data/creaturescripts/scripts/autoloot.lua:36: in function <data/creaturescripts/scripts/autoloot.lua:24>
[29/11/2012 10:15:31] [Error - CreatureScript Interface]
[29/11/2012 10:15:31] In a timer event called from:
[29/11/2012 10:15:31] domodlib('Loot_func')
[29/11/2012 10:15:31] function onDeath(cid, corpse, deathList)
[29/11/2012 10:15:31] local killer,pos = deathList[1],getCreaturePosition(cid)
[29/11/2012 10:15:31] addEvent(corpseRetireItems,1,killer,pos)
[29/11/2012 10:15:31] return true
[29/11/2012 10:15:31] end:onDeath
[29/11/2012 10:15:31] Description:
[29/11/2012 10:15:31] (LuaInterface::luaGetThing) Thing not found
[29/11/2012 11:1:10] [Error - CreatureScript Interface]
[29/11/2012 11:1:10] In a timer event called from:
[29/11/2012 11:1:10] data/creaturescripts/scripts/autoloot.lua:onKill
[29/11/2012 11:1:10] Description:
[29/11/2012 11:1:10] data/creaturescripts/scripts/autoloot.lua:46: attempt to index global 'item' (a nil value)
[29/11/2012 11:1:10] stack traceback:
[29/11/2012 11:1:11] data/creaturescripts/scripts/autoloot.lua:46: in function 'autoGold'
[29/11/2012 11:1:12] data/creaturescripts/scripts/autoloot.lua:36: in function <data/creaturescripts/scripts/autoloot.lua:24>
[29/11/2012 11:1:26] [Error - CreatureScript Interface]
[29/11/2012 11:1:26] In a timer event called from:
[29/11/2012 11:1:26] data/creaturescripts/scripts/autoloot.lua:onKill
[29/11/2012 11:1:26] Description:
[29/11/2012 11:1:26] data/creaturescripts/scripts/autoloot.lua:46: attempt to index global 'item' (a nil value)
[29/11/2012 11:1:26] stack traceback:
[29/11/2012 11:1:27] data/creaturescripts/scripts/autoloot.lua:46: in function 'autoGold'
[29/11/2012 11:1:27] data/creaturescripts/scripts/autoloot.lua:36: in function 'autoGold'
[29/11/2012 11:1:27] data/creaturescripts/scripts/autoloot.lua:36: in function <data/creaturescripts/scripts/autoloot.lua:24>
Vou Testar Agora O Seu! (TESTADO) ![]()
No Seu Script Ele Pega Apenas O Dinheiro, Os Potions Ele Faz Desaparecer (Some Do Loot E Não Aparece Da Backpack)
Tem Como Concertar? Achei Ótimo Seu Código!
*--*
PS:. Esse AutoGold Pega Potions Também ! ![]()
Editado Novembro 29 por LightTenshimaru
Bom, o erro que da nesse script do spoiler (o original do tópico) é um outro erro que tinha que eu não percebi antes e por isso não arrumei...
a parte de adicionar os itens ao player eu só copiei dos antigos, vou alterar pra deixar melhor, aqui está:
function onKill(cid, target)
if not isMonster(target) then return true end
local configs = {
ids = {2148, 2152, 2160, 7588, 7589, 7590, 7591, 7618, 7620, 8473},
premium = true -- só premium usar o auto loot ? [true ou false]
}
if configs.premium and not isPremium(cid) then return true end
local function gatherGold(cid, corpseId, corpsePosition)
if not isCreature(cid) then return end
local corpse = getTileItemById(corpsePosition, corpseId).uid
if corpse <= 1 or not isCorpse(corpse) then return end
local slot, corpseMoney = 0, 0
for times = 1, getContainerSize(corpse) do
local corpseItem = getContainerItem(corpse, slot)
if not isInArray(configs.ids, corpseItem.itemid) then
slot = slot + 1
else
local iInfo, removeItem = getItemInfo(corpseItem.itemid), true
if (iInfo.worth or 0) >= 1 then
corpseMoney = corpseMoney + (corpseItem.type * iInfo.worth)
else
removeItem = doPlayerAddItem(cid, corpseItem.itemid, math.max(corpseItem.type, 1), false)
end
if removeItem then
doRemoveItem(corpseItem.uid)
end
end
end
corpseMoney = corpseMoney + getPlayerMoney(cid)
doPlayerRemoveMoney(cid, getPlayerMoney(cid))
doPlayerAddMoney(cid, corpseMoney)
end
local name, pos = getCreatureName(target), getThingPos(target)
addEvent(gatherGold, 10, cid, getMonsterInfo(name).lookCorpse, pos)
return true
end
info
Grupo: Campones
Registrado: 02/01/11
Posts: 11
Reputação: 0
Char no Tibia: Imperador de Além-Mar

Cara Obrigadão!
Funcionou Do Jeito Que Eu Queria!
Só Tem Um Problema Com Alguns Monstros como "Dragonling" Que Ele Não Pega A Grana Apesar Deles Possuírem Corpse Normal!
Mas O Resto Está Perfeito!
Se Houver Como Concertar Isso Ficaria Muito Gradecido! ![]()
info
Grupo: Campones
Registrado: 02/01/11
Posts: 11
Reputação: 0
Char no Tibia: Imperador de Além-Mar
Estou com um problema e faz tempo que procuro a solução em diversos Forum's e não acho.
É o seguinte:
Tenho um script de "AutoGold" que funciona plenamente, só que quando mato monstros "sem corpse" como Slime e derivados ou Rift Worm ele trava meu servidor e fica aparecendo mensagens constantes uma atrás da outra assim.
"[Error - CreatureScript Interface]
In a timer event called from:
data/creaturescripts/scripts/autoloot.lua:onKill
Description:
(LuaInterface::luaGetThing) Thing not found"
Meu Script é esse:
local configs = { ids = {2148, 2152, 2160, 7588, 7589, 7590, 7591, 7618, 7620, 8473}, premium = true -- só premium usar o auto loot ? [true ou false] } function getItemsInContainerById(container, itemid) local items = {} if 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 autoGold(cid, pos, stack) if stack > 255 then return true end local position = {x = pos.x, y = pos.y, z = pos.z, stackpos = stack} local tile = getThingFromPos(position) if isCorpse(tile.uid) then corpse = tile else autoGold(cid, pos, stack + 1) end if corpse ~= nil then for _, idmoney in pairs(configs.ids) do tab = getItemsInContainerById(corpse.uid, idmoney) if #tab ~= 0 then for _, uid in pairs(tab) do money = getPlayerMoney(cid) doPlayerRemoveMoney(cid, money) doPlayerAddMoney(cid, money+item.type) doRemoveItem(item.uid, item.type) end end end end end function onKill(cid, target) if not isPremium(cid) and configs.premium then return true end return addEvent(autoGold, 10, cid, getCreaturePosition(target), 0) endMuito agradecido quem puder me ajudar...