Configs

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

Lua Config

configs/config.lua
Config = {}
function L(cd) if Locales[Config.Language][cd] then return Locales[Config.Language][cd] else print('Locale is nil ('..cd..')') end end

-- ┌──────────────────────────────────────────────────────────────────┐
-- │                            FRAMEWORK                             │
-- └──────────────────────────────────────────────────────────────────┘

-- WHAT DOES 'auto_detect' DO?
-- Automatically detects key resources and manages all events, exports, and data handling.

-- 'auto_detect' will automatically detect your framework.
Config.Framework = 'auto_detect' --[ 'auto_detect', 'esx', 'qbcore', 'qbox', 'vrp', 'standalone', 'other' ]

--If you select 'auto_detect', your SQL database adaptor resource will automatically be detected.
Config.Database = 'auto_detect' --[ 'auto_detect', 'mysql-async', 'ghmattimysql', 'oxmysql' ] 

--If you select 'auto_detect', your inventory resource will automatically be detected. Use 'other' for custom inventory resources.
Config.Inventory = 'auto_detect' --[ 'auto_detect', 'ox_inventory', 'qb-inventory', 'qs-inventory', 'esx',  'qbcore', 'other' ]

-- 'auto_detect' will automatically detect your notification resource.
Config.Notification = 'auto_detect' --[ 'auto_detect', 'cd_notifications', 'mythic_notify', 'okokNotify', 'origen_notify', 'ox_lib', 'pNotify', 'ps-ui', 'rtx_notify', 'vms_notifyv2', 'esx', 'qbcore', 'chat' ]

-- 'auto_detect' will automatically detect your draw text ui resource.
Config.DrawTextUI = 'cd_doorlock' --[ 'cd_doorlock', 'auto_detect', 'cd_drawtextui', 'okokTextUI', 'ps-ui', 'qbcore', 'vms_notifyv2' ]

-- Add your own locales in locales.lua and set Config.Language to match.
Config.Language = 'EN' --[ 'EN', 'DE', 'NL' ]

Config.FrameworkTriggers = {
    esx = { --Update these if you have modified the default es_extended event names.
        resource_name = 'es_extended',
        main = 'esx:getSharedObject',
        load = 'esx:playerLoaded',
        job = 'esx:setJob'
    },
    qbcore = { --Update these if you have modified the default qb-core event names.
        resource_name = 'qb-core',
        main = 'QBCore:GetObject',
        load = 'QBCore:Client:OnPlayerLoaded',
        job = 'QBCore:Client:OnJobUpdate',
        gang = 'QBCore:Client:OnGangUpdate',
        duty = 'QBCore:Client:SetDuty'
    },
    qbox = { -- Update these if you have modified the default qbx_core event names.
        resource_name = 'qbx_core',
        main = 'QBCore:GetObject',
        load = 'QBCore:Client:OnPlayerLoaded',
        job = 'QBCore:Client:OnJobUpdate',
        gang = 'QBCore:Client:OnGangUpdate',
        duty = 'QBCore:Client:SetDuty'
    }
}


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

Config.Debug = true --To enable debug prints.


-- ┌──────────────────────────────────────────────────────────────────┐
-- │                             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 = true, --Do you want to allow players with specific fivem identifiers to use the admin features?
        identifier_list = {'license2:207af54f9064576d3a55cfe79626add456229eb1', }, --You can use a players steam, license or fivem id etc.
    },

    AcePerms = {
        ENABLE = true, --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 = false, --Do you want to allow players to use doors based on their ace perms?
    Discord = false, --(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',
        'advancedlockpick',
        --'add_more_here',
    }
}


-- ┌──────────────────────────────────────────────────────────────────┐
-- │                         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.
}


-- ┌──────────────────────────────────────────────────────────────────┐
-- │                              OTHER                               │
-- └──────────────────────────────────────────────────────────────────┘

function Round(cd) return math.floor(cd+0.5) end
function Trim(cd) return cd:gsub('%s+', '') end
function GetConfig() return Config end


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

-----DO NOT TOUCH ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING.-----
if Config.Framework == 'auto_detect' then
    if GetResourceState(Config.FrameworkTriggers.esx.resource_name) == 'started' then
        Config.Framework = 'esx'
    elseif GetResourceState(Config.FrameworkTriggers.qbox.resource_name) == 'started' then
        Config.Framework = 'qbox'
    elseif GetResourceState(Config.FrameworkTriggers.qbcore.resource_name) == 'started' then
        Config.Framework = 'qbcore'
    elseif GetResourceState('vrp') == 'started' then
        Config.Framework = 'vrp'
    else
        Config.Framework = 'standalone'
    end
end
if Config.Framework == 'esx' or Config.Framework == 'qbcore' or Config.Framework == 'qbox' then
    for c, d in pairs(Config.FrameworkTriggers[Config.Framework]) do
        Config.FrameworkTriggers[c] = d
    end
    Config.FrameworkTriggers.esx, Config.FrameworkTriggers.qbcore, Config.FrameworkTriggers.qbox = nil, nil, nil
end

if Config.Database == 'auto_detect' then
    if GetResourceState('mysql-async') == 'started' then
        Config.Database = 'mysql'
    elseif GetResourceState('ghmattimysql') == 'started' then
        Config.Database = 'ghmattimysql'
    elseif GetResourceState('oxmysql') == 'started' then
        Config.Database = 'oxmysql'
    end
end

if Config.Notification == 'auto_detect' then
    if GetResourceState('cd_notifications') == 'started' then
        Config.Notification = 'cd_notifications'
    elseif GetResourceState('mythic_notify') == 'started' then
        Config.Notification = 'mythic_notify'
    elseif GetResourceState('okokNotify') == 'started' then
        Config.Notification = 'okokNotify'
    elseif GetResourceState('origen_notify') == 'started' then
        Config.Notification = 'origen_notify'
    elseif GetResourceState('ox_lib') == 'started' then
        Config.Notification = 'ox_lib'
    elseif GetResourceState('pNotify') == 'started' then
        Config.Notification = 'pNotify'
    elseif GetResourceState('ps-ui') == 'started' then
        Config.Notification = 'ps-ui'
    elseif GetResourceState('rtx_notify') == 'started' then
        Config.Notification = 'rtx_notify'
    elseif GetResourceState('vms_notifyv2') == 'started' then
        Config.Notification = 'vms_notifyv2'
    else
        if Config.Framework == 'esx' or Config.Framework == 'qbcore' then
            Config.Notification = Config.Framework
        else
            Config.Notification = 'chat'
        end
    end
end

if Config.Inventory == 'auto_detect' then
    if GetResourceState('ox_inventory') == 'started' then
        Config.Inventory = 'ox_inventory'
    elseif GetResourceState('qb-inventory') == 'started' then
        Config.Inventory = 'qb-inventory'
    elseif GetResourceState('qs-inventory') == 'started' then
        Config.Inventory = 'qs-inventory'
    else
        if Config.Framework == 'esx' then
            Config.Inventory = 'esx'
        elseif Config.Framework == 'qbcore' then
            Config.Inventory = 'qbcore'
        end
    end
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'  or Config.Framework == 'other' 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.-----


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?