# Setting up door locks in FiveM with ox_doorlock

> Set up door locks on a FiveM server: create doors in game with ox_doorlock, grant access by job, item or passcode, and see how qb-doorlock differs from it.

Source: https://fam-tools.com/guides/fivem-doorlock-setup · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 11 min

**Short answer.** ox_doorlock lets staff create doors in game with the `/doorlock` command and stores them in the database, with access by groups (job and minimum grade), items, a passcode or lockpicking, plus auto-lock, double doors and gates. qb-doorlock defines doors in config files. In both, the door’s state is synced by the server, so everyone sees the same lock.

## Key points

- Door state is **server-synced** — a door is locked for everyone or no one.
- ox_doorlock: create doors in game with `/doorlock` (needs permission); stored in the database.
- Access can be a job and grade, an item (keycard), a passcode, or lockpicking.
- Double doors and gates are single entries with two doors or a sliding door.
- Most “door won’t lock” issues are a wrong model or position — recreate the door.

ox_doorlock and qb-doorlock are the two door lock resources most FiveM servers run, and they take opposite approaches: one creates doors from an in-game menu, the other from config files. Locked doors are what make a police station, a bank vault or a gang's clubhouse feel like a place with rules. Both sync each door's state across all players and decide who may open it — by job, grade, item or passcode — and the concepts carry over to any other.

## How door locks work

A door in GTA V is an object with a model and a position. A door lock resource registers that door with the game’s door system, keeps its locked state on the server and tells every client whether it is locked. Opening it checks the player’s access on the server, then updates everyone.

## ox_doorlock

1. Install ox_doorlock with its dependencies (ox_lib, oxmysql) and start it after them.
2. Give staff the permission for its command (the command is restricted by ACE).
3. In game, stand at the door and run `/doorlock` to open the creation interface.
4. Select the door (or both leaves of a double door), set a name, and choose access: groups with minimum grades, items, a passcode.
5. Set options such as auto-lock time, lockpicking and whether the door starts locked, then save.

| Option | Use |
| --- | --- |
| Groups | Job or gang names with a minimum grade, e.g. police grade 0 |
| Items | Keycards or keys that open it |
| Passcode | A keypad code |
| Lockpick | Whether it can be picked, and how hard |
| Auto lock | Seconds until it relocks by itself |
| Double / sliding | Pairs of doors and gates |

## qb-doorlock

qb-doorlock stores doors in config files — one per location — listing the door model and coordinates, the authorised jobs, whether it is locked by default and its distance. Newer versions also include an in-game creation tool that writes those entries for you.

*qb-doorlock config entry (shape)*

```lua
Config.DoorList['mrpd-front'] = {
    doorType = 'double',
    locked = true,
    authorizedJobs = { ['police'] = 0 },
    distance = 2.5,
    doors = {
        { objName = `v_ilev_ph_door01`, objYaw = -90.0, objCoords = vec3(434.7, -980.6, 30.8) },
        { objName = `v_ilev_ph_door002`, objYaw = -90.0, objCoords = vec3(434.7, -983.2, 30.8) },
    },
}
```

Field names differ between qb-doorlock versions; copy an entry from your own config rather than from a random example.

## Common problems

| Problem | Cause and fix |
| --- | --- |
| Door does not lock at all | Wrong model or coordinates; recreate it with the in-game tool |
| Door locks but swings open | Only one leaf of a double door is registered |
| Everyone can open it | No access configured, or the job/grade does not match your framework’s job names |
| Doors reset after restart | Doors were not saved (database or config not written) |
| MLO door not recognised | The MLO uses a custom door model; select it in game rather than typing a model |

## Questions

### How do I add doors with ox_doorlock?

Stand at the door in game and run the `/doorlock` command (with permission), select the door, set access and save. Doors are stored in the database.

### How do I make a door only open for police?

Add a group access of `police` with the minimum grade you want (0 for all officers).

### Can doors be opened with a keycard?

Yes, both ox_doorlock and qb-doorlock support item-based access.

### Why can everyone open my locked door?

Either no access rule is set, or the job name in the door does not match the job name your framework uses.

## Related

- https://fam-tools.com/guides/fivem-interiors-ipl
- https://fam-tools.com/guides/fivem-mlo-install
- https://fam-tools.com/guides/fivem-ace-permissions
- https://fam-tools.com/guides/txadmin-admins-permissions
