• 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!

C++ Check if backpack is full

skic

Member
Joined
Aug 15, 2020
Messages
58
Reaction score
11
Hey guys, I'm using this code to auto loot items.
Lua:
uint32_t corpseOwner = container->getCorpseOwner();
        if (corpseOwner != 0 && !player->canOpenCorpse(corpseOwner)) {
            return RETURNVALUE_YOUARENOTTHEOWNER;
        }
        else {
            if (player->autoLootList.size() != 0) {
                if (player->getCapacity() > 100 * 100) { //Minimum of Capacity for autoloot works. (100 CAP)
                    for (Item* item : container->getItemList()) {
                        if (player->getItemFromAutoLoot(item->getID())) {
                            std::ostringstream msgAutoLoot;
                            msgAutoLoot << "You looted a " << item->getItemCount() << "x " << item->getName() << ".";
                            g_game.internalMoveItem(container, player, CONST_SLOT_WHEREEVER, item, item->getItemCount(), nullptr);
                            player->sendTextMessage(MESSAGE_INFO_DESCR, msgAutoLoot.str());
                        }
                    }
                }
                else {
                    player->sendTextMessage(MESSAGE_INFO_DESCR, "Sorry, you don't have enough capacity to use auto loot, so it has been disabled. (100+ capacity is required)");
                }
            }
        }

Can someone explain me how I can check if backpack is full before doing internalMoveItem?
 
Top