Configs, Locales & SQL

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

if Config == nil then Config = {} end
function GetLocales(cd, ...) if Locales[Config.Language][cd] then return string.format(Locales[Config.Language][cd], ...) else print('Locale is nil ('..cd..')') end end
Config.KeyTable = { ['A'] = 34, ['B'] = 29, ['C'] = 26, ['D'] = 9, ['E'] = 38, ['F'] = 23, ['G'] = 47, ['H'] = 74, ['I'] = 311, ['J'] = 245, ['K'] = 311, ['L'] = 182, ['M'] = 244, ['N'] = 249, ['O'] = 199, ['P'] = 199, ['Q'] = 44, ['R'] = 45, ['S'] = 8, ['T'] = 245, ['U'] = 303, ['V'] = 0, ['W'] = 32, ['X'] = 73, ['Y'] = 246, ['Z'] = 20, ['1'] = 157, ['2'] = 158, ['3'] = 160, ['4'] = 164, ['5'] = 165, ['6'] = 159, ['7'] = 161, ['8'] = 162, ['9'] = 163, ['0'] = 159, ['NUMPAD0'] = 82, ['NUMPAD1'] = 79, ['NUMPAD2'] = 80, ['NUMPAD3'] = 81, ['NUMPAD4'] = 75, ['NUMPAD5'] = 76, ['NUMPAD6'] = 77, ['NUMPAD7'] = 71, ['NUMPAD8'] = 72, ['NUMPAD9'] = 73, ['F1'] = 288, ['F2'] = 289, ['F3'] = 170, ['F5'] = 166, ['F6'] = 167, ['F7'] = 168, ['F8'] = 169, ['F9'] = 56, ['F10'] = 57, ['LEFT'] = 174, ['RIGHT'] = 175, ['UP'] = 27, ['DOWN'] = 173, ['SPACE'] = 22, ['ENTER'] = 18, ['BACKSPACE'] = 177, ['TAB'] = 37, ['SHIFT'] = 21, ['CTRL'] = 36, ['ALT'] = 19, ['CAPS'] = 217, ['ESC'] = 200, ['HOME'] = 213, ['PAGEUP'] = 10, ['PAGEDOWN'] = 11, ['DELETE'] = 178, ['INSERT'] = 121, ['MOUSE1'] = 24, ['MOUSE2'] = 25, ['MOUSE3'] = 348, ['LEFTBRACKET'] = 39, ['RIGHTBRACKET'] = 40, ['MINUS'] = 84, ['EQUAL'] = 83, ['BACKSLASH'] = 85, ['SEMICOLON'] = 186, ['APOSTROPHE'] = 39, ['COMMA'] = 82, ['PERIOD'] = 81, ['SLASH'] = 84, ['TILDE'] = 243, ['LEFTCTRL'] = 36, ['RIGHTCTRL'] = 70, ['LEFTSHIFT'] = 21, ['RIGHTSHIFT'] = 229, ['LEFTALT'] = 19, ['RIGHTALT'] = 170, ['DPAD_UP'] = 172, ['DPAD_DOWN'] = 173, ['DPAD_LEFT'] = 174, ['DPAD_RIGHT'] = 175, ['A'] = 176, ['B'] = 177, ['X'] = 178, ['Y'] = 179, ['LB'] = 180, ['RB'] = 181, ['LT'] = 182, ['RT'] = 183, ['BACK'] = 184, ['START'] = 185, ['LS'] = 186, ['RS'] = 187, ['CHANGE_ME'] = 'CHANGE_ME' }


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


-- WHAT DOES 'auto_detect' DO?
-- The 'auto_detect' feature automatically identifies your framework, SQL database, notification and other resources, 
-- applying default settings based on what it detects.

Config.Framework = 'auto_detect' --[ 'auto_detect' ] Detects either ESX or QBCore frameworks.
Config.Database = 'auto_detect' --[ 'auto_detect' ] Detects MySQL, GHMattimysql, or Oxmysql SQL resources.
Config.Notification = 'esx' --[ 'auto_detect' / 'other' ] Detects ESX, QBCore, cd_notifications, okokNotify, ps-ui, and ox_lib. Use 'other' for custom notifications.
Config.Inventory = 'auto_detect' --[ 'auto_detect' ] Detects the inventory resource automatically.
Config.AutoInsertSQL = true -- If true, automatically inserts the necessary SQL tables. Set to false if you've already done this.
Config.Language = 'EN' --[ 'EN' ] You can add your own locales in Locales.lua and update this to match your custom language code.

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


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


Config.Debug = false -- Set to true to enable debug prints (for troubleshooting and development purposes).
Config.EnableTestCommand = true -- (/dispatchtest) Set to true to enable the test command (for troubleshooting and development purposes).

Config.AllowedJobs = { --Jobs who are allowed to use the dispatch.
--This will group different jobs together. Eg., so 2 jobs {'police', 'ambulance'} can both see can see each other on the dispatch UI and the pause menu/mini-map blips.
    {'police', 'ambulance'}, --police & ambulance group
    {'mechanic', }, --mechanic group
    --{'1st_job', '2nd_job', }, --add more here
}

Config.Perms = {
    Dispatcher = { --The permissions table for those who can be a dispatcher, based off jobs and job grades.
        ['police'] = { 0, 1, 2, 3 } ,
        ['sheriff'] = { 0, 1, 2, 3 } ,
        ['ambulance'] = { 0, 1, 2, 3 },
        ['fire'] = { 0, 1, 2, 3 },
        ['mechanic'] = { 0, 1, 2, 3 },
    },

    Planner = { --The permissions table for those who can use the planner, based off jobs and job grades.
        ['police'] = { 0, 1, 2, 3 } ,
    },
}

Config.AntiCheat = {
    ENABLE = true, --Enable or Disable all of the built in anti cheat features?
    
    BannedWords = { --This feature will kick and send a message in your discord if any banned words are detected in a notification or /911 call.
        ENABLE = true, --Enable or Disable this feature?
        discord_tag_everyone = true, --Tag @ everyone who has access to your discord webhook channel?
        banned_words = {'fuck', } --A table of banned words.

    },

    EventSpam = { --This feature will detect events being spammed by lua injectors or mod menus.
        ENABLE = true, --Enable or Disable this feature?
        discord_tag_everyone = true, --Tag @ everyone who has access to your discord webhook channel?
        threshold = { --If x amount of 'events' are triggered within x amount of 'time' this player will be flagged for modding.
            events = 5, --(in seconds)
            time = 3 --(in seconds)
        }
    }
}


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


Config.Dispatcher = {
    ENABLE = true, --Do you want to use the build in dispatcher system? (this is optional)
    notify_activity = true, --Do you want players to be notified when a dispatcher comes online/goes offline?
    VoipResource = 'toko' ---[ 'toko' / 'mumble' / 'pmavoice' / 'other' ] Choose your servers voip resource.
}

Config.Ping = {
    ENABLE = true, --Do you want to allow players who have access to the dispatch to ping their location to other players of the same job?
    command = 'dispatchping', --The chat command.
    key = '', --The key press. You can choose other keys here - https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/.
    cooldown = 10, --(in seconds) This cooldown is to prevent a player spamming pings.
}

Config.PanicButton = {
    ENABLE = true, --Do you want to allow dispatch users to use the built-in panic button?
    command = 'panic', --The chat command.
    key = '', --The key press. This is not used by default. You can choose keys here - https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/.
    job_table = {'police', 'ambulance', }, --A list of jobs who can use the panic button. (every job in this list will be notified if a panic button is pressed).
    cooldown = 10, --(in seconds) This cooldown is to prevent a player spamming the panic button.
    play_sound_in_distance = true --Do you want the panic button sound to play to all nearby players?
}

Config.GpsTracker = { -- Used for kidnapping scenarios, if the gps tracker item is removed from a players inventory they will no longer have access to use the dispatch features and their player blips will be hidden from others view.
    ENABLE = false, -- Enable or disable the GPS tracker feature.
    item_name = 'gpstracker', -- The name of the inventory item.
    item_check_timer = 10, -- Time in seconds to check for the item in the inventory.
    AllowedJobs = { -- Jobs that are allowed to use the GPS tracker features.
        'police',
        'ambulance',
    }
}

Config.UpdateDistanceToCall = { -- This will update the distance from the player to the call location automatically every x amount of seconds.
    ENABLE = true, --Do you want to use auto update distance?
    time = 2 --(in seconds) How often the distance should be updated.
}

Config.AutoUpdatePlayerCoordinates = { -- This will update players coordinates on the UI map automatically every x amount of seconds. Only updates when a player is using the ui.
    ENABLE = true, --Do you want to use auto update player blips?
    time = 5, --(in seconds) How often the blips should be updated.
}

Config.FollowPlayer = { -- In the map UI, you have the ability to follow a players movements.
    ENABLE = true, --To improve optimisation you can disable this feature.    
    time = 500, --(in ms) How often the coordinates for the 1 player you are following should be updated. Lower is smoother but uses more resources. Max recommended is 1000.
}

Config.HeatMap = { -- This will show the most active areas on the map (where most calls are made).
    ENABLE = true, --Do you want to use the heat map feature?
    limit_calls = 100, --The amount of calls to store in the heat map.
}

Config.AfkTimer = {  -- This will set a player's status to AFK if they are not moving for a certain amount of time.
    ENABLE = true, --Do you want to use the AFK timer?
    time = 10, --(in minutes) How often the player should be checked for AFK status.
}

Config.NotifyStatusChange = true --Do you want players to be notified when another player changes their status? (eg., from Available to Unavailable).
Config.DispatchCallExipryTime = 60 --(in minutes) How long a call should last before it expires.
Config.HideSmallUIWhenOtherOpen = true --Do you want the small UI to be hidden when other UI's are open? (this will prevent the small UI from being hidden when the large UI is open).


-- ┌──────────────────────────────────────────────────────────────────┐
-- │                              BLIPS                               │
-- └──────────────────────────────────────────────────────────────────┘


Config.PauseMenuBlips = {
    ENABLE = true, --Do you want to use the built in player blips (on the pause menu & mini-map)?
    data_update_timer = 3, --(in seconds) How many seconds should the blip data from the server side be sent to the client side to be updated?
    blip_type = 'auto', --You can choose 3 different methods for displaying the player blips.
    --'static' = Players will all have the same standard player blip.
    --'auto' = Blips will change automatically depending on the vehicle type. (CAN CAUSE HIGH RESOURCE USAGE!).
    flashing_blips = true, --Do you want blips to flash when a player's vehicle has it's emergancy lights enabled?
    bundle_blips = false, --Do you want to bundle the blips together so they do not spam the pause menu legend?
    radiochannel_on_blips = true, --Do you want a players radio chanel to be displayed on blips?
    minimize_longdistance_blips = true, --Do you want long distance blips to be minimized(smaller size) on the mini-map instead of them being hidden?
    
    blip_sprites = { --These are the blip sprites (icons). More blips can be found here - https://docs.fivem.net/docs/game-references/blips.
        ['static']       = 1,
        ['foot']         = 1,
        ['car']          = 56,
        ['motorcycle']   = 226,
        ['helicopter']   = 43,
        ['boat']         = 427,
    },

    blip_colours = { --If you add more jobs, you need to add them here too. More colours can be found at the bottom of this page - https://docs.fivem.net/docs/game-references/blips.
        --pausemenu_blip_colour: The colour of the player blips on the gta mini-map and pause menu. The 1st one is the default colour and the 2nd one is the flashing colour.
        ['police']      = {3, 1},
        ['sheriff']     = {3, 1},
        ['ambulance']   = {1, 0},
        ['fire']        = {1, 0},
        ['mechanic']    = {2, 0},
        --['CHANGE_ME'] = {3, 1},
    }
}


-- ┌──────────────────────────────────────────────────────────────────┐
-- │                        JOB CALL COMMANDS                         │
-- └──────────────────────────────────────────────────────────────────┘


Config.JobCallCommands = { 
    ENABLE = true,--Do you want to use the job chat commands eg., /911 to send a notification to the police.

    --label: The job display label.
    --command: The chat command.
    --job_table: The jobs who can see the calls. (you can add multiple).
    Civilian_Commands = {
        { command = '911',          job_label = 'Police',       job_table = {'police', } },
        { command = '911ems',       job_label = 'Ambulance',    job_table = {'ambulance', } },
        { command = 'mechanic',     job_label = 'Mechanic',     job_table = {'mechanic', } },
        --{ job_label = 'CHANGE_ME',      command = 'CHANGE_ME',  job_table = {'police', } },
    },
    
    JobReply_Command = 'reply' --The chat command for the jobs above^ to reply to incomming calls.
}


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


Config.small_ui = {
    ENABLE = true, --Do you want to enable the small UI?
    command = 'dispatchsmall', --The chat command.
    key = 'u' --The key press. You can choose other keys here - https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/.
}

Config.large_ui = {
    ENABLE = true, --Do you want to enable the large map UI?
    command = 'dispatchlarge',
    key = 'l'
}

Config.respond = {
    ENABLE = true, --Do you want to enable the units responding feature?
    command = 'respond',
    key = 'g'
}

Config.small_ui_left = {
    ENABLE = true, --Do you want to enable the small UI left scroll?
    command = 'scrollleft',
    key = 'left'
}

Config.small_ui_right = {
    ENABLE = true, --Do you want to enable the small UI right scroll?
    command = 'scrollright',
    key = 'right'
}


-- ┌──────────────────────────────────────────────────────────────────┐
-- │                          POLICE ALERTS                           │
-- └──────────────────────────────────────────────────────────────────┘


Config.PoliceAlerts = {
    ENABLE = true, --Do you want to use the built in police alerts?
    police_jobs = {'police', }, --The jobs who will be notified from these police alerts.
    whitelisted_jobs = {'ambulance', }, --These jobs will NOT trigger these police alerts.
    cooldown = 30, --(in seconds) This cooldown is to prevent alerts from being spammed by the same player.
    add_bolos = true, --(requires cd_radar) Do you want to add a bolo for the vehicle that was used in the crime?
    require_witness_peds = {
        ENABLE = true, --Do you want police alerts only to be sent if a witness (npc ped) is in the area?
        distance = 30, --The distance to check for witnesses.
        time_to_kill = 10, --(in seconds) You have x amount of seconds to kill/injure the ped(s) calling the police before the call is complete.
    },

    --[[GUNSHOTS CONFIG]]--
    GunShots = {
        ENABLE = true, ---Do you want gunshots to alert police?
        
        WhitelistedZones = { --Shooting in whitelisted areas doesn't alert police.
            [1] = {coords = vector3(13.98, -1098.05, 29.8), distance = 20}, --Legion gunrange.
            [2] = {coords = vector3(821.09, -2163.46, 78.67), distance = 20}, --Cypress Flats gunrange.
            --[3] = {coords = vector3(0, 0, 0), distance = 10},
        },
        WhitelistedWeapons = { --Shooting whitelisted weapons doesn't alert police.
            [`WEAPON_FLARE`] = true,
            [`WEAPON_FLAREGUN`] = true,
            [`WEAPON_FIREEXTINGUISHER`] = true,
            [`WEAPON_PETROLCAN`] = true,
            [`WEAPON_STUNGUN`] = true,
            --[`ADD_MORE_HERE`] = true,
        },
    },

    --[[SPEEDTRAP CONFIG]]--
    SpeedTrap = {
        ENABLE = true, ----Do you want speeding vehicles to alert police?
        check_owner_for_fine = true, --Only fine players if they own the vehicle they are in? (if enabled, players in stolen cars will not be fined).

        Blip = {
            ENABLE = true, --Do you want speed traps to display on a players minimap?
            sprite = 184, --Icon of the blip.
            scale = 0.7, --Size of the blip.
            colour = 0, --Colour of the blip.
            display = 5, --Set to [4] to display on the pause menu map or [5] to only display on the mini-map.
            name = GetLocales('speedtrap_blip_name') --Change this in the locales.lua, not here.
        },

        Locations = {
            --coords: The location of the speed trap.
            --distance: The distance a player must be from the 'coords^' to alert the speed trap. 
            --speed_limit: The minimum speed to alert the speed trap (in MPH). 
            --fine_amount: The amount the player will be fined (set to 0 to not fine a player).
            [1] = {coords = vector3(1051.42, 331.11, 84.00), distance = 9, speed_limit = 150, fine_amount = 500 }, --LS Freeway.
            [2] = {coords = vector3(544.43, -373.24, 33.14), distance = 9, speed_limit = 150, fine_amount = 5000 }, --Into Legion.
            [3] = {coords = vector3(-2612.10, 2940.81, 16.67), distance = 15, speed_limit = 150, fine_amount = 1000 }, --Zancuda.
            [4] = {coords = vector3(287.94, -517.44, 42.89), distance = 15, speed_limit = 100, fine_amount = 500 }, --Pillbox.
            [5] = {coords = vector3(2792.73, 4407.68, 48.44), distance = 24, speed_limit = 150, fine_amount = 1000 }, --Sandy Freeway.
            [6] = {coords = vector3(577.11, -1028.32, 37.07), distance = 15, speed_limit = 100, fine_amount = 1000 }, --Mission Row.
            [7] = {coords = vector3(114.83, -797.89, 30.97), distance = 15, speed_limit = 100, fine_amount = 2000 }, --Legion Square.
            [8] = {coords = vector3(74.33, -163.30, 54.67), distance = 15, speed_limit = 100, fine_amount = 4000 }, --Pink Cage.
            [9] = {coords = vector3(28.19, -971.05, 28.96), distance = 15, speed_limit = 100, fine_amount = 1000 }, --PDM.
            --[10] = {coords = vector3(0, 0, 0), distance = 15, speed_limit = 50, fine_amount = 1000 },
        }
    },

    --[[CAR CRASH CONFIG]]--
    CarCrash = {
        ENABLE = true, ----Do you major car crashes to alert police?
        minimum_crash_speed = 10, --(in mph) Only count crashes at or above this speed.
    }
}

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


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

function GetMultiJob(job)
    for cd = 1, #Config.AllowedJobs do
        for c, d in pairs(Config.AllowedJobs[cd]) do
            if d == job then
                return Config.AllowedJobs[cd]
            end
        end
    end
    return false
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.qbcore.resource_name) == 'started' then
        Config.Framework = 'qbcore'
    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.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('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
        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' or Config.Framework == 'qbcore' then
            Config.Inventory = Config.Framework
        end
    end
end

if Config.Framework == 'esx' then
    Config.FrameworkSQLtables = {
        vehicle_table = 'owned_vehicles',
        vehicle_identifier = 'owner',
    }
elseif Config.Framework == 'qbcore' then
    Config.FrameworkSQLtables = {
        vehicle_table = 'player_vehicles',
        vehicle_identifier = 'citizenid',
    }
end

if Config.AntiCheat.ENABLE == false then
    Config.AntiCheat.BannedWords.ENABLE = false
    Config.AntiCheat.BannedWords.EventSpam = false
end
-----DO NOT TOUCH ANYTHING ABOVE THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING.-----

Last updated

Was this helpful?