Ir para conteúdo

Featured Replies

Postado

Salve rapaziada, estou tento um problema com esse autoloot, ele funciona 100%, mas quando voce tenta adicionar um item que não existe ou erro nome do item, tipo "demom reumit" como não existe, ele da uma mensagem no jogo dizendo que não existe, mas da um erro na distro.
 

[Error - TalkAction Interface]
data/talkactions/scripts/autoloot.lua:onSay
Description:
(luaGetItemIdByName) Item not found


LIB
 

Spoiler

STORAGE_AUTOLOOTMESSAGE = 31009
STORAGE_AUTOLOOT = {7575, 7576, 7577, 7578, 7579}
STORAGE_AUTOLOOTLIMIT = 5

function getContents(uid)
   local loot, i = {}, 0

   while i < getContainerSize(uid) do
      local v = getContainerItem(uid, i)
      table.insert(loot, v)
      i = i + 1
   end

   return loot
end

function getAutolootList(cid)
   local list, v, count = {}, 0, 0
   for _, k in ipairs(STORAGE_AUTOLOOT) do
      v = getPlayerStorageValue(cid, k)
      if v > 0 then
         count = count + 1
      end
      table.insert(list, v)
   end
   return list, count
end

function AutolootLootItem(cid, item, msg)
   local Item = item
   local count = Item.type
   if count < 1 then
      count = 1
   end
   doRemoveItem(item.uid)
   doPlayerAddItem(cid, Item.itemid, count)
   Item = getItemNameById(Item.itemid)
   if msg then
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg..count.." "..Item)
   end
end

function isAutolootShowEnabled(cid)
   return getPlayerStorageValue(cid,STORAGE_AUTOLOOTMESSAGE) and 1
end

function AutolootToggleShow(cid)
   if getPlayerStorageValue(cid, STORAGE_AUTOLOOTMESSAGE) == -1 then
      setPlayerStorageValue(cid, STORAGE_AUTOLOOTMESSAGE, 1)
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Showing autoloot.")
   else
      setPlayerStorageValue(cid, STORAGE_AUTOLOOTMESSAGE, -1)
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Hiding autoloot.")
   end
end

function AutolootPrint(cid, msg)
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg)
end

function AutolootPrintItems(cid, items, bullet)
   for _, v in ipairs(items) do
      if v > 0 then
         AutolootPrint(cid, bullet..getItemNameById(v))
      end
   end
end

function AutolootAddItem(cid, item, name)
   for _,v in ipairs(STORAGE_AUTOLOOT) do
      if getPlayerStorageValue(cid, v) == -1 then
         setPlayerStorageValue(cid, v, item)
         AutolootPrint(cid, ">>"..name.."<< added to autoloot. Slot:".._)
         break
      end
   end
end

function AutolootRemoveItem(cid, item, name)
   for _,v in ipairs(STORAGE_AUTOLOOT) do
      if getPlayerStorageValue(cid, v) == item then
         setPlayerStorageValue(cid, v, -1)
         AutolootPrint(cid, ">>"..name.."<< removed from autoloot.")
         break
      end
   end
end

function AutolootClean(cid)
   for _, k in ipairs(STORAGE_AUTOLOOT) do
      setPlayerStorageValue(cid, k, -1)
   end
end

function AutolootGetItemFromParam(rest)
   local item = tonumber(rest)
   local name = getItemIdByName(rest)
   local err = false
   if item then
      -- AutolootPrint(cid, "Data triggered by Item: ".. item)
   elseif name then
      item = name
      -- AutolootPrint(cid, "Data triggered by Name: ".. name)
   else
      err = "Not valid item."
   end

   if isItemContainer(item) then
      err = "This item can not be autolooted."
   end

   if not isItemMoveable(item) then
      err = "This item can not be autolooted."
   end
   return item, err
end

 

 

Talkactions

Spoiler

local limit = 5

function onSay(cid, words, param)
   if param == "" then
      AutolootToggleShow(cid)
      return false
   end

   local help = "Help"
   local expl = string.explode(param, ':')
   local action, rest = expl[1], expl[2]
   -- doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Param: ".. param)
   -- doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "1: "..expl[1].." 2: ".. expl[2])

   local lootList, Items = getAutolootList(cid)

   local bulletItem = "----->"
   if (action:lower() == "list") then
      AutolootPrint(cid, "Autoloot list: ("..Items..") Items.")
      AutolootPrintItems(cid, lootList, bulletItem)
      return false
   elseif (action:lower() == "clean") then
      AutolootClean(cid)
      AutolootPrint(cid, "Autoloot list cleaned.")
      return false
   else
      if not rest then
         AutolootPrint(cid, help)
         return false
      end

      local item, err = AutolootGetItemFromParam(rest)
      if err then
         AutolootPrint(cid, err)
         return false
      end

      local name = getItemNameById(item)
      if (action:lower() == "add") then
         if (Items >= limit) then
            AutolootPrint(cid, "You already have " .. limit .. " autolooting items.")
            return false
         end

         if isInArray(lootList, item) then
            AutolootPrint(cid, "This item is already in your list.")
            return false
         end

         AutolootAddItem(cid, item, name)
      elseif (action:lower() == "remove") then
         if (Items < 1) then
            AutolootPrint(cid, "You dont have any item added.")
            return false
         end

         if not isInArray(lootList, item) then
            AutolootPrint(cid, ">>"..name.."<< is not in the list.")
            return false
         end

         AutolootRemoveItem(cid, item, name)
      end
   end
   return false
end

 


 

       112674.gif

 

 

 

Postado
15 horas atrás, Ackerzin disse:

Salve rapaziada, estou tento um problema com esse autoloot, ele funciona 100%, mas quando voce tenta adicionar um item que não existe ou erro nome do item, tipo "demom reumit" como não existe, ele da uma mensagem no jogo dizendo que não existe, mas da um erro na distro.
 


[Error - TalkAction Interface]
data/talkactions/scripts/autoloot.lua:onSay
Description:
(luaGetItemIdByName) Item not found


LIB
 

  Mostrar conteúdo oculto


STORAGE_AUTOLOOTMESSAGE = 31009
STORAGE_AUTOLOOT = {7575, 7576, 7577, 7578, 7579}
STORAGE_AUTOLOOTLIMIT = 5

function getContents(uid)
   local loot, i = {}, 0

   while i < getContainerSize(uid) do
      local v = getContainerItem(uid, i)
      table.insert(loot, v)
      i = i + 1
   end

   return loot
end

function getAutolootList(cid)
   local list, v, count = {}, 0, 0
   for _, k in ipairs(STORAGE_AUTOLOOT) do
      v = getPlayerStorageValue(cid, k)
      if v > 0 then
         count = count + 1
      end
      table.insert(list, v)
   end
   return list, count
end

function AutolootLootItem(cid, item, msg)
   local Item = item
   local count = Item.type
   if count < 1 then
      count = 1
   end
   doRemoveItem(item.uid)
   doPlayerAddItem(cid, Item.itemid, count)
   Item = getItemNameById(Item.itemid)
   if msg then
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg..count.." "..Item)
   end
end

function isAutolootShowEnabled(cid)
   return getPlayerStorageValue(cid,STORAGE_AUTOLOOTMESSAGE) and 1
end

function AutolootToggleShow(cid)
   if getPlayerStorageValue(cid, STORAGE_AUTOLOOTMESSAGE) == -1 then
      setPlayerStorageValue(cid, STORAGE_AUTOLOOTMESSAGE, 1)
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Showing autoloot.")
   else
      setPlayerStorageValue(cid, STORAGE_AUTOLOOTMESSAGE, -1)
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Hiding autoloot.")
   end
end

function AutolootPrint(cid, msg)
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg)
end

function AutolootPrintItems(cid, items, bullet)
   for _, v in ipairs(items) do
      if v > 0 then
         AutolootPrint(cid, bullet..getItemNameById(v))
      end
   end
end

function AutolootAddItem(cid, item, name)
   for _,v in ipairs(STORAGE_AUTOLOOT) do
      if getPlayerStorageValue(cid, v) == -1 then
         setPlayerStorageValue(cid, v, item)
         AutolootPrint(cid, ">>"..name.."<< added to autoloot. Slot:".._)
         break
      end
   end
end

function AutolootRemoveItem(cid, item, name)
   for _,v in ipairs(STORAGE_AUTOLOOT) do
      if getPlayerStorageValue(cid, v) == item then
         setPlayerStorageValue(cid, v, -1)
         AutolootPrint(cid, ">>"..name.."<< removed from autoloot.")
         break
      end
   end
end

function AutolootClean(cid)
   for _, k in ipairs(STORAGE_AUTOLOOT) do
      setPlayerStorageValue(cid, k, -1)
   end
end

function AutolootGetItemFromParam(rest)
   local item = tonumber(rest)
   local name = getItemIdByName(rest)
   local err = false
   if item then
      -- AutolootPrint(cid, "Data triggered by Item: ".. item)
   elseif name then
      item = name
      -- AutolootPrint(cid, "Data triggered by Name: ".. name)
   else
      err = "Not valid item."
   end

   if isItemContainer(item) then
      err = "This item can not be autolooted."
   end

   if not isItemMoveable(item) then
      err = "This item can not be autolooted."
   end
   return item, err
end

 

 

Talkactions

  Mostrar conteúdo oculto


local limit = 5

function onSay(cid, words, param)
   if param == "" then
      AutolootToggleShow(cid)
      return false
   end

   local help = "Help"
   local expl = string.explode(param, ':')
   local action, rest = expl[1], expl[2]
   -- doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Param: ".. param)
   -- doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "1: "..expl[1].." 2: ".. expl[2])

   local lootList, Items = getAutolootList(cid)

   local bulletItem = "----->"
   if (action:lower() == "list") then
      AutolootPrint(cid, "Autoloot list: ("..Items..") Items.")
      AutolootPrintItems(cid, lootList, bulletItem)
      return false
   elseif (action:lower() == "clean") then
      AutolootClean(cid)
      AutolootPrint(cid, "Autoloot list cleaned.")
      return false
   else
      if not rest then
         AutolootPrint(cid, help)
         return false
      end

      local item, err = AutolootGetItemFromParam(rest)
      if err then
         AutolootPrint(cid, err)
         return false
      end

      local name = getItemNameById(item)
      if (action:lower() == "add") then
         if (Items >= limit) then
            AutolootPrint(cid, "You already have " .. limit .. " autolooting items.")
            return false
         end

         if isInArray(lootList, item) then
            AutolootPrint(cid, "This item is already in your list.")
            return false
         end

         AutolootAddItem(cid, item, name)
      elseif (action:lower() == "remove") then
         if (Items < 1) then
            AutolootPrint(cid, "You dont have any item added.")
            return false
         end

         if not isInArray(lootList, item) then
            AutolootPrint(cid, ">>"..name.."<< is not in the list.")
            return false
         end

         AutolootRemoveItem(cid, item, name)
      end
   end
   return false
end

 


 

 

E você queria que fizesse o que? O erro que mostra na distro é justamente pq o item não existe.  "Item not found" = "Item não encontrado".

Contribuições:
 

=> Distribuições/Servidores

  1. [8.60] The Forgotten Server 1.3 (COMPILADO WIN x64)

 

=> Scripts/Códigos/Tutoriais

  1. Pokemon pescado aparece em volta do seu pokemon
  2. [Gesior]Dobrar pontos PagSeguro a partir de x valor doado

 

 Gostou de alguma contribuição? Rep +?

Postado
  • Autor
36 minutos atrás, Rayo disse:

E você queria que fizesse o que? O erro que mostra na distro é justamente pq o item não existe.  "Item not found" = "Item não encontrado".

 

Ué, eu queria que não desse erro na distro né, ja mostra a mensagem pro player, que o item não existe, queria que n desse nada na distro, que é o certo!

       112674.gif

 

 

 

Postado
25 minutos atrás, Ackerzin disse:

Ué, eu queria que não desse erro na distro né, ja mostra a mensagem pro player, que o item não existe, queria que n desse nada na distro, que é o certo!

 

Não tem como, esse erro que dá na distro já é uma forma de informar ao administrador.  É uma mensagem gerada e tratada na própria source do projeto. Séria algum "bug" se aparecesse o "stacktrace" que é uma espécie de Debug para informar que há algo errado dentro da distribuição (c++).

 

Nem tudo que se informa na distro é bug ou error.

Contribuições:
 

=> Distribuições/Servidores

  1. [8.60] The Forgotten Server 1.3 (COMPILADO WIN x64)

 

=> Scripts/Códigos/Tutoriais

  1. Pokemon pescado aparece em volta do seu pokemon
  2. [Gesior]Dobrar pontos PagSeguro a partir de x valor doado

 

 Gostou de alguma contribuição? Rep +?

Postado
  • Autor
5 horas atrás, Rayo disse:

Não tem como, esse erro que dá na distro já é uma forma de informar ao administrador.  É uma mensagem gerada e tratada na própria source do projeto. Séria algum "bug" se aparecesse o "stacktrace" que é uma espécie de Debug para informar que há algo errado dentro da distribuição (c++).

 

Nem tudo que se informa na distro é bug ou error.

 

Se o player por na HK !autoloot add, penis, vai aparecer tanto erro na distro que vai derrubar o servidor, esse erro na distro ja vi varios topicos aqui arrumando, em outros autoloot, vou postar aqui um, e ja arrumaram no meu outro autoloot, mas n consegui passar pra esse que uso agora, "e era o mesmo erro".

Como você pode ver nesse topico o rapaz estava com o mesmo erro que o meu, e o @Vodkart fez uma função pra puxar direto do items.xml

 

       112674.gif

 

 

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo