Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Galera é o seguinte, estou com um autoloot no servidor, porem quando ligado ele só pega os itens que estão fora da bag de dentro do monstro, ou seja oque estiver dentro da bag que esta dentro do loot do monstro o autoloot ignora e não coleta o mesmo, uso TFS 0.4 tibia 8.6.

Segue o script abaixo

\/

Spoiler

local tabela = {}
local function getPlayerList(cid)
    local tab = {}
    if getPlayerStorageValue(cid, 0442002) ~= -1 then
        table.insert(tab, getPlayerStorageValue(cid, 0442002))
    end
    if getPlayerStorageValue(cid, 0442003) ~= -1 then
        table.insert(tab, getPlayerStorageValue(cid, 0442003))
    end
    if getPlayerStorageValue(cid, 0442004) ~= -1 then
        table.insert(tab, getPlayerStorageValue(cid, 0442004))
    end
    if getPlayerStorageValue(cid, 0442005) ~= -1 then
        table.insert(tab, getPlayerStorageValue(cid, 0442005))
    end
    if #tab > 0 then
        return tab
    end
    return false
end
local function autoLoot(cid, pos)
    local check = false
    local str = ""
    local position = {}
    for i = 1, 255 do
        pos.stackpos = i
        if getThingFromPos(pos).uid and getThingFromPos(pos).uid > 0 and isContainer(getThingFromPos(pos).uid) then
            position = pos
            check = true
            break
        end
    end
    if check then
        local corpse = getContainerItemsInfo(getThingFromPos(position).uid)        
        if corpse then
            for index, info in pairs(corpse) do
                if index < countTable(corpse) then
                        if tonumber(info.uid) and tonumber(info.itemid) then
                        if isContainer(info.uid) then
                            local bag = getContainerItemsInfo(info.uid)
                            for i = 1, countTable(bag) - 1 do
                                if isInArray(getPlayerList(cid), bag.itemid) then
                                    if bag.quant > 1 then
                                        doRemoveItem(bag.uid, bag.quant)
                                        doPlayerAddItem(cid, bag.itemid, bag.quant)
                                        str = str.." "..bag.quant.." "..getItemNameById(bag.itemid)..","
                                    else
                                        doRemoveItem(bag.uid)
                                        doPlayerAddItem(cid, bag.itemid, 1)
                                        str = str.." 1 "..getItemNameById(bag.itemid)..","
                                    end
                                end
                            end
                        end
                    end
                end
                if isInArray(getPlayerList(cid), info.itemid) then
                    if info.quant > 1 then
                        doRemoveItem(info.uid, info.quant)
                        doPlayerAddItem(cid, info.itemid, info.quant)
                        str = str.." "..info.quant.." "..getItemNameById(info.itemid)..","
                    else
                        doRemoveItem(info.uid)
                        doPlayerAddItem(cid, info.itemid, 1)
                        str = str.." 1 "..getItemNameById(info.itemid)..","
                    end
                end
            end
        end
    end
    tabela[getCreatureName(cid)] = {item = "[AutoLoot] Coletados: "..str, gold = 0}
end
local function autoGold(cid, pos)
    local check = false
    local total = 0
    local position = {}
    for i = 1, 255 do
        pos.stackpos = i
        if getThingFromPos(pos).uid and getThingFromPos(pos).uid > 0 and isContainer(getThingFromPos(pos).uid) then
            position = pos
            check = true
            break
        end
    end
    if check then
        local corpse = getContainerItemsInfo(getThingFromPos(position).uid)
        if corpse then
            for index, info in pairs(corpse) do
                if info.uid and info.itemid then
                    if index < countTable(corpse) then
                        if isContainer(info.uid) then
                            local bag = getContainerItemsInfo(info.uid)
                            for i = 1, countTable(bag) - 1 do
                                if isInArray({2148, 2152, 2160}, bag.itemid) then
                                    local multiplie = 1
                                    if bag.itemid == 2148 then
                                        multiplie = 1
                                    elseif bag.itemid == 2152 then
                                        multiplie = 100
                                    elseif bag.itemid == 2160 then
                                        multiplie = 10000
                                    end
                                    doRemoveItem(bag.uid, bag.quant)
                                    doPlayerSetBalance(cid, getPlayerBalance(cid) + (tonumber(bag.quant) and tonumber(bag.quant) * multiplie or 0))
                                    total = total + (tonumber(bag.quant) and tonumber(bag.quant) * multiplie or 0)
                                    doPlayerSetStorageValue(cid, 0442102, getPlayerStorageZero(cid, 0442102) + (tonumber(bag.quant) and tonumber(bag.quant) * multiplie or 0))
                                end
                            end
                        end
                    end
                    if isInArray({2148, 2152, 2160}, info.itemid) then
                        local multiplie = 1
                        if info.itemid == 2148 then
                            multiplie = 1
                        elseif info.itemid == 2152 then
                            multiplie = 100
                        elseif info.itemid == 2160 then
                            multiplie = 10000
                        end
    doRemoveItem(info.uid, info.quant)
                        doPlayerSetBalance(cid, getPlayerBalance(cid) + (tonumber(info.quant) and tonumber(info.quant) * tonumber(multiplie) or 0))
                        doPlayerSetStorageValue(cid, 0442102, getPlayerStorageZero(cid, 0442102) + (tonumber(info.quant) and tonumber(info.quant) * tonumber(multiplie) or 0))
                        total = total + (tonumber(info.quant) and tonumber(info.quant) * multiplie or 0)
                    end
                end
            end
        end
    end
    if tabela[getCreatureName(cid)] and tabela[getCreatureName(cid)].gold then
        tabela[getCreatureName(cid)].gold = total
    end
end
local function sendMsg(cid)
    if tabela[getCreatureName(cid)] and tabela[getCreatureName(cid)].gold then
        if tabela[getCreatureName(cid)].gold == 0 then
            doPlayerSendTextMessage(cid, 23, tabela[getCreatureName(cid)].item)
        else
            doPlayerSendTextMessage(cid, 23, tabela[getCreatureName(cid)].item.." "..tabela[getCreatureName(cid)].gold.." gold coins.")
        end
        tabela[getCreatureName(cid)] = nil
    end
end
function onKill(cid, target, lastHit)
    if isPlayer(cid) and isMonster(target) then
        if getPlayerStorageValue(cid, 0442100) == 1 and getPlayerList(cid) then
            local pos = getCreaturePosition(target)
            addEvent(autoLoot, 500, cid, pos)
        end
        if getPlayerStorageValue(cid, 0442101) == 1 then
            local pos = getCreaturePosition(target)
            addEvent(autoGold, 500, cid, pos)
        end
        if getPlayerStorageValue(cid, 0442100) == 1 or getPlayerStorageValue(cid, 0442101) == 1 then
            addEvent(sendMsg, 540, cid)
        end
    end
    return true
end

 

Editado por patrick323 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

@patrick323, algum erro na distro? Já testei esse script e ele funciona perfeitamente, incluindo a parte que não está funcionando com você.

Link para o post
Compartilhar em outros sites
15 horas atrás, Wakon disse:

@patrick323, algum erro na distro? Já testei esse script e ele funciona perfeitamente, incluindo a parte que não está funcionando com você.

pior que não da nem um erro no distro, ele simplesmente ignora a BAG dentro do monstro com oque esta dentro.. itens gold..

Link para o post
Compartilhar em outros sites
5 horas atrás, Wakon disse:

wakon, primeiramente  muito obrigado por estar ajudando aqui. Edit kra funcionou, só tem q relogar para começar a pegar as coisas na bag.. vlw kra pela ajuda.

Editado por patrick323
Resolvido! (veja o histórico de edições)
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