---
name: "canAddItemToBackpack"
type: command
status: ok
groups: ["Containers"]
arma3_since: "1.04"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/canAddItemToBackpack
revid: 369124
updated: 2024-09-03T10:33:08Z
---

# canAddItemToBackpack

*Command · Containers · Arma 3 v1.04*

## Description

Checks if given object can be stored into soldier's backpack.

> [!IMPORTANT]
> Avoid passing an empty string `""` to this command as it will create a warning dialog:
>
> This message will show once per mission restart.

## Syntax

### Syntax 1

```sqf
unit canAddItemToBackpack item
```

**Parameters:**

- `unit`: [Object](../topics/Object.md)
- `item`: [String](../topics/String.md)

**Returns:** [Boolean](../topics/Boolean.md)

### Syntax 2

*since arma3 1.56*

```sqf
unit canAddItemToBackpack [item, count, ignoreSoldierMaxLoad]
```

**Parameters:**

- `unit`: [Object](../topics/Object.md)
- `item`: [String](../topics/String.md)
- `count`: [Number](../topics/Number.md)
- `ignoreSoldierMaxLoad`: [Boolean](../topics/Boolean.md) - (Optional, default [false](../commands/false.md)) [true](../commands/true.md) to ignore 'soldierMaxLoad' param, container [maxLoad](../commands/maxLoad.md) is still counted. *(since arma3 2.18)*

**Returns:** [Boolean](../topics/Boolean.md)

## Examples

### Example 1

```sqf
if (player canAddItemToBackpack "HandGrenade") then { player addItemToBackpack _item } else { hint "no room!" };
```

## See also

[canAdd](../commands/canAdd.md) · [canAddItemToUniform](../commands/canAddItemToUniform.md) · [canAddItemToVest](../commands/canAddItemToVest.md) · [backpackContainer](../commands/backpackContainer.md) · [firstBackpack](../commands/firstBackpack.md) · [unitBackpack](../commands/unitBackpack.md) · [backpack](../commands/backpack.md) · [backpackCargo](../commands/backpackCargo.md) · [getBackpackCargo](../commands/getBackpackCargo.md) · [backpackItems](../commands/backpackItems.md) · [addBackpack](../commands/addBackpack.md) · [addBackpackCargo](../commands/addBackpackCargo.md) · [addBackpackCargoGlobal](../commands/addBackpackCargoGlobal.md) · [removeBackpack](../commands/removeBackpack.md) · [clearBackpackCargo](../commands/clearBackpackCargo.md) · [clearBackpackCargoGlobal](../commands/clearBackpackCargoGlobal.md) · [clearAllItemsFromBackpack](../commands/clearAllItemsFromBackpack.md) · [loadBackpack](../commands/loadBackpack.md) · [backpackSpaceFor](../commands/backpackSpaceFor.md) · [addItemToBackpack](../commands/addItemToBackpack.md) · [removeItemFromBackpack](../commands/removeItemFromBackpack.md) · [everyBackpack](../commands/everyBackpack.md)

## Community notes

**AgentRev** — 2022-03-29

This command is very unreliable, along with all other [canAdd](../commands/canAdd.md) commands. For example, in the inventory screen, an empty `"B_Bergen_dgtl_F"` backpack can fit a total of 30 `"5Rnd_127x108_APDS_Mag"` mags. However, `player canAddItemToBackpack "5Rnd_127x108_APDS_Mag"` starts returning [false](../commands/false.md) once there are 17 in the backpack. Furthermore, if the player has equipped an empty PCML launcher (without any missile in his inventory), the command starts returning [false](../commands/false.md) once there are only 11, despite the fact that the launcher has no effect on backpack space...

I wrote a function almost 9 years ago to bypass this (surprisingly still existing) bug. You can check it [here](https://github.com/A3Wasteland/ArmA3_Wasteland.Altis/blob/dev/client/functions/fn_fitsInventory.sqf), with a usage example [here](https://github.com/A3Wasteland/ArmA3_Wasteland.Altis/blob/dc41623f154d6c5be683374784aba201a0628e60/client/functions/addWeaponInventory.sqf#L18-L20).

<sub>Source: [BI Community Wiki — canAddItemToBackpack](https://community.bistudio.com/wiki/canAddItemToBackpack) (revision 369124).</sub>
