Configs

Codesign resources contain various editable/unobscured files such as client/server functions etc.

Lua Config

configs/config.lua
Config = {}
for c, d in pairs(Cfg) do
    Config[c] = d
end

function GetLocales(locale_key, ...)
    local message = Locales[Config.Language][locale_key]
    if not message then
        Citizen.Trace(string.format('\n^1ERROR CODE: %s^0\n^1EXPLANATION: %s^0', '0081', 'locale not found in locales.lua: '..(locale_key or 'nil')..'\n'))
        return
    end

    if ... == nil then
        return message
    end

    local ok, formatted_message = pcall(string.format, message, ...)
    if ok then
        return formatted_message
    else
        Citizen.Trace(string.format('\n^1ERROR CODE: %s^0\n^1EXPLANATION: %s^0', '0082', 'String format failed for locale key: ' .. (locale_key or 'nil')..'. Data: '..json.encode({...})..'\n'))
        return
    end
end

-- ┌──────────────────────────────────────────────────────────────────┐
-- │                            IMPORTANT                             │
-- └──────────────────────────────────────────────────────────────────┘

Config.DoorDataStorageMethod = 'database'
-- ['file', 'database']
-- Choose where door data should be stored: in a JSON file (doors.json) or in a database.


Config.AutoInsertSQL = true
-- Recommended to enable before updating the script to ensure all required SQL entries are added automatically.


Config.DoorlockDrawTextUI = 'cd_doorlock'
-- ['cd_doorlock', 'auto_detect']
-- Use the built-in Draw Text UI, or set to 'auto_detect' to automatically use any compatible running UI.


Config.Debug = false
-- Enable to show debug information in the console.

-- ┌──────────────────────────────────────────────────────────────────┐
-- │                             MAIN                                 │
-- └──────────────────────────────────────────────────────────────────┘

Config.AdminAccess = { --A list of different methods where you can define which players have admin permissions to create/edit/delete/import doors on the in-game UI.
    Framework = { --(ESX, QBcore, Qbox & vRP only!) Ignore this framework section if you don't use a framework.
        ['esx'] = {'superadmin', 'admin', },
        ['qbcore'] = {'god', 'admin', },
        ['qbox'] = {'god', 'admin', },
        ['vrp'] = {5, 6, 7, 8, 9, 10, }
    },

    Identifiers = {
        ENABLE = false, --Do you want to allow players with specific fivem identifiers to use the admin features?
        identifier_list = {'license:xxxxx', 'steam:xxxxx', }, --You can use a players steam, license or fivem id etc.
    },

    AcePerms = {
        ENABLE = false, --Do you want to allow players with specific ace perms to use the admin features?
        aceperms_list = {'doorlock.police', }, --Make sure you have your ace perms configured correctly in your server.cfg.
    },

    Discord = { --(REQUIRES Badger Discord API).
        ENABLE = false, --Do you want to allow players with specific discord roles in your discord to use the admin features?
        discord_list = {'xxxxx', 'xxxxx', }, --You must put the role id from your discord here (https://www.itgeared.com/how-to-get-role-id-on-discord).
    }
}

Config.DoorAccessPerms = { --When creating/editing/deleting/importing doors, you always need to define which permission groups can lock/unlock these doors. Here you can choose which perms options are available to choose from on the in-game UI.
    Identifiers = true, --Do you want to allow players to use doors based on their fivem identifiers? (license,steam,fivem etc)
    AcePerms = true, --Do you want to allow players to use doors based on their ace perms?
    Discord = true, --(REQUIRES Badger Discord API). Do you want to allow players to use doors based on their discord roles?
    Items = true --(REQUIRES ESX/QBCore/Qbox). Do you want to allow players to use doors based on the items they have in their inventory?
}

Config.DoorStateDisplay = {
    DrawTextUI = true, --Do you want doors to display the lock/unlock state via the built in draw text UI?
    Icon = true, --Do you want doors to display the lock/unlock state via emojis?
    Notification = false --Do you want a notification to show after a door is locked/unlocked?
}

Config.LockpickItems = {
    ENABLE = true, --(ESX & QBcore only!) Do you want to require a playern to have an item in their inventory to lockpick a door?
    usable_lockpick_item = true, --In addition to pressing E to lockpick a door, do you want to allow players to use a usable lockpick item from their inventory?
    police_alert_chance = 50, --(0 = 0% chance, 100 = 100% chance) When a player is lockpicking a door, there is a chance that the police will be alerted. This is the percentage chance of this happening.
    lockpick_items = { --Having at least 1 of these items in your inventory will allow a player to lockpick a door.
        'lockpick',
        --'add_more_here',
    }
}

Config.DoorModelAllowList = {} -- A list of door models that will always be considered doors by the script.

Config.DoorModelDenyList = {} -- A list of door models that will never be considered doors by the script.

Config.OutlineAvailableDoors = true --Do you want to outline objects the script considers a door?

Config.DoorValidationDimensions = { -- The maximum/minimum dimensions a door can be to be considered a door by the script.
    normal = {
        max_height = 3.0,
        min_height = 2.0,

        max_width = 1.5,
        min_width = 1.0,

        max_depth = 0.3,
        min_depth = 0.05,
    },

    garage = {
        max_height = 6.0,
        min_height = 3.0,

        max_width = 6.0,
        min_width = 3.0,

        max_depth = 0.3,
        min_depth = 0.1,
    },

    gate = {
        max_height = 7.0,
        min_height = 3.0,

        max_width = 9.0,
        min_width = 5.0,

        max_depth = 0.6,
        min_depth = 0.1,
    }
}

-- ┌──────────────────────────────────────────────────────────────────┐
-- │                         KEYS & COMMANDS                          │
-- └──────────────────────────────────────────────────────────────────┘

Config.OpenDoorMenu = {
    ENABLE = true, --Do you want to allow player's open the door lock UI?
    command = 'doorlockui' --The chat command.
}

Config.ToggleDoorLock = {
    ENABLE = true, --Do you want to allow player's to toggle door locks?
    command = 'doorlocktoggle', --The chat command.
    key = 'e' --The keypress.
}

-- ┌──────────────────────────────────────────────────────────────────┐
-- │                            AUTO DETECT                           │
-- └──────────────────────────────────────────────────────────────────┘    

if Config.Database == 'none' then
    Config.DoorDataStorageMethod = 'file'
end
if GetResourceState('Badger_Discord_API') ~= 'started' then
    Config.AdminAccess.Discord.ENABLE = false
    Config.DoorAccessPerms.Discord = false
end

if Config.Framework == 'esx' or Config.Framework == 'qbcore' or Config.Framework == 'qbox' then
    Config.AdminAccess.Framework.ENABLE = true
    Config.DoorAccessPerms.Framework = true
else
    Config.AdminAccess.Framework.ENABLE = false
    Config.DoorAccessPerms.Framework = false
    Config.LockpickItems.ENABLE = false
    Config.DoorAccessPerms.Items = false
end
-----DO NOT TOUCH ANYTHING ABOVE THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING.-----

function GetConfig()
    return Config
end


JS Config

configs/config_ui.js
window['config'] = {
    "door_name_max_length": 32,
    "door_name_match": new RegExp(/[^a-zA-Z-\/\s\\0-9\\_]/guis),

    "door_passcode_max_length": 8,

    "job_name_max_length": 32,
    "job_name_match": new RegExp(/[^a-zA-Z0-9]/guis),

    "job_grade_max": 16,
    
    "identifier_max_length": 64
}

Last updated

Was this helpful?