---
name: "lockInventory"
type: command
status: ok
groups: ["Unit Inventory"]
arma3_since: "2.00"
locality: {"argument": "global", "effect": "local", "server_exec": false}
source: https://community.bistudio.com/wiki/lockInventory
revid: 370883
updated: 2025-02-21T10:44:04Z
---

# lockInventory

*Command · Unit Inventory · Arma 3 v2.00*

Locality: arguments **global** · effect **local**

## Description

Lock or unlock a vehicle's inventory access.
This command can also lock backpack a unit is wearing to prevent access by a third party.
If set to [true](../commands/true.md) (locked), the inventory cannot be accessed via hotkey or action menu.

## Syntax

```sqf
vehicle lockInventory lock
```

**Parameters:**

- `vehicle`: [Object](../topics/Object.md)
- `lock`: [Boolean](../topics/Boolean.md)

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

## Examples

### Example 1

```sqf
vehicle player lockInventory true;
```

### Example 2

```sqf
backpackContainer player lockInventory true;
```

## See also

[lockedInventory](../commands/lockedInventory.md)

## Community notes

**PierreMGI**

This command works only on alive unit. No matter you run it before or after death, on due [backpackContainer](../commands/backpackContainer.md) unit, the backpack will be accessible on corpse.

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