Configs, Locales & SQL

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

Config = {}
function L(cd) if Locales[Config.Language][cd] then return Locales[Config.Language][cd] else print('Locale is nil ('..cd..')') end end
--███████╗██████╗  █████╗ ███╗   ███╗███████╗██╗    ██╗ ██████╗ ██████╗ ██╗  ██╗
--██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝██║    ██║██╔═══██╗██╔══██╗██║ ██╔╝
--█████╗  ██████╔╝███████║██╔████╔██║█████╗  ██║ █╗ ██║██║   ██║██████╔╝█████╔╝ 
--██╔══╝  ██╔══██╗██╔══██║██║╚██╔╝██║██╔══╝  ██║███╗██║██║   ██║██╔══██╗██╔═██╗ 
--██║     ██║  ██║██║  ██║██║ ╚═╝ ██║███████╗╚███╔███╔╝╚██████╔╝██║  ██║██║  ██╗
--╚═╝     ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝ ╚══╝╚══╝  ╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝


--WHAT DOES 'auto_detect' DO?
--The 'auto_detect' feature automatically identifies your framework, SQL database resource, and framework notifications, and applies the appropriate default settings.

Config.Framework = 'auto_detect' --[ 'auto_detect' / 'other' ]   If you select 'auto_detect', only ESX, QBCore, vRP and Standalone frameworks will be detected. Use 'other' for custom frameworks.
Config.Notification = 'auto_detect' --[ 'auto_detect' / 'other' ]   If you select 'auto_detect', the default notifications for your framework will be used. Use 'other' for custom notification resources.
Config.Language = 'EN' --[ 'EN' ]   You can add your own locales to Locales.lua, but be sure to update the Config.Language to match it.

Config.FrameworkTriggers = {
    esx = { --If you have modified the default event names in the es_extended resource, change them here.
        resource_name = 'es_extended',
        main = 'esx:getSharedObject',
        load = 'esx:playerLoaded',
        job = 'esx:setJob'
    },
    qbcore = { --If you have modified the default event names in the qb-core resource, change them here.
        resource_name = 'qb-core',
        main = 'QBCore:GetObject',
        load = 'QBCore:Client:OnPlayerLoaded',
        job = 'QBCore:Client:OnJobUpdate',
        gang = 'QBCore:Client:OnGangUpdate',
        duty = 'QBCore:Client:SetDuty'
    }
}


--██╗███╗   ███╗██████╗  ██████╗ ██████╗ ████████╗ █████╗ ███╗   ██╗████████╗
--██║████╗ ████║██╔══██╗██╔═══██╗██╔══██╗╚══██╔══╝██╔══██╗████╗  ██║╚══██╔══╝
--██║██╔████╔██║██████╔╝██║   ██║██████╔╝   ██║   ███████║██╔██╗ ██║   ██║   
--██║██║╚██╔╝██║██╔═══╝ ██║   ██║██╔══██╗   ██║   ██╔══██║██║╚██╗██║   ██║   
--██║██║ ╚═╝ ██║██║     ╚██████╔╝██║  ██║   ██║   ██║  ██║██║ ╚████║   ██║   
--╚═╝╚═╝     ╚═╝╚═╝      ╚═════╝ ╚═╝  ╚═╝   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═══╝   ╚═╝


Config.Debug = false --To enable debug prints.
Config.UseFrameworkDutySystem = false --Do you want to use your frameworks (esx/qbcore) built-in duty system?
Config.CheckInterval = 2 --(in minutes) How often should the script check for cameras if they are expired or not?


--███╗   ███╗ █████╗ ██╗███╗   ██╗
--████╗ ████║██╔══██╗██║████╗  ██║
--██╔████╔██║███████║██║██╔██╗ ██║
--██║╚██╔╝██║██╔══██║██║██║╚██╗██║
--██║ ╚═╝ ██║██║  ██║██║██║ ╚████║
--╚═╝     ╚═╝╚═╝  ╚═╝╚═╝╚═╝  ╚═══╝


Config.ThresholdToDestroyCamera = 300 --(in ms) The threshold to destroy the camera if it gets damaged. (if the camera gets damaged more than this threshold, it will be destroyed.)

Config.AdminAccess = { --A list of different methods where you can define which players have admin permissions on the in-game UI.
    Framework = { --Ignore this framework section if you dont use a framework.
        ['esx'] = {'superadmin', 'admin', },
        ['qbcore'] = {'god', 'admin', },
        ['vrp'] = {5, 6, 7, 8, 9, 10, },
        ['other'] = {'change_me', 'change_me', },
    },

    Identifiers = {
        ENABLE = false, --Do you want to allow players with specific identifiers to use the admin features?
        identifier_list = {'steam:xxxxx', 'license:xxxxx', 'fivem: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 = {'command', 'cctv', }, --Make sure you have your ace perms configured correctly in your server.cfg.
    },

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

Config.CCTVAccessPerms = { --When giving other players access to view your cameras, you always need to define which permission groups have access to them. Here you can choose which perms options are available to choose from on the in-game UI.    
    AcePerms = true, --Do you want to allow your admins to add ace perms to the cctv permissions?
    
    Discord = true --Do you want to allow your admins to add discord roles to the cctv permissions? This feature requires the Badger Discord API resource.
}


--██████╗ ██╗      █████╗  ██████╗██╗███╗   ██╗ ██████╗      ██████╗ ██████╗████████╗██╗   ██╗     ██████╗ █████╗ ███╗   ███╗███████╗██████╗  █████╗ ███████╗
--██╔══██╗██║     ██╔══██╗██╔════╝██║████╗  ██║██╔════╝     ██╔════╝██╔════╝╚══██╔══╝██║   ██║    ██╔════╝██╔══██╗████╗ ████║██╔════╝██╔══██╗██╔══██╗██╔════╝
--██████╔╝██║     ███████║██║     ██║██╔██╗ ██║██║  ███╗    ██║     ██║        ██║   ██║   ██║    ██║     ███████║██╔████╔██║█████╗  ██████╔╝███████║███████╗
--██╔═══╝ ██║     ██╔══██║██║     ██║██║╚██╗██║██║   ██║    ██║     ██║        ██║   ╚██╗ ██╔╝    ██║     ██╔══██║██║╚██╔╝██║██╔══╝  ██╔══██╗██╔══██║╚════██║
--██║     ███████╗██║  ██║╚██████╗██║██║ ╚████║╚██████╔╝    ╚██████╗╚██████╗   ██║    ╚████╔╝     ╚██████╗██║  ██║██║ ╚═╝ ██║███████╗██║  ██║██║  ██║███████║
--╚═╝     ╚══════╝╚═╝  ╚═╝ ╚═════╝╚═╝╚═╝  ╚═══╝ ╚═════╝      ╚═════╝ ╚═════╝   ╚═╝     ╚═══╝       ╚═════╝╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝


Config.DetectionCooldown = 2 --How long should the script wait before sending another notification to the owner if a camera detects something?

Config.CommandBased = true --If you want to use commands to place cameras, set this to true. (You can use both command and item based at the same time).
Config.ItemBased = false --If you want to use items to place cameras, set this to true. (You can use both command and item based at the same time).

--If you have selected item based, make sure to create the items in your database or items.lua based on the framework/inventory you are using.
--Also if your inventory doesnt use base QBCore/ESX useable items event, change them in the server_customise_me.lua file.

Config.CCTV = {
    ["cctv1"] = {
        prop = "hei_prop_bank_cctv_02",
        persistent = true, --Do you want these types of cameras to be persistant (will respawn even after server restart)?
        time = 10, --(in minutes) If "persistent" option above^ is disabled, after x amount of minutes, the cctv will be removed.
        type = "360", --[ "360" / "180" / "fixed" ] Choose whether this camera can turn 360°, 180° of it the camera is fixed and can not move.
        canDestroy = false, --Can players destroy this camera?
        detect = false, -- Do you want this camera to detect players?
    },

    ["cctv2"] = { --This is the item spawn name if you use ESX/QBCore. For standalone, this will be the chat command to place cameras.
        prop = "prop_cs_cctv", --The prop name.
        persistent = true, --Do you want these types of cameras to be persistant (will respawn even after server restart)?
        time = 10, --(in minutes) If "persistent" option above^ is disabled, after x amount of minutes, the cctv will be removed.
        type = "180", --[ "360" / "180" / "fixed" ] Choose whether this camera can turn 360°, 180° of it the camera is fixed and can not move.
        canDestroy = false, --Can players destroy this camera?
        detect = true, -- Do you want this camera to detect players?
    },

    ["cctv3"] = { --This is the item spawn name if you use ESX/QBCore. For standalone, this will be the chat command to place cameras.
        prop = "prop_cs_cctv", --The prop name.
        persistent = true, --Do you want these types of cameras to be persistant (will respawn even after server restart)?
        time = 10, --(in minutes) If "persistent" option above^ is disabled, after x amount of minutes, the cctv will be removed.
        type = "fixed", --[ "360" / "180" / "fixed" ] Choose whether this camera can turn 360°, 180° of it the camera is fixed and can not move.
        canDestroy = false, --Can players destroy this camera?
        detect = true, -- Do you want this camera to detect players?
    },
}


-- ██████╗ ██████╗ ███╗   ███╗███╗   ███╗ █████╗ ███╗   ██╗██████╗ ███████╗
--██╔════╝██╔═══██╗████╗ ████║████╗ ████║██╔══██╗████╗  ██║██╔══██╗██╔════╝
--██║     ██║   ██║██╔████╔██║██╔████╔██║███████║██╔██╗ ██║██║  ██║███████╗
--██║     ██║   ██║██║╚██╔╝██║██║╚██╔╝██║██╔══██║██║╚██╗██║██║  ██║╚════██║
--╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚═╝ ██║██║  ██║██║ ╚████║██████╔╝███████║
-- ╚═════╝ ╚═════╝ ╚═╝     ╚═╝╚═╝     ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝╚═════╝ ╚══════╝


Config.OpenCCTVUI = {
    ENABLE = true, --Do you want to allow player's open the CCTV UI via chat command?
    command = 'cctvui', --The chat command.
}


-- ██████╗ ████████╗██╗  ██╗███████╗██████╗ 
--██╔═══██╗╚══██╔══╝██║  ██║██╔════╝██╔══██╗
--██║   ██║   ██║   ███████║█████╗  ██████╔╝
--██║   ██║   ██║   ██╔══██║██╔══╝  ██╔══██╗
--╚██████╔╝   ██║   ██║  ██║███████╗██║  ██║
-- ╚═════╝    ╚═╝   ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝


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


-- █████╗ ██╗   ██╗████████╗ ██████╗     ██████╗ ███████╗████████╗███████╗ ██████╗████████╗
--██╔══██╗██║   ██║╚══██╔══╝██╔═══██╗    ██╔══██╗██╔════╝╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝
--███████║██║   ██║   ██║   ██║   ██║    ██║  ██║█████╗     ██║   █████╗  ██║        ██║   
--██╔══██║██║   ██║   ██║   ██║   ██║    ██║  ██║██╔══╝     ██║   ██╔══╝  ██║        ██║   
--██║  ██║╚██████╔╝   ██║   ╚██████╔╝    ██████╔╝███████╗   ██║   ███████╗╚██████╗   ██║   
--╚═╝  ╚═╝ ╚═════╝    ╚═╝    ╚═════╝     ╚═════╝ ╚══════╝   ╚═╝   ╚══════╝ ╚═════╝   ╚═╝   


-----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.qbcore.resource_name) == 'started' then
        Config.Framework = 'qbcore'
    elseif GetResourceState('vrp') == 'started' then
        Config.Framework = 'vrp'
    else
        Config.Framework = 'standalone'
    end
    if Config.Framework == 'esx' or Config.Framework == 'qbcore' then
        for c, d in pairs(Config.FrameworkTriggers[Config.Framework]) do
            Config.FrameworkTriggers[c] = d
        end
        Config.FrameworkTriggers.esx, Config.FrameworkTriggers.qbcore = nil, nil
    end
end

if Config.Notification == 'auto_detect' then Config.Notification = Config.Framework if Config.Notification == 'standalone' or Config.Notification == 'vrp' then Config.Notification = 'chat' end end

if GetResourceState('Badger_Discord_API') ~= 'started' then
    Config.AdminAccess.Discord.ENABLE = false
    Config.CCTVAccessPerms.Discord = false
end

if Config.Framework == 'esx' or Config.Framework == 'qbcore' or Config.Framework == 'other' then
    Config.AdminAccess.Framework.ENABLE = true
else
    Config.AdminAccess.Framework.ENABLE = false
end

if Config.Framework == 'esx' or Config.Framework == 'qbcore' or Config.Framework == 'other' then
    Config.CCTVAccessPerms.Framework = true
else
    Config.CCTVAccessPerms.Framework = false
end
-----DO NOT TOUCH ANYTHING ABOVE THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING.-----

Last updated