Ir para conteúdo

Featured Replies

Postado

                                                                                                                           BOA NOITE A TODOS DO TK!!

Preciso de uma ajudinha com um systema de Autoloot do Meu Projeto de Poketibia!

Eu Gostaria que alguem Pudese Fazer uma Pequena Modificação nele.

a modificação seria adicionar uma lista aonde iria bloquear de o autoloot puxar para pokebag.

Exemplo: Fire Stone

Se alguem puder fazer essa modificação Ja Agradeço!! Irei deixar o codigo para edição!

 

 

Spoiler

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getItemAttribute(item.uid, "corpseowner") ~= cid then
        return doPlayerSendCancel(cid, "You're not the owner.")
    end
    local items = {}
    for i = 0, getContainerSize(item.uid) do
        local it = getContainerItem(item.uid, i)
        if it.uid > 0 then
            table.insert(items, {it.itemid, it.type})
            doRemoveItem(it.uid)
        end
    end
    if #items > 0 then
        for k = 1, #items do
            local playerItem = getPlayerItemById(cid, true, items[k][1])
            if playerItem.uid > 0 then
                if (playerItem.type + items[k][2]) > 100 then
                    doPlayerAddItem(cid, items[k][1], (playerItem.type + items[k][2]) - 100)
                    doTransformItem(playerItem.uid, items[k][1], 100)
                else
                    doTransformItem(playerItem.uid, items[k][1], playerItem.type + items[k][2])
                end
            else
                doPlayerAddItem(cid, items[k][1], items[k][2])
            end
        end
        return true
    end
    doSetItemActionId(item.uid, 0)
    return false
end

 

Editado por El Reverso
Erros (veja o histórico de edições)

Resolvido por Lurk

Ir para solução
  • Respostas 26
  • Visualizações 1.5k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • @El Reverso não testei mas tenta ai, ve o que da   ---- REPOSTA EDITADA ---- esse é o script funcional, pra vcs n precisarem ir até a pag 2 p pegar o sistema funcionando local block

  • @El Reverso kkkkkkkkkkkkkkkkk comi umas 5 letras da palavra foi mal, troca if playerItem.uid > 0 and not isInArray(blocked_items,it.uid) then por   if playerItem.uid > 0 and not

  • @El Reverso troca também o if it.uid > 0 and not isInArray(blocked_items,it.uid) then por   if it.uid > 0 and not isInArray(blocked_items, item.uid) then

Postado

@El Reverso não testei mas tenta ai, ve o que da

 

---- REPOSTA EDITADA ----

esse é o script funcional, pra vcs n precisarem ir até a pag 2 p pegar o sistema funcionando

local blocked_items = {8413, 5726} -- adicione aqui os itens que vc quer bloquear separados por ,
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getItemAttribute(item.uid, "corpseowner") ~= cid then
        return doPlayerSendCancel(cid, "You're not the owner.")
    end
    local items = {}
    for i = 0, getContainerSize(item.uid) do
        local it = getContainerItem(item.uid, i)
        if it.uid > 0 and not isInArray(blocked_items,it.itemid) then
            table.insert(items, {it.itemid, it.type})
            doRemoveItem(it.uid)
        end
    end
    if #items > 0 then
        for k = 1, #items do
            local playerItem = getPlayerItemById(cid, true, items[k][1])
            if playerItem.uid > 0 then
                if (playerItem.type + items[k][2]) > 100 then
                    doPlayerAddItem(cid, items[k][1], (playerItem.type + items[k][2]) - 100)
                    doTransformItem(playerItem.uid, items[k][1], 100)
                else
                    doTransformItem(playerItem.uid, items[k][1], playerItem.type + items[k][2])
                end
            else
                doPlayerAddItem(cid, items[k][1], items[k][2])
            end
        end
        return true
    end
    doSetItemActionId(item.uid, 0)
    return false
end

Editado por Lurk (veja o histórico de edições)

Postado
  • Autor

@Gabrieldsadaxas boa tarde, desculpe a demora por responder irei testa-lo imediatamente!.

@Gabrieldsadaxas testei aqui amigo, ele coletou o loot normalmente, é ocorreu este erro na distro.

[12/08/2020 14:03:05] [Error - Action Interface] 
[12/08/2020 14:03:05] data/actions/scripts/autoloot.lua:onUse
[12/08/2020 14:03:05] Description: 
[12/08/2020 14:03:05] data/actions/scripts/autoloot.lua:17: attempt to index global 'it' (a nil value)
[12/08/2020 14:03:05] stack traceback:
[12/08/2020 14:03:05]     data/actions/scripts/autoloot.lua:17: in function <data/actions/scripts/autoloot.lua:2>

Postado

@El Reverso kkkkkkkkkkkkkkkkk comi umas 5 letras da palavra foi mal, troca

if playerItem.uid > 0 and not isInArray(blocked_items,it.uid) then

por

 

if playerItem.uid > 0 and not isInArray(blocked_items, playerItem.uid) then

e me diz o que rola

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo