Ir para conteúdo
  • Cadastre-se

Normal Tfs 1.2 Delete items em player_items, player_depotitems


Posts Recomendados

32 minutos atrás, luanluciano93 disse:

 

resolved then?

do you think you can help me convert this function to tfs 1.2?

 

function getAllItemsById(cid, id)
    local containers = {}
    local items = {}
   
    for i = CONST_SLOT_FIRST, CONST_SLOT_LAST do
        local sitem = getPlayerSlotItem(cid, i)
        if sitem.uid > 0 then
            if isContainer(sitem.uid) then
                table.insert(containers, sitem.uid)
            elseif not(id) or id == sitem.itemid then
                table.insert(items, sitem)
            end
        end
    end
 
    while #containers > 0 do
        for k = (getContainerSize(containers[1]) - 1), 0, -1 do
            local tmp = getContainerItem(containers[1], k)
            if isContainer(tmp.uid) then
                table.insert(containers, tmp.uid)
            elseif not(id) or id == tmp.itemid then
                table.insert(items, tmp)
            end
        end
        table.remove(containers, 1)
    end
 
    return items
end

 

It will return an array with the items. Example:

Code (Text):
  1. for _, item in pairs(getAllItemsById(cid, 2222)) do
  2.     doPlayerSay(cid, "I got an item with id " .. item.itemid .. ".")
  3. end
Link para o post
Compartilhar em outros sites
function Player.getAllItemsById(self, id)
    local containers = {}
    local items = {}
   
    for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
		local item = self:getSlotItem(i)
        if item then
            if item:isContainer() then
                table.insert(containers, item:getUniqueId())
            elseif not id or id == item:getId() then
                table.insert(items, item:getUniqueId())
            end
        end
    end
 
    while #containers > 0 do
        for k = (Container(containers[1]):getSize() - 1), 0, -1 do
            local tmp = Container(containers[1]):getItem(k)
            if tmp:isContainer() then
                table.insert(containers, tmp:getUniqueId())
            elseif not id or id == tmp:getId() then
                table.insert(items, tmp:getUniqueId())
            end
        end
        table.remove(containers, 1)
    end
 
    return items
end

 

Link para o post
Compartilhar em outros sites
36 minutos atrás, luanluciano93 disse:

function Player.getAllItemsById(self, id)
    local containers = {}
    local items = {}
   
    for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
		local item = self:getSlotItem(i)
        if item then
            if item:isContainer() then
                table.insert(containers, item:getUniqueId())
            elseif not id or id == item:getId() then
                table.insert(items, item:getUniqueId())
            end
        end
    end
 
    while #containers > 0 do
        for k = (Container(containers[1]):getSize() - 1), 0, -1 do
            local tmp = Container(containers[1]):getItem(k)
            if tmp:isContainer() then
                table.insert(containers, tmp:getUniqueId())
            elseif not id or id == tmp:getId() then
                table.insert(items, tmp:getUniqueId())
            end
        end
        table.remove(containers, 1)
    end
 
    return items
end

 

 

 

i try this:

 

function getAllItemsById(self, id)
    local containers = {}
    local items = {}
   
    for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
		local item = self:getSlotItem(i)
        if item then
            if item:isContainer() then
                table.insert(containers, item:getUniqueId())
            elseif not id or id == item:getId() then
                table.insert(items, item:getUniqueId())
            end
        end
    end
 
    while #containers > 0 do
        for k = (Container(containers[1]):getSize() - 1), 0, -1 do
            local tmp = Container(containers[1]):getItem(k)
            if tmp:isContainer() then
                table.insert(containers, tmp:getUniqueId())
            elseif not id or id == tmp:getId() then
                table.insert(items, tmp:getUniqueId())
            end
        end
        table.remove(containers, 1)
    end
 
    return items
end

function onSay(player, words, param)
for _, item in pairs(getAllItemsById(player, 12571)) do
	player:sendTextMessage(messageType or MESSAGE_STATUS_CONSOLE_ORANGE, 'I got an item with id ' .. item.itemid .. '.')
end
end

 

 

 

image.png

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por Jaurez
      .
    • Por Cat
      Em alguns casos, o tibia 8.60 comum não abre de jeito nenhum no map editor, mesmo desmarcando check file signatures e configurando o path corretamente.
       
      Este é o client 8.60 adaptado para o Remere's Map Editor. Resolvi postar já que ele foi removido do site oficial do RME. (ficou apenas a versão para linux lá)
      Se estiver tendo problemas para abrir a versão 8.60, tente utilizar este.
                                                                                                                     
      Baixar o Tibia Client 8.60 que funciona no Remere’s Map Editor
      Essa versão do Tibia 8.60 client resolve o erro unsupported client version ou Could not locate tibia.dat and/or tibia.spr, please navigate to your tibia 8.60 installation folder.
       
      Downloads
      https://tibiaking.com/applications/core/interface/file/attachment.php?id=47333

      Scan: https://www.virustotal.com/gui/file/333e172ac49ba2028db9eb5889994509e7d2de28ebccfa428c04e86defbe15cc
       
    • Por danilo belato
      Fala Galera To Com um problema aki 
       
      quero exporta umas sprites de um server para colocar em outro 
       
      eu clico na sprites ai aparece tds a forma delas do lado de la >>
       
      ai eu clico nela e ponho a opiçao de export mais quando salvo a sprite ela n abri 
       
      aparece isso quando tento vê-la 
       
      visualização não disponível ( no formatos png e bitmap)
       
      Agora no formato idc fala que o paint n pode ler 
       
      me ajudem ae...
    • Por Vitor Bicaleto
      Galera to com o script do addon doll aqui, quando eu digito apenas "!addon" ele aparece assim: Digite novamente, algo está errado!"
      quando digito por exemplo: "!addon citizen" ele não funciona e não da nenhum erro
       
      mesma coisa acontece com o mount doll.. 
    • Por Ayron5
      Substitui uma stone no serve, deu tudo certo fora  esse  erro ajudem  Valendo  Rep+  Grato  

      Erro: data/actions/scripts/boost.lua:557: table index is nil
       [Warning - Event::loadScript] Cannot load script (data/actions/scripts/boost.lua)

      Script:
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo