• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Item chest Action uniqueid 1624 with 1 backpack id 10518 and 42 backpack with 100 scarab coins found of 42 backpack

Enderlop

Banned User
Joined
Jan 10, 2024
Messages
93
Reaction score
16
This script is an action when there is no space in the inventory it sends a parcel with the items but it doesn't work in my case I want a package with 1 backpack id 10518 containing 42 internal backpacks inside the 1 with 100 scarab coins in the 42 backpacks

Lua:
function onUse(cid, item, frompos, item2, topos)
    if item.uid and getPlayerFreeCap(cid) > 2000 then
        local parcel = doCreateItemEx(ITEM_PARCEL, 1)
        if parcel ~= 0 then
            for i = 1, 42 do
                local innerBag = doCreateItemEx(10518, 1) -- Cria uma mochila interna
                if innerBag ~= 0 then
                    for j = 1, 100 do
                        doAddContainerItem(innerBag, 2159, 1) -- Adiciona 100 moedas Scarab na mochila interna
                    end
                    doAddContainerItem(parcel, innerBag) -- Adiciona a mochila interna no parcel
                else
                    doPlayerSendCancel(cid, "Falha ao criar mochila interna.")
                    return true
                end
            end
            local depot = getPlayerDepot(cid)
            if depot ~= nil then
                doPlayerSendMailByName(getCreatureName(cid), parcel, 1) -- Envia o parcel para o jogador
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você recebeu um parcel contendo 42 mochilas internas, cada uma contendo 100 Scarab Coins.")
            else
                doPlayerSendCancel(cid, "Você não possui um depot.")
            end
        else
            doPlayerSendCancel(cid, "Falha ao criar o parcel.")
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Seu inventário está cheio. Todos os itens foram enviados para o seu depot.")
        -- Caso o inventário esteja cheio, envia diretamente para o depot
        local depot = getPlayerDepot(cid)
        if depot ~= nil then
            for i = 1, 42 do
                local innerBag = doCreateItemEx(10518, 1)
                if innerBag ~= 0 then
                    for j = 1, 100 do
                        doAddContainerItem(innerBag, 2159, 1)
                    end
                    doAddContainerItem(depot, innerBag)
                else
                    doPlayerSendCancel(cid, "Falha ao criar mochila interna.")
                    return true
                end
            end
        else
            doPlayerSendCancel(cid, "Você não possui um depot.")
        end
    end
    return true
end
 
Back
Top