---
name: "canAdd"
type: command
status: ok
groups: ["Unit Inventory"]
arma3_since: "0.70"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/canAdd
revid: 376862
updated: 2025-12-08T21:18:49Z
---

# canAdd

*Command · Unit Inventory · Arma 3 v0.70*

## Description

Checks if given object can be stored in inventory of given object or any inventory container ([uniform](../commands/uniform.md), [vest](../commands/vest.md), [backpack](../commands/backpack.md)) of given unit.

Before Arma 3 v2.10 this comment verified only the biggest container when multiple items were queried; now it checks all containers.

> [!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
object canAdd item
```

**Parameters:**

- `object`: [Object](../topics/Object.md) - unit or container
- `item`: [String](../topics/String.md) - config class

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

### Syntax 2

*since arma3 1.56*

```sqf
object canAdd [item, count, ignoreSoldierMaxLoad]
```

**Parameters:**

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

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

### Syntax 3

*since arma3 2.10*

```sqf
weapon canAdd item
```

**Parameters:**

- `weapon`: [String](../topics/String.md) - weapon class name
- `item`: [String](../topics/String.md) - config class of magazine or attachment

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

### Syntax 4

*since arma3 2.10*

```sqf
weapon canAdd [attachment, slot]
```

**Parameters:**

- `weapon`: [String](../topics/String.md) - weapon class name
- `attachment`: [String](../topics/String.md) - attachment class name
- `slot`: [String](../topics/String.md) - slot class name (defined under **WeaponSlotsInfo** class in weapon config), for example:
  - "CowsSlot" for optics
  - "MuzzleSlot" for silencers
  - "PointerSlot" for laser pointers and flashlights
  - "UnderBarrelSlot" for bipods

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

### Syntax 5

*since arma3 2.10*

```sqf
weapon canAdd [magazine, muzzle]
```

**Parameters:**

- `weapon`: [String](../topics/String.md) - weapon class name
- `magazine`: [String](../topics/String.md) - magazine class name
- `muzzle`: [String](../topics/String.md) - muzzle class name

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

## Examples

### Example 1

<sqf
>if (player canAdd "FirstAidKit") then
{
	player addItem "FirstAidKit";
}
else
{
	hint "Not enough space";
};
</sqf>

### Example 2

```sqf
if (_box canAdd "FirstAidKit") then
{
    _box addWeaponCargo ["FirstAidKit", 1];
}
else
{
    hint "Not enough space";
};
```

### Example 3

```sqf
car canAdd [currentWeapon player, 50];
```

### Example 4

```sqf
// check if attachment can be loaded
"arifle_Katiba_GL_F" canAdd "acc_pointer_IR";
"arifle_Katiba_GL_F" canAdd ["acc_pointer_IR", "PointerSlot"];
```

### Example 5

```sqf
// check if magazine can be loaded
"arifle_Katiba_GL_F" canAdd "30Rnd_65x39_caseless_green";
"arifle_Katiba_GL_F" canAdd ["30Rnd_65x39_caseless_green", "this"];
"arifle_Katiba_GL_F" canAdd ["1Rnd_SmokeRed_Grenade_shell", "EGLM"];
```

## See also

[canAddItemToBackpack](../commands/canAddItemToBackpack.md) · [canAddItemToUniform](../commands/canAddItemToUniform.md) · [canAddItemToVest](../commands/canAddItemToVest.md) · [compatibleMagazines](../commands/compatibleMagazines.md) · [compatibleItems](../commands/compatibleItems.md) · [compatibleWeapons](../commands/compatibleWeapons.md)

## Community notes

**Jonpas** — 2015-11-29

Can also be used on any object that has inventory, not only player inventory containers.

Where **_box** is **B_supplyCrate_F**:

```sqf
// empty
_box canAdd "FirstAidKit"; // returns true

// full
_box canAdd "FirstAidKit"; // returns false
```

---

**Demellion** — 2017-02-11

This can also be used as alternative to [canAddItemToBackpack](../commands/canAddItemToBackpack.md), [canAddItemToUniform](../commands/canAddItemToUniform.md), [canAddItemToVest](../commands/canAddItemToVest.md) where container might not be strictly defined. In some cases it might be a good optimisation for your code, where you also don't need to perform checks on which type of player container this is. Example:

```sqf
private _container = selectRandom [uniformContainer player, vestContainer player, backpackContainer player];
if (_container canAdd "Rangefinder") then
{
    _container addItemCargoGlobal ["Rangefinder", 1];
};
```

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