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 and notification resource 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', only ESX, QBCore, cd_notifications, okokNotify, ps-ui and ox_lib notifications will be detected. Use 'other' for custom notification resources.
Config.Language = 'EN' --[ 'EN' / 'DE' / 'NL' ] 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.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 & vRP only!) Ignore this framework section if you don't use a framework.
['esx'] = {'superadmin', 'admin', },
['qbcore'] = {'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 = {'steam:xxxxx', 'license:xxxxx', 'fivem:xxxxx', }, --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 = true, --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). 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?
Emojis = true, --Do you want doors to display the lock/unlock state via emojis?
Draw3DText = false, --Do you want doors to display the lock/unlock state via draw 3d text UI?
Notification = true --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',
'advanced_lockpick',
--'add_more_here',
}
}
--██╗ ██╗███████╗██╗ ██╗███████╗ █████╗ ███╗ ██╗██████╗ ██████╗ ██████╗ ███╗ ███╗███╗ ███╗ █████╗ ███╗ ██╗██████╗ ███████╗
--██║ ██╔╝██╔════╝╚██╗ ██╔╝██╔════╝ ██╔══██╗████╗ ██║██╔══██╗ ██╔════╝██╔═══██╗████╗ ████║████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝
--█████╔╝ █████╗ ╚████╔╝ ███████╗ ███████║██╔██╗ ██║██║ ██║ ██║ ██║ ██║██╔████╔██║██╔████╔██║███████║██╔██╗ ██║██║ ██║███████╗
--██╔═██╗ ██╔══╝ ╚██╔╝ ╚════██║ ██╔══██║██║╚██╗██║██║ ██║ ██║ ██║ ██║██║╚██╔╝██║██║╚██╔╝██║██╔══██║██║╚██╗██║██║ ██║╚════██║
--██║ ██╗███████╗ ██║ ███████║ ██║ ██║██║ ╚████║██████╔╝ ╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚═╝ ██║██║ ██║██║ ╚████║██████╔╝███████║
--╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚══════╝
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 = 'doorlock', --The chat command.
key = 'e' --The keypress.
}
-- ██████╗ ████████╗██╗ ██╗███████╗██████╗
--██╔═══██╗╚══██╔══╝██║ ██║██╔════╝██╔══██╗
--██║ ██║ ██║ ███████║█████╗ ██████╔╝
--██║ ██║ ██║ ██╔══██║██╔══╝ ██╔══██╗
--╚██████╔╝ ██║ ██║ ██║███████╗██║ ██║
-- ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
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
if GetResourceState('cd_notifications') == 'started' then
Config.Notification = 'cd_notifications'
elseif GetResourceState('okokNotify') == 'started' then
Config.Notification = 'okokNotify'
elseif GetResourceState('ps-ui') == 'started' then
Config.Notification = 'ps-ui'
elseif GetResourceState('ox_lib') == 'started' then
Config.Notification = 'ox_lib'
else
Config.Notification = Config.Framework
if Config.Notification == 'standalone' or Config.Notification == 'vrp' then Config.Notification = 'chat' 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 == '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.-----
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
}
------------------------------------------------------------------------------------------------------
------------------------------------------- WEBHOOK URLS ---------------------------------------------
------------------------------------------------------------------------------------------------------
--56108 green
--16711680 red
--2061822 blue
--These are disabled by default, until you enter your discord webhooks.
local Webhook_Data = {
['create'] = {colour = 56108, webhook = 'CHANGE_ME'}, --When someone creates a new door.
['delete'] = {colour = 16711680, webhook = 'CHANGE_ME'}, --When someone deletes a door.
['edit'] = {colour = 2061822, webhook = 'CHANGE_ME'}, --When someone edits a door.
['add_import_data'] = {colour = 56108, webhook = 'CHANGE_ME'}, --When someone adds a import group.
['remove_import_data'] = {colour = 16711680, webhook = 'CHANGE_ME'}, --When someone removes a import group.
['remove_full_locationgroup'] = {colour = 16711680, webhook = 'CHANGE_ME'}, --When someone deletes a full location group.
}
------------------------------------------------------------------------------------------------------
------------------------------------------- WEBHOOK DATA ---------------------------------------------
------------------------------------------------------------------------------------------------------
function SendWebhook(source, action, data)
local webhook_data = Webhook_Data[action]
if webhook_data.webhook and #webhook_data.webhook > 10 then
local player_name = GetPlayerName(source) or L('unknown')
local identifier = GetIdentifier(source) or L('unknown')
local message
if action == 'create' or action == 'delete' or action == 'edit' then
message = string.format(L('webhook_message_1'), source, player_name, identifier, data.location_group, data.door_name, data.door_type)
elseif action == 'add_import_data' or action == 'remove_import_data' then
message = string.format(L('webhook_message_2'), source, player_name, identifier, data.name, #data.data)
elseif action == 'remove_full_locationgroup' then
message = string.format(L('webhook_message_3'), source, player_name, identifier, data.name, data.door_count)
end
local data = {{
['color'] = webhook_data.colour,
['title'] = L(action),
['description'] = message,
['footer'] = {
['text'] = os.date('%c'),
['icon_url'] = 'https://i.imgur.com/VMPGPTQ.png',
},
}}
PerformHttpRequest(webhook_data.webhook, function(err, text, headers) end, 'POST', json.encode({username = L('bot_name'), embeds = data}), { ['Content-Type'] = 'application/json' })
end
end
Last updated