Configuration

This section includes all configurable files for the selected script. Most settings are configured automatically, but each config.lua file contains a header comment explaining the purpose and usage of every configuration type. Be sure to read the header of each file carefully to fully understand how to customize and adapt the system for QBCORE, ESX, or standalone environments, ensuring seamless integration with your server.


qs-truckjob/config/config.lua
---@generic T
---@param data {[string]: string}
---@return string | false
local function dependencyCheck(data)
	for k, v in pairs(data) do
		if GetResourceState(k):find('started') ~= nil then
			return v
		end
	end
	return false
end


Config = {}

--[[
    Framework Detection System:

    This script automatically detects if you're using 'es_extended' (ESX), 'qb-core' (QBCore),
    or 'qbx_core' frameworks. It configures itself based on the detected framework.

    If you've renamed your framework or are using a custom version, do NOT remove the value
    from `Config.Framework`. Instead, follow these steps:

    1. **Create a new framework file**:
        - Add your custom framework logic by creating new files in the following directories:
          - `client/custom/framework/`
          - `server/custom/framework/`

    2. **Modify the detection logic**:
        - You can then adapt the framework detection and customization logic within those files
          to match your specific framework setup.

    Remember: This detection is automatic and should not be edited unless you are certain of the
    changes you're making. Incorrect modifications could cause issues with the functionality.
]]

local frameworks = {
	['es_extended'] = 'esx',
	['qb-core'] = 'qb',
	['qbx_core'] = 'qb'
}

Config.Framework = dependencyCheck(frameworks) or 'standalone'

--[[
    Inventory System Integration:

    This feature allows you to add a personalized stash for each property in the housing asset.
    The system is designed to automatically detect which inventory system your server uses.

    Supported inventory systems include popular frameworks such as ESX, QBCore, and others.

    If your inventory system is not on the supported list, don't worry! You can manually configure
    your inventory by editing the files located in:
        `client/custom/inventory/*.lua`

    If you need further assistance or run into issues, feel free to contact the seller of the asset
    for guidance and support.
]]

local inventories = {
	['qs-inventory'] = 'qs-inventory',
	['qb-inventory'] = 'qb-inventory',
	['ps-inventory'] = 'ps-inventory',
	['ox_inventory'] = 'ox_inventory',
	['core_inventory'] = 'core_inventory',
	['codem-inventory'] = 'codem-inventory',
	['inventory'] = 'inventory',
	['origen_inventory'] = 'origen_inventory',
	['tgiann-inventory'] = 'tgiann-inventory',
}

Config.Inventory = dependencyCheck(inventories) or 'default'

--[[
    Dispatch System Integration:

    This feature allows you to customize how calls and alerts are managed for each supported
    dispatch resource within this asset. The system is designed to automatically detect which
    dispatch system is currently in use on your server.

    Supported dispatch systems include popular frameworks. The detection is done automatically
    based on the resource state.

    If your dispatch system is not listed or automatically detected, you can manually configure it
    by editing the files located in:
        `client/custom/dispatch/*.lua`

    For any questions or concerns, please contact the seller of the asset for further assistance.
]]

local dispatch = {
	['qs-dispatch'] = 'qs-dispatch'
}

Config.Dispatch = dependencyCheck(dispatch) or 'default'

--[[
    Phone System Integration:

    This feature allows us to manage phone-related functions for the asset's sale board,
    ensuring smooth communication and interaction with players. The system is designed
    to automatically detect which phone system is currently in use.

    Popular phone systems are automatically detected based on your server configuration.

    If your phone system is not listed or detected, you can manually configure it by editing
    the necessary files located in:
        `server/custom/phone/*.lua`

    For any questions or support, feel free to contact the seller of this asset for further assistance.
]]

local phones = {
	['qs-smartphone-pro'] = 'qs-smartphone-pro',
	['qs-smartphone'] = 'qs-smartphone',
	['lb-phone'] = 'lb-phone',
	['gksphone'] = 'gksphone',
	['okokPhone'] = 'okokPhone',
	['roadphone'] = 'roadphone',
	['codem-phone'] = 'codem-phone'
}

Config.Phone = dependencyCheck(phones) or 'default'

--[[
    Wardrobe System Integration:

    This function is responsible for the automated configuration of the wardrobe system,
    detecting which wardrobe system is currently in use on your server and setting it
    automatically for this asset.

    If your wardrobe system is not detected or listed here, you can manually configure it
    by editing the relevant files located in:
        `client/custom/wardrobe/*.lua`

    If you have any questions or need assistance, please contact the seller of your asset for support.
]]

local wardrobes = {
	['qs-appearance'] = 'qs-appearance',
	['qb-clothing'] = 'qb-clothing',
	['codem-appearance'] = 'codem-appearance',
	['ak47_clothing'] = 'ak47_clothing',
	['fivem-appearance'] = 'fivem-appearance',
	['illenium-appearance'] = 'illenium-appearance',
	['raid_clothes'] = 'raid_clothes',
	['rcore_clothes'] = 'rcore_clothes',
	['rcore_clothing'] = 'rcore_clothing',
	['sleek-clothestore'] = 'sleek-clothestore',
	['tgiann-clothing'] = 'tgiann-clothing',
	['p_appearance'] = 'p_appearance'
}

Config.Wardrobe = dependencyCheck(wardrobes) or 'default'

--[[
    Garage System Configuration:

    This function handles the automatic configuration of the garage system on the server.
    If your server does not use a compatible garage system, or if you haven't created
    a compatible custom garage system in the server files, the option to use garages
    will automatically be disabled.

    To enable garages, you can create or configure a compatible system by editing the files located in:
        `server/custom/garage/*.lua`

    If you have any questions or need help configuring your garage system, contact the seller
    of your asset for further assistance.
]]

local garages = {
	['qb-garages'] = 'qb-garages',
	['qs-advancedgarages'] = 'qs-advancedgarages',
	['jg-advancedgarages'] = 'jg-advancedgarages',
	['cd_garage'] = 'cd_garage',
	['okokGarage'] = 'okokGarage',
	['loaf_garage'] = 'loaf_garage',
	['rcore_garage'] = 'rcore_garage',
	['zerio-garage'] = 'zerio-garage',
	['codem-garage'] = 'codem-garage',
	['ak47_garage'] = 'ak47_garage',
	['ak47_qb_garage'] = 'ak47_qb_garage',
	['vms_garagesv2'] = 'vms_garagesv2',
	['cs-garages'] = 'cs-garages',
	['msk_garage'] = 'msk_garage',
	['RxGarages'] = 'RxGarages'
}

Config.Garage = dependencyCheck(garages) or 'standalone'



Config.RequireJob                 = false -- True if you want it to require a job, false to not require any job

Config.TruckDriverJob             = {     -- List of jobs that can interact with the mining job. Set to true to enable interaction. Multiple jobs can be included, but they must be set to true to function.
    ['truck_driver'] = true,
    --['jobname'] = true,
}

Config.Target                     = true -- If you want to use target script

Config.TargetScript               = 'ox' -- "ox" or "qb"

Config.Keys                       = {
    InteractKey      = 38,  --    "E"
    OpenStatsMenu    = 'n', -- "N" Key to open stats menu
    OpenStatsMenuNew = 249  -- "N"
}

Config.QuasarInventory            = false                 -- Config for clothing.lua file

Config.Fuel                       = false                 -- Enable/Disable fuel when spawning work vehicle

Config.FuelExport                 = exports['LegacyFuel'] -- Your fuel script exports

Config.SpawnInsideVehicle         = false                 -- Spawn inside vehicle

Config.EnableBlip                 = true                  -- True if you want to enable blips

Config.StartJob                   = {                     -- Ped job coords and model
    ped = {
        coords = vector4(880.3692, -929.8097, 26.2824, 83.4865),
        model = 's_m_m_gaffer_01'
    }
}

Config.VehicleSpawnCoords         = { -- Vehicle spawn coords
    [1] = vector4(872.8778, -945.5803, 26.2770, 0.6631),
}

Config.DeliverTruckCoords         = vector3(884.6695, -924.3762, 26.2824) -- Coords to deliver truck after finishing route

Config.VehicleModels              = {                                     -- Possible vehicle models
    'packer',
    -- "hauoler",
    -- "phantom",
}

Config.TrailerModels              = { -- Possible trailer models
    'docktrailer',
    -- "trailers",
    -- "trailers3",
    -- "trailers4",
}

Config.Blip                       = { text = 'Truck Yard', sprite = 477, size = 1.0, color = 56, display = 2 } -- Ped blip

Config.RouteBlip                  = { sprite = 1, size = 1.0, color = 3 }                                      -- Route blips

Config.DrawText3D                 = true                                                                       -- True if you want to use drawtext

Config.ExperiencePerHundredMeters = 10                                                                         -- Amount of experience received for every 100 meters from pikcup spot to drop spot (e.g 1km = 10 experience with value 10)

Config.ChanceToGetIllegalJob      = 20                                                                         -- The chance players have to receive an illegal route offer

Config.IlegalRouteMultiplier      = 2.0                                                                        -- The extra money given if the person do the illegal route (e.g x2)


Config.LevelExperience      = {
    BaseExperience = 1000,         -- Base experience required for level 1
    GrowthFactor = 1.1,            -- How much the experience required increases with each level, allowing for infinite leveling (e.g., 10% more xp per level)
    MoneyPerHundredMeters = 10,    -- Base money for each 100 meters for level 1
    GrowthFactorMoney = 1.02,      --  How much the money received for each 100 meters increases with each level (e.g 2% more money per level)
    PoliceAlertChance = 90,        -- Base chance to alert the police in case of illegal ride for level 1 (e.g 20% chance)
    GrowthFactorPoliceAlert = 0.99 -- How much the police alert chance will be reduced for each level (e.g 1% less chance per level)
}

Config.DefaultNotifications = true -- False if you have a custom notify system


function SendTextMessage(msg, type)
    if type == 'info' then
        -- VANILLA NOTIFY
        -- SetNotificationTextEntry('STRING')
        -- AddTextComponentString(msg)
        -- DrawNotification(0, 1)

        -- CUSTOM NOTIFY
        -- exports["Notify"]:Alert(msg, type)
    end
    if type == 'error' then
        -- VANILLA NOTIFY

        -- SetNotificationTextEntry('STRING')
        -- AddTextComponentString(msg)
        -- DrawNotification(0, 1)

        -- CUSTOM NOTIFY
        -- exports["Notify"]:Alert(msg, type)
    end
    if type == 'success' then
        -- VANILLA NOTIFY
        -- SetNotificationTextEntry('STRING')
        -- AddTextComponentString(msg)
        -- DrawNotification(0, 1)

        -- CUSTOM NOTIFY
        -- exports["Notify"]:Alert(msg, type)
    end
end

Config.TrailerLocations = {
    vec4(1062.2780, -3185.4834, 5.9017, 182.6632),
    vec4(1058.3553, -3185.7249, 5.9017, 182.5830),
    vec4(1054.0912, -3185.7749, 5.9018, 182.2451),
    vec4(1050.4933, -3185.7305, 5.9015, 182.4844),
    vec4(1046.2861, -3185.7974, 5.9010, 182.9360),
    vec4(1042.1545, -3185.7710, 5.9010, 182.7081),
    vec4(1038.1793, -3185.7463, 5.9011, 182.7922),
    vec4(1034.1141, -3185.6738, 5.9011, 182.2135),
    vec4(1030.0134, -3185.7703, 5.9011, 182.7078),
    vec4(1026.2279, -3185.8518, 5.9010, 182.2723),
    vec4(1021.8876, -3185.8699, 5.9010, 182.6289),
    vec4(1017.7211, -3185.9458, 5.9010, 182.4932),
    vec4(1013.6997, -3185.9106, 5.9010, 182.7469)
}

Config.DeliveryLocations = {
    vec3(827.5778, -3207.5474, 5.8834),
    vec3(834.9925, -3209.2573, 5.9008),
    vec3(213.7293, -1868.9547, 26.6473),
    vec3(-159.0339, -1302.5842, 31.3159),
    vec3(-70.3560, -1262.3068, 29.0014),
    vec3(-495.3861, -64.0311, 39.8979),
    vec3(-1451.7798, -366.7823, 43.5002),
    vec3(-928.1689, -1282.7947, 5.0613),
    vec3(-598.3428, -1586.3158, 26.727),
    vec3(-65.3180, -2224.5164, 7.8343),
    vec3(-1142.25, 2680.74, 18.1),
    vec3(-1782.78, -379.43, 44.98),
    vec3(-675.84, -2390.05, 13.85)
}

Config.IllegalLocations = {
    vec3(1146.474731, -3113.090088, 5.791260),
    vec3(-1267.14, -820.18, 17.1),
    vec3(-744.11, -1504.82, 4.98),
    vec3(-1151.9, -205.66, 37.96),
    vec3(-827.32, -1263.61, 5.0)
}

Config.DispatchExport = function()
    -- exports['qs-dispatch']:SuspiciousActivity() -- Example of dispatch export
end

Config.LeaderBoardCoords = vector4(878.3260, -933.2770, 26.2824, 232.2003) -- Leaderboard coords

Config.UpdateLeaderboard = 1                                               -- Minutes between next leaderboard update


Config.LeaderBoardRewards = { -- Leaderboard rewards
    Daily = {                 -- Resets at 00:00 server hour
        [1] = 500,            --1st Place
        [2] = 350,            --2nd Place
        [3] = 200             --3rd Place
    },
    Season = {                -- Resets at 00:00 server hour the first day of every month
        [1] = 5000,
        [2] = 3500,
        [3] = 2000
    }
}

Config.MenuColors = {
    background1 = 'radial-gradient(56.16% 56.16% at 50% 43.84%, rgba(0, 120, 200, 0.9) 0%, rgba(0, 70, 110, 0.9) 98%)',
    boxshadow1 = 'rgb(0, 163, 255) 0px 0px 31.99px 0px',
    background2 = 'radial-gradient(56.16% 56.16% at 50% 43.84%, rgba(0, 20, 40, 0.9) 0%, rgba(0, 10, 20, 0.9) 98%)',
    boxshadow2 = 'rgb(0, 20, 40) 0px 0px 150px 30px'
}