Links

Door Lock

Step-by-step installation guide, common issues & solutions, code snippets, error codes, config previews, locales previews, SQL previews, and changelogs; all in 1 easily accessible place.
Buy Here

Translate

INSTALLATION GUIDE

Step 0 - First Steps

1. Download your resource from FiveM’s Keymaster.
2. Unzip the cd_doorlock.zip folder and place this folder in your server's resource folder.
3. Add the resource to your server start config: ensure cd_doorlock. If you are using a framework, it must be placed anywhere below your framework resource e.g., es_extended, not above.

Step 1 - Configure Resource

You MUST read all configurable options inside the [cd_doorlock/configs/config.lua] file and configure them to suit your server's needs. Please read the ”commented out help text” at the end of each line so you can understand what each config option does.
The most important sections are the options under the Framework and Important sections at the top of the config.lua. Everything else is optional.
Introducing our new 'auto_detect' feature! It automatically identifies your framework and applies the appropriate default settings.
All of the configurations for doors are done through the UI in the game;- not through a database, text files or configs.

Step 2 - Configure Key Binds

Before starting this resource on your main/live server, we highly advise configuring your key binds because this resource uses Fivem's Key Mapping.
Where can I configure my key binds?
You can configure key binds in the Keys and Commands section near the bottom of the [cd_doorlock/configs/config.lua].
Why do I need to do this?
Well long story short;- once a player has joined your server with this resource running you can no longer force change their key binds for this resource through the config.lua, only they can change it in the in-game pause menu settings. Although it will change for the players who join after you have changed it.
The benefit of this system is that it's much more optimised and players can easily change their key binds on keyboards or controllers. You can also check out the Default Keybinds for this resource.

Step 3 - Move the JSON Files

Is this your first time installing this script? YES = You MUST do this step, or the script will not work.
No = DO NOT do this step, as it will overwrite your saved doors.
Go to the [cd_doorlock/JSON Files/INSTALLATION STEP FROM DOCS] folder and copy the 2 JSON files (door_data.json and location_groups.json) and the 1 folder (gabz_locations) and paste them into the JSON FILES folder. It's as simple as that.

Why do we do this?

Because the door_data.json and other files contain your server's door data (basically your door database). When current users update, we don't want them to accidentally overwrite their saved door data.

OPTIONAL FEATURES

This section is to help you understand how the built-in features of this resource work, and if applicable, how you can make them compatible with other resources. These features are not required, they are optional and can be configured in the [configs/config.lua].

Importing Gabz Maps

This script is made as simple to use as possible; therefore, all doors for every Gabz Map come pre-configured. You can choose which map you want to import the door lock files for, and the script will set them up automatically. You can have 500+ doors fully configured with just a few clicks. Ensure you enter the jobs/identifier to set the default permissions for that location.
Import pre-configured door locks for Gabz maps.

Creating New Doors

New doors are also created in-game through the UI. To choose the door, we use our custom target system.
Choose door type.
ghj
Choose door using our target system.
Configure door settings.

Editing Door Settings

All door configurations are done through the UI in-game;- not through a database, text files or configs. This can be done through the Create/Edit tab on the UI.
Edit any door's settings.
Choose from multiple door sounds or even add more.

Deleting Doors

From this tab on the UI in-game, you can easily delete door locks for individual doors or delete the whole map (a location group) door locks with a single click. Please note that the delete option is only visible to admins. (eg., the 100+ doors for Bolingbroke prison can be deleted instantly with a single click).
Easily delete door locks.

INFORMATION

Default Key Binds

These keys can be modified and/or disabled in the Keys and Commands section of the [configs/config.lua].
Please make sure you understand how Key Mapping works.
Key
Description
E
Open the closest door.

Chat Commands

These chat commands can be renamed and/or disabled in the Keys and Commands section of the [configs/config.lua].
The exact usage for each command will be displayed in the chat suggestions when using the commands in-game.
Command
Description
/doorlock
Open the closest door.
/doorlockui
Open the door lock UI to create/delete/edit doors.

Events

These events are completely optional; you can use them if needed.
client-side to client-side
server-side to client-side
Set the state of the closest door
The 1st argument [state] sets the doors state (false = unlock, true = lock).
TriggerEvent('cd_doorlock:SetDoorState_closest', state)
Set the state of a specific door by name EXAMPLE
The 1st argument [state] sets the doors state (false = unlock, true = lock). The 2nd and 3rd arguments are how we tell the script which door it should change.
TriggerEvent('cd_doorlock:SetDoorState_name', state, door_name, location_group)
Set the state of the closest door
The 2nd argument [state] sets the doors state (false = unlock, true = lock).
TriggerClientEvent('cd_doorlock:SetDoorState_closest', source, state)
Set the state of a specific door by name EXAMPLE
The 2nd argument [state] sets the doors state (false = unlock, true = lock). The 3rd and 4th arguments are how we tell the script which door it should change.
TriggerClientEvent('cd_doorlock:SetDoorState_name', source, state, door_name, location_group)

Exports

These exports are completely optional; you can use them if needed.
client-side exports
Get the state of the closest door
exports['cd_doorlock']:GetDoorState_closest()
Get the state of a specific door
The 1st and 2nd arguments are how we tell the script which door we want to get the state of.
exports['cd_doorlock']:GetDoorState_name(door_name, location_group)

COMMON ISSUES

Please check out our Troubleshooting Guide before contacting our support.
🔔 Folder Name Make sure the name of the folder either cd_doorlock.
🔔 Encrypted Files Do not edit the encrypted files in any way.
On the UI only 2 tab’s are showing not 4?
eg., you are an admin but only the Control and Settings tab are visible on the UI; but it should show all 4 tabs (Create/Edit, Control, Import & Settings). So you are unable to create new doors or import doors.
✔️ This is because you don’t have admin permissions set up correctly on your server. There could be multiple reasons for this.
1. The Config.AdminAccess in the config.lua has not been configured correctly for your server.
2. If you use ESX or QBCORE your players permissions are set up incorrectly through your framework. This is nothing to do with this script.
3. If you are using the Standalone framework option, and you have enabled Ace Perms; the ace perms are most likely not set up correctly in your server.cfg. To confirm this is the issue you can change the script to use the "command" ace perm and if the doors work then this is your issue, as the "command" ace perm gives every player access.
4. If you are using the Standalone framework option, and you have enabled Discord Perms; badger discord perms is required and it must be named [Badger_Discord_API].
New doors don’t save (using ZAP-Hosting)?
eg., if you use ZAP-Hosting, and you create new doors but they don’t save after a script/server restart.
✔️ This is because data is not being written to JSON file’s due to permission issues. (Only for people using zap-hosting).
Follow the following steps.
1. Stop the server.
2. Move the files to your server using filezilla or winscp.
3. Set the permissions for all JSON files to read write and execute for owner, group and user - https://www.pipeten.com/support/scripting/changing-file-permissions-using-filezilla/.
4. Then start the server.

ERROR CODES

If you see an error code not listed below, please open a script support ticket in the Codesign Discord.
Server
Client
0001 - The simple answer is that you did not complete #Step 3 of the installation guide above.
4387 - You are pressing E to interact with a door, but your job/identifier does not match the job/identifier required to interact with this door.
7854 - You are pressing E to interact with a door, but no doors are nearby.
3001/3002/3003/3004 - You are pressing E to interact with a door, but no doors have been created/imported yet.
N/A

CHANGELOG

Files Changed
Not every update requires you to replace the whole folder. We do this because we understand it's a pain to redo the configs for every update.
  • All Files - This means you should make a backup of the JSON Files folder, delete your old cd_doorlock folder, download and add in the latest version, replace the new JSON Files folder with the one you made a backup of, configure the configs folder and restart your server.
  • All Files Except config.lua - This means you should do all of the above (in the All Files section) but additionally make a backup of the config.lua file and replace the new config.lua file with the one you made a backup of.
  • Specific Files - This means you can copy and paste the SPECIFIC new files over the old ones and restart the server.
Update Type
On rare occasions, you are forced to update to the latest version. Mostly due to authentication updates where the old versions will no longer work.
  • Mandatory - This means you MUST update to this new version, or the old versions will no longer work.
  • Optional - This means it's completely your choice whether you wish to update to the latest version. But we do not offer support for old versions for obvious reasons; they are old.
PLEASE READ! (JSON files)
When updating a resource that uses JSON files as a database as this one does, DO NOT delete/replace the files/folders inside the JSON files folder, as this will delete/overwrite your saved database.
Skipping Updates
If you are attempting to update to the latest version but have skipped previous updates, you should update all files just to be safe. For example., let's say you are currently on v4.0.1, you did not update when v4.0.2 was released, and now v4.0.3 is released, and you want to update; you should always use the “All Files” update method.
v1.0.0
v1.0.1
v1.0.2
v1.0.3
1.0.4
1.0.5
v1.0.6
v1.0.7
v1.0.8
v1.0.9

05/10/2022

Files Changed:
  • All Files
  • All Files Except config.lua
  • Specific Files
Update Type:
  • Mandatory
  • Optional
Changelog:
STATUS
  • Development Stage: COMPLETE
  • Alpha Test Stage: COMPLETE
  • Beta Test Stage: COMPLETE

03/12/2022

Files Changed:
  • All Files
  • All Files Except config.lua
  • Specific Files
Update Type:
  • Mandatory
  • Optional
Changelog:
Add
  • Added code to automatically debug the script - the debug data will show in the F8 console prints.
  • Added exports to get the current state of a door.
  • Added new door pre-sets for the Maze Bank Arena
Edit
  • Added extra checks to make sure the door_data.json file can't accidently be overwritten resulting in the deletion of saved door files.
Fix
  • Fixed an issue with the external events to set door states.
  • The maximum job grade is no longer restricted to 16.

04/01/2023

Files Changed:
  • All Files
  • All Files Except config.lua
  • Specific Files
Update Type:
  • Mandatory
  • Optional
Changelog:
Add
  • Added the full gabz map door files
Edit
  • Improved debug prints
Fix
  • Fixed the max length of job grades when adding door permissions for jobs
  • Fixed the ui search bar issues

21/01/2023

Files Changed:
  • All Files
  • All Files Except config.lua
  • Specific Files
fxmanifest.lua
html (FULL FOLDER)
Update Type:
  • Mandatory
  • Optional
Changelog:
Fix
  • Fixed an issue with adding door perms when using the standalone method.

27/01/2023

Files Changed:
  • All Files
  • All Files Except config.lua
  • Specific Files
Update Type:
  • Mandatory
  • Optional
Changelog:
Add
  • Built-in DrawTextUI: Added a newly updated built-in draw text UI which is optional.
  • Draw3DText: Added draw 3d text which is optional.
  • Ace Perms: Added the option to use ace perms as an alternative to framework job checks.
  • Discord Role Perms: Added the option to use discord roles as permissions as an alternative to framework job checks.
  • Multiple Choice Permissions Access: With this new feature, you are no longer forced to choose 1 way of adding permissions, you can use multiple all at the same time.
    • For example., you no longer need to just use your frameworks admin or job checks; in addition to the standard framework admin/job checks, you can now set some doors to only be usable by those with a certain discord role, some doors to only be usable by those with certain ace perms and other doors to only be usable by certain fivem identifiers such as steam/license/fivem etc. On top of that, you can also set a door to use framework job checks, discord roles, ace perms and identifiers all at the same time!
  • Auto Lock Doors: You can now configure doors to auto-lock after x amount of seconds. Suggestion by Stixxzor#1513.

01/02/2023

Files Changed:
  • All Files
  • All Files Except config.lua
  • Specific Files
Update Type:
  • Mandatory
  • Optional
Changelog:
Add
  • Added german locales.
Edit
  • Reworked the door cameras so you no longer need to be close to them to operate them.
  • Updated debug info.
Fix
  • Fixed the drawtextui from opening when opening pause menu.
  • Fixed issues related to vRP.

09/02/2023

Files Changed:
  • All Files
  • All Files Except config.lua
  • Specific Files
Update Type:
  • Mandatory
  • Optional
Changelog:
Add
  • Auto Framework Detection - We have added a new feature we are calling 'auto_detect', which will automatically identify your framework resource and framework notifications and apply the appropriate default settings.
  • When using ESX/Qbcore we have added the ability for you to add a character's identifier/citizen id into the identifiers permissions tab when adding door access perms.
  • Added the import files for Gabz January map update.
Edit
  • Doors with a passcode no longer require any door access perms.
Fix
  • Fixed the 'mul string with number' client-side error.
  • Fixed some UI errors relating to job.
  • Fixed minor issues with the camera display icons in the control tab.
  • Fixed the random text appearing on the screen for a brief moment when adding/updating a door.
  • Fixed some multi perms not working correctly.
  • Fixed an issue with ace and discord perms not being saved when importing maps

14/02/2023

Files Changed:
  • All Files
  • All Files Except config.lua
  • Specific Files
1
fxmanifest.lua
2
configs/server_customise_me.lua
Update Type:
  • Mandatory
  • Optional
Changelog:
Fix
  • Fixed framework identifier not working when adding it to the identifier list on a doors perms.

21/02/2023

Files Changed:
  • All Files
  • All Files Except config.lua
  • Specific Files
Update Type:
  • Mandatory
  • Optional
Changelog:
Add
  • You now need to double-click E to confirm you wish to lockpick a door you can't access.
  • When entering a passcode or lockpicking, your player will automatically walk up to the door and start an animation to make it look more realistic.
  • You can now start lockpicking directly from the passcode UI (bottom left button).
Edit
  • When triggering an event to open/close a door with a lockpick or passcode from external resources, it instantly opens/closes it rather than opening the lockpick/passcode UI.
  • Doors with passcodes and lockpicks now work better together. Passcodes will always be prioritized before lockpicking.
  • Only players who don't have perms for a door can use the passcode UI. If a door has a passcode on it and a player has perms for that door, the door will instantly open. If you want players to use a passcode, ensure you don't set any other perms than the passcode.
Fix
  • Fixed a js error on standalone servers for players who don't have admin perms when they try to open the UI.

07/03/2023

Files Changed:
  • All Files
  • All Files Except config.lua
  • Specific Files
Update Type:
  • Mandatory
  • Optional
Changelog:
Add
  • Added dutch locales.
  • Added pre-configured okok, ps-ui and ox_lib notifications that will be automatically detected and applied on script start.
Fix
  • Fixed an issue where some job grades could not see doors they should be able to see in the control tab.
  • Fix esx depreciated event warning from spamming.
  • Fixed animations/walking to the door when you are in a vehicle.
  • Hide door opened/locked notifications when triggering them from an external resource.