# Configuration Files

## 1. Adjust config.lua to your server core

{% tabs %}
{% tab title="ESX" %}

1. Adjusting the script to your server core

```lua
Config.Core = "ESX"
Config.CoreExport = function()
    return exports['es_extended']:getSharedObject()
end
```

2. Adjusting the PlayerLoaded trigger from server core to the script

```lua
Config.PlayerLoaded = "esx:playerLoaded"
```

3. Adjusting the PlayerLogoutServer trigger from server core to the script

```lua
Config.PlayerLogoutServer = "esx:playerDropped"
```

4. Adjusting the PlayerSetJob trigger from server core to the script

```lua
Config.PlayerSetJob = "esx:setJob"
```

5. Adjust the Menu to your menu script

```lua
Config.Menu = 'esx_context' -- 'esx_menu_default' / 'esx_context' / 'ox_lib'
Config.ESXMenuDefault_Align = 'right'
```

{% endtab %}

{% tab title="QB-Core" %}

1. Adjusting the script to your server core

```lua
Config.Core = "QB-Core"
Config.CoreExport = function()
    return exports['qb-core']:GetCoreObject()
end
```

2. Adjusting the PlayerLoaded trigger from server core to the script

```lua
Config.PlayerLoaded = "QBCore:Client:OnPlayerLoaded"
```

3. Adjusting the PlayerLogoutServer trigger from server core to the script

```lua
Config.PlayerLogoutServer = "QBCore:Server:OnPlayerUnload"
```

4. Adjusting the PlayerSetJob trigger from server core to the script

```lua
Config.PlayerSetJob = "QBCore:Client:OnJobUpdate"
```

5. Adjust the Menu to your menu script

```lua
Config.Menu = 'qb-menu' -- 'qb-menu' / 'ox_lib'
Config.ESXMenuDefault_Align = 'right'
```

<br>
{% endtab %}
{% endtabs %}

## 2. Adjust config.lua to server preferences

{% tabs %}
{% tab title="Preferences" %}
Several options are available for interacting with the point

```lua
Config.UseMarkers = true
Config.UseText3D = true
Config.UseHelpNotify = true
```

**LoadPricesFromDatabase**: You can load vehicle prices from the database to automate the configuration process, but make sure that your database match to the function SV.getPricesFromDatabase in config.server.lua

```lua
Config.LoadPricesFromDatabase = false
```

**LiveriesUseCustomNames**: When using this option, it will search if a name other than NULL exists, if found, it will display the custom name, otherwise, it will set 'Livery ID' as before.

```lua
Config.LiveriesUseCustomNames = true
```

**RemoveGunsTuningMods**: Do you want tuning parts that add weapons to the vehicle to be automatically detected and removed from the purchase option

```lua
Config.RemoveGunsTuningMods = true
```

**DefaultVehiclePrice**: Default price if the vehicle is not defined in Config.Vehicles (config.vehicles.lua)

```lua
Config.DefaultVehiclePrice = 50000
```

**UseDiscountCodes**: Do you want it to be possible to use the discount code for tuning

```lua
Config.UseDiscountCodes = true
```

**DiscountCodeLength**: from how many characters the code will be generated

```lua
Config.DiscountCodeLength = 12
```

**EnableDiscountsForWorkshops**: This allows in the boss-menu to create discount codes for the heads of tuning workshops

```lua
Config.EnableDiscountsForWorkshops = true
```

**DiscountCodesPercentages**: Percentages available to generate codes in boss menu for player

```lua
Config.DiscountCodesPercentages = {5, 10, 15, 20}
```

**DiscountCodesUsablesCount**: Number of coupons available to generate codes in player's boss menu

```lua
Config.DiscountCodesUsablesCount = {1, 2, 3, 4, 5, 10, 15, 20}
```

**AdminDiscountCodesCommand**: Commands for administrators to generate and delete discount codes

```lua
Config.AdminDiscountCodesCommand = {
    generate = {
        enabled = true,
        commandName = "generatetuningcode",
        argumentsLabels = {
            [1] = "Code name or 0 - if you want to be random", 
            [2] = "Mechanic Point name or all", 
            [3] = "Percentage of discount", 
            [4] = "Count to use"
        },
        helpLabel = "Generate a discount code for tuning.",
        groups = "admin", -- example: string: "admin" or table: {"admin", "moderator"}
    },
    remove = {
        enabled = true,
        commandName = "removetuningcode",
        argumentsLabels = {
            [1] = "Code name"
        },
        helpLabel = "Remove tuning discount code by name.",
        groups = "admin", -- example: string: "admin" or table: {"admin", "moderator"}
    }
}
```

**UseBuildInCompanyBalance**: If you don't want to use the balance built into the Management Menu, set this to false and configure config.server.lua to be compatible with your server, for example a script for banks that may have company accounts

```lua
Config.UseBuildInCompanyBalance = true
```

**BillMoneyToSocietyPercent**: Do you want the company to receive a % from paid billing of tuning a vehicle?

```lua
Config.BillMoneyToSocietyPercent = 80
```

**BillMoneyToTunerPercent**: Do you want the tuner to receive a % from paid billing of tuning a vehicle?

```lua
Config.BillMoneyToTunerPercent = 20
```

**AddSocietyMoneyForTuningPercent**: Do you want the company to receive a % from price of tuning a vehicle?

```lua
Config.AddSocietyMoneyForTuningPercent = 10 -- number or false
```

**UseTuningPoints**: Do you want to use the points provided by the vms\_tuning resource, if you want to use export with another resource set false

```lua
Config.UseTuningPoints = true -- true / false
```

Prepare tuning points accordingly

{% hint style="info" %}
**Described options available for Config.TuningPoints**

> **`jobGradesToSet`** - list of possible grades to be given by the boss/manager in the management menu

> **`client_can_select_tuning`** - With this option activated, it is recommended to use manual installation by a mechanic, because the player will be able to drive to the tuning point, select the parts he is interested in and pay for them himself, then the nearest mechanic is searched for him to install the parts he has selected.

> **`send_bill_to_player`** - This option when paying for tuning adds a "BILL" button which allows the mechanic to issue a bill to the customer and he will be the one to make the payment of a given amount

> **`pay_from_society`** - Payment with company money

> **`society_name`** - Company account name, e.g. 'society\_mechanic'

> **`job`** - Name of the job that will have access to the ability to interact with tuning points.

> **`grades_access`** - The names of the grades of jobs that have access to the tuning point, you can set them in a table for several, for example {'gradename', 'gradename2'}, as a string for one grade - 'gradename' or set nil as for each player with job.

> **`manager_grades`** - managers grades so that the script can identify a player as a manager and grant him additional options in the management menu

> **`bossmenu_grades_access`** - boss grades so that the script can identify a player as a manager and grant him additional options in the management menu
> {% endhint %}

```lua
Config.TuningPoints = {
    ['BennyS'] = {
        -- BennyS: Interior Benny'S.
        blip = {
            enabled = true,
            sprite = 72,
            display = 4,
            scale = 0.85,
            color = 83,
            coords = vec(-222.41, -1329.52, 29.89),
            name = "Tuning",
        },
        marker = {
            enabled = true,
            id = 1,
            size = vec(2.7, 2.7, 0.25),
            color = {r=87, g=60, b=250, a=125},
            rotate = false,
            distanceToSee = 15.0,
            distanceToAccess = 1.9
        },
        markerBossMenu = {
            enabled = true,
            id = 29,
            coords = vector3(-197.97, -1341.61, 34.7),
            size = vec(0.55, 0.55, 0.55),
            color = {r=87, g=60, b=250, a=125},
            rotate = true,
            distanceToSee = 15.0,
            distanceToAccess = 1.3,
        },
        whitelist = {
            -- vehicleClasses = {},
            -- indexedColors = {},
            -- menus = {},
            -- parts = {},
            -- actions = {},
        },
        blacklist = {
            -- vehicleClasses = {},
            -- indexedColors = {},
            -- menus = {},
            -- parts = {},
            -- actions = {},
        },
        points = {
            vector3(-222.41, -1329.52, 29.89),
            vector3(-223.26, -1323.21, 29.89),
        },
        jobGradesToSet = {
            {grade = 'recruit', label = 'Recruit'},
            {grade = 'employee', label = 'Employee'},
            {grade = 'manager', label = 'Manager', needToBeBoss = true}, -- needToBeBoss means that only the boss can give this grade, the manager will not be able to do so
            {grade = 'boss', label = 'Boss', needToBeBoss = true}, -- needToBeBoss means that only the boss can give this grade, the manager will not be able to do so
        },

        vehicleSpawn = vector4(-181.4, -1289.19, 30.3, 175.67),
        
        client_can_select_tuning = false, -- this causes each player to be able to select parts for his vehicle, then when paying, he selects the nearest mechanic who will install all the selected parts for him

        send_bill_to_player = true,

        pay_from_society_money = false, -- Do you want the payment to be made with money from the society, if so, you need to enter the account name in society_name
        society_name = 'society_mechanic', -- Society name will be requiered for pay_from_society_money or for Config.AddSocietyMoneyForTuningPercent or for Config.BillMoneyToSocietyPercent | example: 'society_mechanic',
        
        job = 'mechanic', -- not required if you want to use this public.
        grades_access = {'recruit', 'employee', 'manager', 'boss'}, -- nil for every user with job, string: 'name', table: {'name', 'name2'}
        manager_grades = 'manager', -- string: 'name', table: {'name', 'name2'}
        boss_grades = 'boss', -- string: 'name', table: {'name', 'name2'}
    },
}
```

{% endtab %}
{% endtabs %}

## 3. Adjust config.installationparts.lua to your server preferences

{% tabs %}
{% tab title="Preferences" %}
**UseHelpUI**: For advanced part installation which can prompt the player what they need to do now

```lua
Config.UseHelpUI = true
```

**DisableAbilityToRunWithParts**: Is the player to be blocked from running with parts in hand?&#x20;

```lua
Config.DisableAbilityToRunWithParts = true
```

**UseManualPartInstallation**: Do you want the player to have to manually install each part separately to give the tuning process realism

```lua
Config.UseManualPartInstallation = true
```

**UseTargetForPartInstallation**: Do you want to use target system for part installation

```lua
Config.UseTargetForPartInstallation = false
```

**TeleportToVehicleAfterInstallForMS**: Is the player to be teleported to the vehicle for a millisecond, it will not be practically visible and the newly installed part in each player will synchronize

```lua
Config.TeleportToVehicleAfterInstallForMS = true
```

**TeleportToVehicleAfterFullInstallation**: Is the mechanic to be transported to the vehicle after the installation of all parts is completed so that all Vehicle Properties are loaded

```lua
Config.TeleportToVehicleAfterFullInstallation = true
```

**InstallationPartsPoints**: Points for workshops to find purchased parts for the installation

Use advanced installation

{% code overflow="wrap" %}

```lua
-- @UseAdvancedEngineInstallation: Advanced engine installation with engine on stand
Config.UseAdvancedEngineInstallation = true

-- @UseAdvancedBrakesInstallation: Advanced brakes installation with jacks
Config.UseAdvancedBrakesInstallation = true

-- @UseAdvancedTransmissionInstallation: Advanced transmission installation with jacks
Config.UseAdvancedTransmissionInstallation = true

-- @UseAdvancedSuspensionInstallation: Advanced suspension installation with jacks
Config.UseAdvancedSuspensionInstallation = true

-- @UseAdvancedEngineSwapInstallation: Advanced engine swap installation with engine on stand
Config.UseAdvancedEngineSwapInstallation = true

-- @UseAdvancedWheelsInstallation: Advanced installation of each wheel separately 
Config.UseAdvancedWheelsInstallation = true
```

{% endcode %}
{% endtab %}
{% endtabs %}
