Skip to content
FIVECRATE
MLO & maps intermediate

How to Use ox_doorlock: Add Door Locks to FiveM MLOs

How to use ox_doorlock: install it, run /doorlock, select MLO doors, set job, item and passcode access, and fix doors that cannot be selected or opened.

Staff member using an access card at an electronic office door lock beside a tablet with a lock icon
Author: FiveCrate
Published:
Updated:
Read time: 17 min
Applies to
FiveM Legacy servers; ox_doorlock 1.23.0 (released October 12, 2026; source read at commit 553e85d on December 2, 2026) with oxmysql and ox_lib; Qbox (qbx_core), ESX (es_extended), ox_core and ND_Core, plus notes for QBCore and servers without a framework. The ox_doorlock docs do not mention FiveM for GTAV Enhanced
Last verified

Direct Answer

To use ox_doorlock, install the release zip (not the source code, whose UI is not built), start oxmysql, ox_lib and your framework before it, and give your account the command.doorlock ACE, which config.lua grants to group.admin by default. In game, stand at the MLO door, type /doorlock, create a new door, fill in its name, lock state and who may open it (characters, groups, items or a passcode), click Confirm door, then aim at the door and press the left mouse button. ox_doorlock saves the door in its ox_doorlock database table and syncs it to every player at once.

What ox_doorlock is and what it needs

ox_doorlock is Overextended’s FiveM door lock script. Its docs describe it as “A door management resource that can be used standalone or alongside ox_core, qbx_core, and es_extended.” Doors live in a database, not in a config file: “Doors are stored in a database for ease-of-use and to allow data to be easily cleared or shared.” On start, the server code runs the resource’s own ox_doorlock.sql, so the ox_doorlock table is created for you. The ox_doorlock docs and README do not mention FiveM for GTAV Enhanced, so this guide covers FiveM Legacy servers.

A door lock works the same on every kind of server. A police station MLO on a roleplay server, a staff room on a racing server and a base on a zombie or PvP server all use the same steps; only the access rules depend on your framework.

RequirementWhat the source says (at the time of writing, December 2, 2026)
ox_doorlock version1.23.0, the latest release, committed on October 12, 2026
oxmysqlRequired; the server code checks for version 2.4.0 or newer
ox_libRequired; the code checks for 3.30.4 or newer, while the README still says “v2.3.0 or higher”
ox_targetOptional, “Used for lockpicking” (the code also accepts the deprecated qtarget)
FrameworksThe code loads an adapter for es_extended, ND_Core, ox_core or qbx_core

The sources list the frameworks differently. The docs name ox_core, qbx_core and es_extended; the README adds nd_core; the code at v1.23.0 checks all four. None of them lists qb-core, which is covered in the QBCore section below.

Step 1: Install ox_doorlock from the release zip

The README warns: “The UI needs to be built - use the latest release if you want to drag-n-drop.” The GitHub repository holds the source code of the interface, not the built files.

  1. Download ox_doorlock.zip from the latest release on the GitHub releases page and unzip it into your resources folder. Keep the folder name ox_doorlock: the code loads the resource by that name, for example when it converts old door files.
  2. Check that oxmysql and ox_lib are installed and that oxmysql connects to your database. ox_doorlock’s fxmanifest.lua lists both under dependencies, which the Cfx.re docs define as “Requires the specified resource to load before the current resource.”
  3. Add the resources to server.cfg in this order. The example uses ESX: put qbx_core, ox_core or ND_Core in place of es_extended, or leave that line out on a server without a framework. ox_target is only needed for lockpicking; leave its line out if you do not install it:
ensure oxmysql
ensure ox_lib
ensure es_extended
ensure ox_target
ensure ox_doorlock

The framework line must come before ox_doorlock: when ox_doorlock starts, it looks for a framework resource that is already started or starting, and loads no framework support if it finds none.

  1. Restart the server and read the console. If the UI files are missing, the server script stops with “Unable to load UI. Build ox_doorlock or download the latest release.”

Qbox servers built from the official txAdmin recipe already have it: the recipe downloads ox_doorlock.zip from the latest release into resources/[ox], and its server.cfg starts that folder with ensure [ox]. ESX servers install it by hand.

If you prefer to build from source, the docs give these commands (they need Git, Node.js and bun):

git clone https://github.com/overextended/ox_doorlock.git
cd ox_doorlock/web
bun i
bun run build

Step 2: Allow your account to use /doorlock

/doorlock is a restricted command. In config.lua, Config.CommandPrincipal = 'group.admin' sets the “ace principal to use ‘command.doorlock’”. ox_lib registers the command with that restriction and adds the ACE command.doorlock to the principal, so any player in group.admin can open the UI.

ox_lib adds that ACE by running the add_ace command itself, and the ox_lib docs say “You’ll also need to grant ace permissions to the resource.” Servers built from the Qbox recipe already have these lines in permissions.cfg, together with add_ace group.admin command allow, which allows every command to group.admin. Other servers add them to server.cfg if they are missing.

  1. Allow ox_lib to manage ACEs with the four lines from the ox_lib docs:
add_ace resource.ox_lib command.add_ace allow
add_ace resource.ox_lib command.remove_ace allow
add_ace resource.ox_lib command.add_principal allow
add_ace resource.ox_lib command.remove_principal allow
  1. Put your identifier in group.admin in server.cfg with add_principal, which “Sets a principal to inherit from another principal.” The Cfx.re docs give the form add_principal identifier.steam:110000112345678 group.admin; use your own identifier. The FiveM ACE permissions guide explains identifiers and groups, and the admin permissions guide for QBCore, Qbox and ESX covers each framework’s admin groups.
  2. Test it from the server console. The ox_doorlock docs say: “Enter test_ace player.1 command.doorlock in the server console (replace 1 with your server id).”
  3. Use another group if you prefer. Change Config.CommandPrincipal to the group you give to staff who place doors.

Step 3: Add a door lock to an MLO door with /doorlock

Start the MLO first. The MLO installation guide covers the map resource itself. Then join the server and walk to the door.

  1. Type /doorlock in chat. The README says to “Use the /doorlock command to open the UI and enter the settings for your new door.” The UI lists the doors you already have, with a search bar.
  2. Click the plus button (tooltip Create a new door) to open the settings.
  3. Fill in the General settings. Give the door a clear Door name, such as the MLO and the room. The name matters later, because per-door ACE permissions and the getDoorFromName export use it. Turn on Locked if the door should start locked, and Double for a pair of doors.
  4. Add the access rules in the Characters, Groups and Items views, or set a Passcode (see the table below).
  5. Click Confirm door. A prompt appears: “Create new door”, “Interact with [LMB]”, “Cancel with [RMB]”.
  6. Aim at the door and press the left mouse button. For a double door, click the first door, then the second. The right mouse button resets the selection, or cancels if nothing is selected yet.
  7. Walk up to the door and test it. By default a small lock icon shows the state, and E toggles the lock: the client listens for control 38, and the optional text prompt reads “[E] Lock door” or “[E] Unlock door”.

The README describes step 6 differently: “activate your targeting resource (typically LALT) to select the entity”. The client code at v1.23.0 instead casts a ray from the camera and waits for the left mouse button, as the prompt above shows. Follow the prompt you see in game.

To edit a door later, stand next to it and add any argument after the command: “Adding any arguments after the command will open the closest door to you, to easily modify it.”

Each door in the list also has a Door actions menu with Settings, Copy settings, Teleport to door and Delete door. For an MLO with many doors that share the same rules, copy the settings of one door, create the next one and use Apply copied settings next to Confirm door.

ox_doorlock door settings explained

The names and descriptions below come from the Door Settings page of the docs.

SettingWhat it does
Door name“Used to easily identify the door.”
Passcode“Door can be unlocked by anybody by using the code or phrase.” The game asks for it in a password field labelled Passcode
Autolock interval“Door will be locked after x seconds.”
Interact distance“Door can only be used when within x metres.” Left empty, the UI saves 2
Door rateMovement speed for sliding, garage and automatic doors, “or swinging doors when locked”
Locked“Sets the door as locked by default.”
Double“Door is a set of two doors, controlled together.”
Automatic“Sliding/garage/automatic door.”
Lockpick“Door can be lockpicked when interacting with a targeting resource.”
Hide UI“No indicators (i.e. icon, text) will display on the door.”
Hold Open“Holds the door open while unlocked.”
Character IdThe framework’s character identifier: player.charid, xPlayer.identifier or Player.CitizenId
Group and GradeA job, gang or other group, with “The minimum grade to allow access for the group (0 to allow all).”
Item, Metadata type, Remove on useThe item that opens the door; metadata type “Requires metadata support (i.e. ox_inventory)”; Remove on use takes the item
Lockpick difficulty, Area size, Speed multiplierThe skill check used when picking this door
Lock sound, Unlock soundSounds played on lock and unlock

The docs say sounds are stored in ./web/public/sounds. The v1.23.0 code reads them elsewhere: with Config.NativeAudio = true (the default) from audio/dlc_oxdoorlock/oxdoorlock as .wav files, otherwise from web/build/sounds as .ogg files.

Who can open a locked door: Qbox, ESX, QBCore and standalone

The server decides every lock and unlock. The checks in server/main.lua run in this order:

  1. Config.PlayerAceAuthorised. When set to true, anyone with command.doorlock may use any door. It is false by default.
  2. A per-door ACE. The code comments give the pattern add_ace group.police "doorlock.mrpd locker rooms" allow, where the part after doorlock. is the door name.
  3. Character, group and item rules from the door settings, read through the framework adapter.
  4. The passcode, asked in an input dialog.

The docs say a passcode door “can be unlocked by anybody by using the code or phrase.” In the v1.23.0 code that holds only for a door without groups (or on a server without a supported framework). When a door has groups and a passcode, a player who passes the group check, or the item check if the door also has items, is still asked for the code; a player who passes neither is refused without being asked. A door with items and a passcode but no groups asks everybody for the code and does not check the items. Players listed under Characters skip the passcode. Give a door a passcode alone when anybody with the code should get in.

A resource can also add its own rule through the registerHook export and the doorAuthorization hook, which the docs describe as “Triggered when opening/closing door.” The docs add: “By returning false, you can override door authorization allowing to use your own logic.” In the v1.23.0 code a hook that returns a true value opens the door for a player the other checks refused, but returning false does not take access away from a player they allowed.

How each framework fills the character and group checks at v1.23.0:

FrameworkCharacter IdGroupsItems
Qbox (qbx_core)citizenidHasGroup, which checks jobs and gangs and, per the Qbox docs, “Does not check if player is on or off duty”ox_inventory
ESX (es_extended)xPlayer.identifierThe player’s job and job gradeESX’s own inventory, unless ESX is set to use ox_inventory
ox_core, ND_CoreTheir own adaptersTheir own adaptersox_inventory
No supported frameworkNot checkedNot checkedNot checked

Without a supported framework the server warns “no compatible framework was loaded, most features will not work”. The code then skips the character, group, item and lockpick checks, so doors open only through ACE permissions, a passcode or a hook. That still suits a racing, PvP or freeroam server that only needs locked staff rooms: give the staff group the per-door ACE, as the ACE permissions guide shows.

ox_doorlock on QBCore

The framework list in the v1.23.0 code has no qb-core entry, so a QBCore server gets the same warning and the same reduced checks as a server without a framework. QBCore’s own lock is qb-doorlock, “Doorlock System For QBCore”, which creates doors in game with /newdoor. The adapter list does include Qbox, whose recipe ships ox_doorlock; the QBCore to Qbox migration guide covers that move.

Lockpicking doors with ox_target

  1. Turn on Lockpick in the door’s settings.
  2. Run ox_target. ox_doorlock registers a Pick lock option on objects through it, with a distance of 1 and Config.LockpickItems as the option’s items.
  3. Create the lockpick item. Config.LockpickItems lists 'lockpick' by default, and the server checks that the player carries an item with that name. See how to add items to ox_inventory.

The skill check defaults to Config.LockDifficulty = { 'easy', 'easy', 'medium' }, unless the door has its own difficulty. Picking only works on locked doors unless Config.CanPickUnlockedDoors is true. The code draws a random number after each attempt, math.random(1, success and 100 or 5), and breaks the lockpick when it is 1: a 1 in 100 chance after a success and 1 in 5 after a failure.

Why an MLO door cannot be selected

When you aim during step 6, the client uses ox_lib’s camera raycast, which extends “to ~10m by default”. The ray is cast with flags 1|16: in the native’s flag list, 1 is IntersectWorld and 16 is IntersectObjects. ox_lib’s default ignore value is 4, which the native defines as OptionIgnoreNoCollision. A door is accepted only when the hit is an entity of type 3; the GET_ENTITY_TYPE native lists “3 = object”. Objects that already belong to a door lock are skipped too.

In practice:

  • Get close. The ray starts at the camera and reaches about 10 metres, so in third person stand nearer than that. Aim at the door leaf itself, not the frame.
  • A red marker without an outline means the ray hit something that cannot be used: not an object entity, or an object that already belongs to a door lock.
  • A door that is part of the room’s own model is not a separate object, so it can never be selected.
  • The door may already be registered. Open /doorlock and search for it in the list.

If a door never highlights, check how the MLO builds it. The official assets manual sets up a door as its own model with a .ytyp archetype:

Door typeOriginSpecial AttributeArchetype Flags
Swinging doorHinge point (side center)Normal Door (7)Dynamic, Enable Door Physics
Sliding door or gateBottom cornerSliding Door (8)Dynamic, Enable Door Physics
Vertical garage doorBottom centerGarage Door (5)Dynamic, Enable Door Physics

If you made the MLO, compare its doors with this table. If someone else made it, ask its author how its doors are meant to be locked.

Moving doors from nui_doorlock or qb-doorlock

ox_doorlock can import old door files. The docs: “Any files with the .lua extension placed in the ox_doorlock/convert directory will be read on resource start. If the directory doesn’t exist, you can create it.”

  1. Copy the old config files into ox_doorlock/convert/.
  2. Restart ox_doorlock. The console prints “Found … nui_doorlock config files.” with the number of files, then a “Loaded … doors from convert/” line for each file.
  3. Check the doors in /doorlock. Each imported door is named after its file name and its key in the old table. A door whose name already exists is not inserted again.
  4. Remove the converted files. After a successful import the code adds “This file has already been converted for ox_doorlock and should be removed.” to the top of the file.

The README warns: “Success is not guaranteed if using a fork on nui_doorlock, like the qb version.” The v1.23.0 converter does read qb-doorlock fields (objName, objYaw, authorizedJobs, authorizedGangs, authorizedCitizenIDs, pickable, hideLabel) and divides autoLock milliseconds by 1000. qb-doorlock options outside that list, such as doorType, needsAllItems, allAuthorized, cantUnlock and remoteTrigger, are not carried over. qb-doorlock writes items as a table of names and amounts, such as { ['keycard'] = 1 }; the converter copies that table unchanged, while ox_doorlock checks items as a numbered list, so re-enter the items of each converted door. Check every converted door.

Adding doors from a script

Since v1.23.0, a resource can create doors with the createDoor export, “the same as creating one with the /doorlock command.” The docs warn that “The door is stored in the database and stays there until it is removed. Check for it with getDoorFromName before creating it, rather than creating it again every time your resource starts.” Other server exports read and change doors:

local door = exports.ox_doorlock:getDoorFromName('mrpd locker rooms')

if door then
    exports.ox_doorlock:setDoorState(door.id, 0)
end

setDoorState “Sets a door with the given doorId as locked if state is true or 1”, so 0 unlocks it. removeDoor deletes a door and “Throws an error if no door exists with the given doorId.” The hooks page names the removal export removeHooks, while the v1.23.0 code exports it as removeResourceHook.

Troubleshooting

“Unable to load UI. Build ox_doorlock or download the latest release.”

The web/build/index.html file is missing, so the server and client scripts stop with this error. You installed the source code. Replace the folder with ox_doorlock.zip from the latest release, or build it with the bun commands above.

/doorlock shows the cursor but no UI

The docs: “If the cursor is displayed but not the UI then you have not built it.” The fix is the same as above.

/doorlock does nothing

“You may not be authorised to use the command.” Run test_ace player.1 command.doorlock with your server id. If it is denied, add your identifier to group.admin or to the principal set in Config.CommandPrincipal.

“no compatible framework was loaded, most features will not work”

None of es_extended, ND_Core, ox_core or qbx_core was running when ox_doorlock started. Start your framework before ox_doorlock in server.cfg. On QBCore or a server without a framework, use ACE permissions or passcodes.

The door does not highlight when you aim at it

Follow the checks in “Why an MLO door cannot be selected” above: distance, door leaf, existing lock, and the door setup in the MLO.

Pressing E does not unlock the door

The server refused the change and sent an error notification with the text cannot_unlock or cannot_lock. Check the door’s groups, grades, character IDs and items against the player, or test with a per-door ACE. If the door has a passcode as well as groups, only players who pass the group or item check are asked for the code. If the door’s Hide UI is off and no lock icon shows, you are not within its Interact distance, and E does nothing.

The lock stopped working after an MLO update

Each door is stored with its model and coordinates. Near a door, the client searches for an object of that model within 1.0 of the stored coordinates. If an MLO update moved or replaced the door, choose Delete door in its Door actions menu and add it again.

Next Steps

FiveCrate’s MLOs and scripts are listed in their catalogue categories.

Browse MLO & interior maps

MLO interiors and maps for FiveM servers: houses, mechanic shops, cafes, restaurants, shops and islands.

Browse catalogue →

Official documentation and repository references