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

START HERE

1. Unzip the cd_doorlock.zip folder and place this folder in your server's resource folder.
2. 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 eg., es_extended, not above).
3. WARNING The name of the folder must not be changed or the resource will not function correctly.
4. WARNING Do not edit the encrypted files in any way.

INSTALLATION GUIDE

Step 1 - Configure the resource

You MUST read all of the configurable options inside the config.lua 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.
All of the configurations for doors is done through the UI in game;- not through a database, text files or configs.

Step 2 - Configure your key binds

Before starting this resource on your main/live server we highly advise you to configure your key binds because this resource uses Fivem's Key Mapping.
Why? 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 own 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 current 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 contains all of your server's door data (basically your door database), and when current users are updating we don't want them to accidentally overwrite their saved door data.

Step 4 - Import gabz maps

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

Step 5 - Create a new door

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

Step 6 - Edit door settings

All of the configurations for doors is 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.

Step 7 - Deleting doors

From this tab on the UI in-game, you can easily delete door locks for individual doors or delete the whole maps (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

Please Read Here for more information regarding key mapping.
Key
Description
E
Open the closest door.

Chat commands

All of these chat commands can be renamed and disabled/enabled in the config/code.
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. These are less important events, the more important events are documented in the other sections above.
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.
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.AdminList 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, you have either not added your identifier to the Config.AdminList table or the identifier is wrong.

ERROR CODES

If you see an error code which isn't 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 there are no doors 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 download the latest version from keymaster, copy and paste all the new files/folders into the cd_doorlock folder, reconfigure the configs folder and restart your server.
  • Specific Files - This means you can simply 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.
v1.0.0
v1.0.1
v1.0.2
v1.0.3
1.0.4

05/10/2022

Files Changed:
  • All files
  • 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
  • Specific Files
PLEASE READ!
When updating this script DO NOT replace the files/folders in the JSON files folder as this will overwrite your current saved doors.
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
  • Specific Files
PLEASE READ!
When updating this script DO NOT replace the files/folders in the JSON files folder as this will overwrite your current saved doors.
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
  • Specific Files
fxmanifest.lua
html (FULL FOLDER)
PLEASE READ!
When updating this script DO NOT replace the files/folders in the JSON files folder as this will overwrite your current saved doors.
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
  • Specific Files
PLEASE READ!
When updating this script DO NOT delete/replace the files/folders in the JSON files folder as this will overwrite your current saved doors.
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.