---
name: "lock"
type: command
status: ok
groups: ["Object Manipulation"]
arma3_since: "0.50"
locality: {"argument": "local", "effect": "global", "server_exec": false}
source: https://community.bistudio.com/wiki/lock
revid: 353298
updated: 2024-03-15T17:11:43Z
---

# lock

*Command · Object Manipulation · Arma 3 v0.50 · introduced in Operation Flashpoint v1.00*

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

## Description

Lock vehicle (disable mounting / dismounting) for player.
This command will remove user get in/get out actions but will not stop player getting into or out of vehicle via script commands (e.g [moveInCargo](../commands/moveInCargo.md)).

> [!NOTE]
> Alternative syntax is similar to [setVehicleLock](../commands/setVehicleLock.md) but with numbers.

## Syntax

### Syntax 1

```sqf
vehicleName lock locked
```

**Parameters:**

- `vehicleName`: [Object](../topics/Object.md)
- `locked`: [Boolean](../topics/Boolean.md) - [true](../commands/true.md) to lock, [false](../commands/false.md) to unlock

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

### Syntax 2

*since arma3 0.50*

```sqf
vehicleName lock lockstate
```

**Parameters:**

- `vehicleName`: [Object](../topics/Object.md)
- `lockstate`: [Number](../topics/Number.md) - can be one of the following:

  0 - Unlocked

  1 - Default (player subordinate cannot enter until his leader says so)

  2 - Locked

  3 - Locked for player

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

## Examples

### Example 1

```sqf
_jeepOne lock true;
```

### Example 2

```sqf
heli lock true;
locked heli; // 2

heli lock false;
locked heli; // 0

heli lock 1;
locked heli; // 1
```

## See also

[locked](../commands/locked.md) · [setVehicleLock](../commands/setVehicleLock.md) · [lockDriver](../commands/lockDriver.md) · [lockCargo](../commands/lockCargo.md) · [lockTurret](../commands/lockTurret.md)

## Community notes

**Tankbuster** — 2010-01-09

Lock prevents AI persons mounting or dismounting vehicles when ordered to do so and players are prevented from doing both too, but AI will still dismount when a vehicle is damaged.

---

**cali** — 2010-09-22

If an AI group (e.g Mechanized Infantry) has its vehicle locked with its crew in it, it will mount or dismount it anyway. But a player in this group won't be able to enter the vehicle.

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