Installation & Configuration & Integration

Install

Login to your keymaster account, check Granted Assets section and download script you bought from us

Script Start Order

To correctly start the mechanic script in your server.cfg, ensure to start the scripts in the following order. Failure to do so may result in various error codes

ensure ox_lib
ensure PolyZone
ensure dusa_mechanic
ensure dusa_carkit

Add Items

Go to _installation folder, you can find item images there. For item codes, firstly choose your framework, after that insert required items in your items file or sql

If you using ox_inventory ONLY use items_ox

If you using qb_inventory or qs-inventory use items_qb

If you using chezza_inventory use items.sql

Create New Mechanics

Owner of the mechanic identifier or citizenid must be determined at the bossIdentifier section

id value cant be same with other mechanics

job value must be different from other mechanics, otherwise it will be glitched

---------------------PLAYER MECHANICS--------------------------
---------------------------------------------------------------
--[[	
	You can add additional items to specified shop from here.

	id = Unique id for mechanic shop
	bossIdentifier = Identifier / Citizenid of mechanic owner !! IMPORTANT 
	job = Which job will work for this mechanic
	modify = {
        -- vector3(x, y, z) -- Create new vehicle customization locations
    }
    flatbed = {
        model = Towing vehicle model name
        coords = Determine location for towing vehicle spawn
        heading = Heading
    }
]]
Config.Mechanics = {
    [1] = {
        id = 1, --- @param WARNING!!! id has to be a value between 1 and 99
        bossIdentifier = "", -- citizenid or identifier
        job = "mechanic1", --- @param WARNING!!! job value cant be same with other mechanics, you have to use another job for another mechanic
        bossMenu = vector3(-206.648, -1331.58, 34.894),
        modify = {
            vector3(-221.982, -1329.93, 30.890),
        },
        flatbed = {
            model = "flatbed",
            coords = vector3(-190.143, -1290.53, 31.295),
            heading = 266.0
        }
    },
    [2] = {
        id = 2, --- @param WARNING!!! id has to be a value between 1 and 99
        bossIdentifier = "", -- citizenid or identifier
        job = "mechanic2", --- @param WARNING!!! job value cant be same with other mechanics, you have to use another job for another mechanic
        bossMenu = vector3(-347.355, -133.625, 39.009),
        modify = {
            vector3(-323.233, -132.452, 38.957),
            vector3(-326.517, -144.650, 39.060),
        },
        flatbed = {
            model = "flatbed",
            coords = vector3(-367.893, -108.809, 38.679),
            heading = 65.1
        }
    },
}

👨‍🔧 How can I set myself as boss to a mechanic?

Assigning Yourself as the Boss of a Mechanic Shop

To accomplish this, you will need to locate your assigned identifier or citizenid. Here's how you can find this information:

  1. Navigate to your FiveM server's database where your user information is stored.

  2. Look for the table that contains user data, often labeled as users or players.

  3. Within this table, find your user entry. It should contain fields for your identifier and possibly citizenid, among other personal details.

  4. Note down the identifier or citizenid value associated with your entry; this is the information you will need to input into the mechanic shop's configuration.

Once you have your identifier or citizenid, follow these steps to set yourself as the boss:

  1. Open the mechanic shop script configuration (config.lua)

  2. Scroll down to the Config.Mechanics section of the configuration.

  3. Choose the mechanic shop entry (e.g., [1], [2], etc.) you wish to own.

  4. Replace the empty string "" next to bossIdentifier with your noted identifier or citizenid.

  5. Save the configuration file and restart your server for the changes to take effect.

You are now set as the boss for the selected mechanic shop.

Tuning Tablet

Tuning Tablet Usage Options

You have various options for using the Tuning Tablet. By setting TuningAsItem to true, you can attach the tablet to an in-game item, or if it's set to false, it will be accessible via a command. If you decide to leave TuningAsItem as false, you can customize the command to open the tuning interface by editing TuningCommand to your preference.

Configuring the Tuning Tablet:

  • TuningAsItem: Set to true if you want to use the tablet as an inventory item, or false to use it with a command.

  • TuningCommand: If TuningAsItem is false, customize this command to your liking for opening the tuning interface.

  • Additional Options

    MinimumGrade Setting

    To adjust who can use the Tuning Tablet, change the Config.MinimumGrade value. This number represents the minimum required employee rank to access the tablet.

    Config.MinimumGrade = 0 -- All employees can use
    Config.MinimumGrade = 1 -- Only employees with rank 1 or higher can use

    Speed Settings

    The IncreaseSpeed and MaxSpeed options help you control the maximum acceleration and top speed that can be set using the tablet for vehicle modifications.

    Config.IncreaseSpeed = 35.0 -- Amount each tuning step increases speed
    Config.MaxSpeed = 999.0 -- The maximum speed limit after tuning
-------------------------TUNING TABLET-------------------------
---------------------------------------------------------------
Config.TuningAsItem = false -- true / false -- If its true, tuner tablet will be attached to tuningtablet item otherwise it will work with command 
Config.TuningCommand = 'tuning'
Config.MinimumGrade = 1 -- Define a min grade level for who can use 

Config.IncreaseSpeed = 35.0
Config.MaxSpeed = 999.0

Crafting

To activate and customize the production table, several modifications are required:

  • prop: Defines the object for the table, which can be accessed from forge plebmaster.

  • job: Determines which jobs can access the table.

  • workarea:Within workarea, the length and wide values set the range of accessibility for the table.

  • coords:Use coords to place the production table in the desired location.

In the CraftItems section, you can add or remove items:

  • prop: Specifies the object to be previewed.

  • img: Change img to modify the menu image.

For the requirements section:

  • Define new items by setting name and item.

  • Do not alter the owned value.

  • Adjust count to specify the required quantity of items.

---------------------------CRAFTING----------------------------
---------------------------------------------------------------
Config.CraftBenchs = {
    [1] = {
        id = 1,
        prop = "gr_prop_gr_bench_04b",
        craftbench = nil, -- the entity 
        openMenu = true,
		job = {"all"},
        workarea = {
            length = 7.0,
            wide = 7.0
        },
        coords = {
            ["x"] = -226.699,
            ["y"] = -1321.37, 
            ["z"] = 29.890,
            ["h"] = 355.19
        }
    }
}

Config.CraftItems = {
    [1] = {
        name = "Repair Kit",
        item = "repairkit",
        prop = "h4_prop_h4_tool_box_02",
        img = "https://media.discordapp.net/attachments/1086696690662244434/1189669722422267975/repairkit.png?ex=659f0144&is=658c8c44&hm=5375b3b11ceb85edbc9d6521121338f11a0534d78cc1d59882f5bd6d1a5130e0&=&format=webp&quality=lossless",
        requirements = {
            [1] = {
                name = "Iron",
                item = "iron",
                owned = 0,
                count = 6
            },
            [2] = {
                name = "Copper",
                item = "copper",
                owned = 0,
                count = 2
            },
            [3] = {
                name = "Screw Driver",
                item = "screwdriverset",
                owned = 0,
                count = 1
            },
        }
    },
    [2] = {
        name = "Tyre Kit",
        item = "tyrekit",
        prop = "xm3_prop_xm3_tool_box_02a",
        img = "https://media.discordapp.net/attachments/1086696690662244434/1189669892199293071/tyrekit.png?ex=659f016d&is=658c8c6d&hm=52f91cbbc41aee2a99c5597459acbed43d842ce519484a67f7e088468d53afe9&=&format=webp&quality=lossless",
        requirements = {
            [1] = {
                name = "Iron",
                item = "iron",
                owned = 0,
                count = 6
            },
            [2] = {
                name = "Copper",
                item = "copper",
                owned = 0,
                count = 2
            },
            [3] = {
                name = "Screw Driver",
                item = "screwdriverset",
                owned = 0,
                count = 1
            },
            [4] = {
                name = "Wheel",
                item = "wheel",
                owned = 0,
                count = 1
            },
        }
    },
    [3] = {
        name = "Cleaning Kit",
        item = "cleaningkit",
        prop = "sf_prop_sf_cleaning_pad_01a",
        img = "https://static.vecteezy.com/system/resources/thumbnails/024/490/325/small/cleaning-items-ai-generated-free-png.png",
        requirements = {
            [1] = {
                name = "Cloth",
                item = "cloth",
                owned = 0,
                count = 2
            },
        }
    },
    [4] = {
        name = "Plate",
        item = "plate",
        prop = "p_num_plate_03",
        img = "https://media.discordapp.net/attachments/1086696690662244434/1189670290612031590/license_plate.png?ex=659f01cc&is=658c8ccc&hm=1036301e1ebbf3e36bbb4e4fff9a9fde744d8f46180845bc86e61a24340c698f&=&format=webp&quality=lossless&width=676&height=676",
        requirements = {
            [1] = {
                name = "Iron",
                item = "iron",
                owned = 0,
                count = 20
            },
            [2] = {
                name = "Copper",
                item = "copper",
                owned = 0,
                count = 15
            },
        }
    },
    [5] = {
        name = "Nitrous",
        item = "nitrous",
        prop = "w_am_flare",
        img = "https://media.discordapp.net/attachments/1086696690662244434/1189669666818367569/nitrous.png?ex=659f0137&is=658c8c37&hm=be04b2798422b2cde3a3b346c42e1ac94329ede41fc4cead8a38473721d3ea5c&=&format=webp&quality=lossless",
        requirements = {
            [1] = {
                name = "Essence",
                item = "essence",
                owned = 0,
                count = 20
            },
            [2] = {
                name = "Iron",
                item = "iron",
                owned = 0,
                count = 50
            },
        }
    },
    [6] = {
        name = "Tuning Tablet",
        item = "tuningtablet",
        prop = "imp_prop_impexp_tablet",
        img = "https://media.discordapp.net/attachments/1086696690662244434/1191844833749389362/tablet.png?ex=65a6eaff&is=659475ff&hm=79c82c21c1feb9b4bd7752dd29231922f5c991c86eb8b3a05396ac31026c7dac&=&format=webp&quality=lossless",
        requirements = {
            [1] = {
                name = "Copper",
                item = "copper",
                owned = 0,
                count = 100
            },
            [2] = {
                name = "Iron",
                item = "iron",
                owned = 0,
                count = 150
            },
        }
    },
}

Editing Part Prices

To set the prices for each part, you can perform the following steps in config.lua:

  1. Use Ctrl+F to locate the Config.Menus section within the file.

  2. There you will find various upgrades and customizations like brakes, transmission, etc., along with their prices.

  3. basePrice represents the base price of a part, and increaseBy determines the incremental value based on the part's quality.

  4. You can adjust these values accordingly to set your prices.

Remember, individual mechanic shops can establish their discount rates for all parts, so consider this factor when setting your economy. Adjust your prices with this in mind to maintain a balanced economy.

    upgrades = {
        brakes = {
            basePrice = 5000,
            increaseby = 500,
        },
        transmission = {
            basePrice = 5000,
            increaseby = 500,
        },
        suspension = {
            basePrice = 5000,
            increaseby = 500,
        },
        engine = {
            basePrice = 5000,
            increaseby = 500,
        },
        turbo = 5000,
    },

To ensure that our script operates harmoniously with other scripts, you will need to adjust the following settings.

Vehicle Keys

Key Integration for Custom Vehicle Key Plugins

If you're not using one of the pre-integrated vehicle key scripts like dusa, jaksam, qbcore, wasabi or quasar and need to integrate your own, follow these steps:

  1. Open bridge/framework/client.lua file.

  2. Use Ctrl+F to find the function dusa.integrateKey.

  3. Insert the integration code provided for your key script into the located code block.

  4. For example, if you're using a plugin called x and they provide a function that looks like:

    exports['x']:AddKey(vehicle, vehicleplate)

    You will need to replace vehicle with your vehicle variable and vehicleplate with your plate variable as per your script.

If you encounter any difficulties while performing these steps, don't hesitate to open a support ticket for assistance.

API

The details for operations in this category have not been provided extensively, as anyone with basic knowledge can perform the necessary actions. Therefore, it is recommended to reserve this part more for your developers. Developers can refer to the provided snippets and integrate them into your scripts for extended functionality.

client

Triggering the Mechanic Menu from Anywhere Similar to Admin Menus

To invoke the mechanic menu from various locations, similar to how you would with admin menus, you can integrate the following code snippet into your scripts:

-- Function to open mechanic menu at everywhere (especially for admin menu)
exports['dusa_mechanic']:openMechanic()

Triggering the Craft Menu

Integrate the following code snippet into your scripts:

-- Function to open mechanic menu at everywhere (especially for admin menu)
exports['dusa_mechanic']:openCraft()

Enabling the Tuning Tablet Menu

To enable the Tuning Tablet menu in other script, you'll need to use this event:

Snippet:

-- Function to open the Tuning Tablet menu
TriggerEvent('dusa_mechanic:cl:useTuning') -- event is client sided

Clearing Existing Vehicle Lifts

To remove any vehicle lifts that have been previously placed on the server, follow the instructions below:

  1. Navigate to data>lifts.lua

  2. LOcate the vehicle lift you want to delete by finding its coordinates or by using the owner's job, citizen ID (or identifier) as a filter

  3. Delete or comment out the entry of the specific vehicle lift

  4. Save the lifts.lua file after modification

  5. Restart the script

Note: Ensure you have a backup of your configuration files before making any changes. If you encounter any issues, revert to the backup file and contact support.


Monitoring Vehicle Stancer Settings Changes

To track changes to a vehicle's stancer settings, follow these steps:

AddStateBagChangeHandler('stancer' --[[key filter]], nil --[[bag filter]], function(bagName, key, value, _unused, replicated)
    Wait(0)
    if not value then return end
    local vehicle = GetEntityFromStateBagName(bagName) -- Getting vehicle id
    if not DoesEntityExist(vehicle) then return end
    local plate = GetVehicleNumberPlateText(vehicle) -- Getting vehicle plate
    -- Add code here to handle the change
    -- value['wheel'] -- Equals to wheels camber and offsets
    -- value['width'] -- Wheel width
    -- value['height'] -- Wheel suspension height
    -- value['size'] -- Wheel size
end)

Retrieving Current Stancer Settings of Vehicles

To obtain the current stancer settings of a vehicle, use this callback:

local stances = lib.callback.await('dusa_mechanic:stancers', false, plate)

Common Problems

For the error you are experiencing, you might not need to wait for us by opening a ticket. Here, you can find the most common errors encountered:

1. Applying Chameleon Colors

Issue: When I try to remove my car from the garage, the chameleon colors are not being applied.

Solution: This issue stems from your core script not supporting the chameleon color palette. However, you can solve this problem with two small pieces of code.

The functions that need modifications and the code sections to be added are specified below.

Follow this path -> es_extended/client/functions.lua

The codes to be added are:

Function: ESX.Game.GetVehicleProperties
chameleon = table.pack(GetVehicleColours(vehicle)),
Function: ESX.Game.SetVehicleProperties
if props.chameleon then
        SetVehicleColours(vehicle, props.chameleon[1], props.chameleon[1])
end

If you don't know how to do it or are hesitant, replace your entire code block with the following. (If there have been prior modifications related to this function on your server, this method is not recommended.)

ESX.Game.GetVehicleProperties
function ESX.Game.GetVehicleProperties(vehicle)
    if not DoesEntityExist(vehicle) then
        return
    end

    local colorPrimary, colorSecondary = GetVehicleColours(vehicle)
    local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
    local hasCustomPrimaryColor = GetIsVehiclePrimaryColourCustom(vehicle)
    local dashboardColor = GetVehicleDashboardColor(vehicle)
    local interiorColor = GetVehicleInteriorColour(vehicle)
    local customPrimaryColor = nil
    if hasCustomPrimaryColor then
        customPrimaryColor = { GetVehicleCustomPrimaryColour(vehicle) }
    end

    local hasCustomXenonColor, customXenonColorR, customXenonColorG, customXenonColorB = GetVehicleXenonLightsCustomColor(vehicle)
    local customXenonColor = nil
    if hasCustomXenonColor then
        customXenonColor = { customXenonColorR, customXenonColorG, customXenonColorB }
    end

    local hasCustomSecondaryColor = GetIsVehicleSecondaryColourCustom(vehicle)
    local customSecondaryColor = nil
    if hasCustomSecondaryColor then
        customSecondaryColor = { GetVehicleCustomSecondaryColour(vehicle) }
    end

    local extras = {}
    for extraId = 0, 20 do
        if DoesExtraExist(vehicle, extraId) then
            extras[tostring(extraId)] = IsVehicleExtraTurnedOn(vehicle, extraId)
        end
    end

    local doorsBroken, windowsBroken, tyreBurst = {}, {}, {}
    local numWheels = tostring(GetVehicleNumberOfWheels(vehicle))

    local TyresIndex = { -- Wheel index list according to the number of vehicle wheels.
        ["2"] = { 0, 4 }, -- Bike and cycle.
        ["3"] = { 0, 1, 4, 5 }, -- Vehicle with 3 wheels (get for wheels because some 3 wheels vehicles have 2 wheels on front and one rear or the reverse).
        ["4"] = { 0, 1, 4, 5 }, -- Vehicle with 4 wheels.
        ["6"] = { 0, 1, 2, 3, 4, 5 }, -- Vehicle with 6 wheels.
    }

    if TyresIndex[numWheels] then
        for _, idx in pairs(TyresIndex[numWheels]) do
            tyreBurst[tostring(idx)] = IsVehicleTyreBurst(vehicle, idx, false)
        end
    end

    for windowId = 0, 7 do -- 13
        RollUpWindow(vehicle, windowId) --fix when you put the car away with the window down
        windowsBroken[tostring(windowId)] = not IsVehicleWindowIntact(vehicle, windowId)
    end

    local numDoors = GetNumberOfVehicleDoors(vehicle)
    if numDoors and numDoors > 0 then
        for doorsId = 0, numDoors do
            doorsBroken[tostring(doorsId)] = IsVehicleDoorDamaged(vehicle, doorsId)
        end
    end

    return {
        model = GetEntityModel(vehicle),
        doorsBroken = doorsBroken,
        windowsBroken = windowsBroken,
        tyreBurst = tyreBurst,
        tyresCanBurst = GetVehicleTyresCanBurst(vehicle),
        plate = ESX.Math.Trim(GetVehicleNumberPlateText(vehicle)),
        plateIndex = GetVehicleNumberPlateTextIndex(vehicle),

        bodyHealth = ESX.Math.Round(GetVehicleBodyHealth(vehicle), 1),
        engineHealth = ESX.Math.Round(GetVehicleEngineHealth(vehicle), 1),
        tankHealth = ESX.Math.Round(GetVehiclePetrolTankHealth(vehicle), 1),

        fuelLevel = ESX.Math.Round(GetVehicleFuelLevel(vehicle), 1),
        dirtLevel = ESX.Math.Round(GetVehicleDirtLevel(vehicle), 1),
        color1 = colorPrimary,
        color2 = colorSecondary,
        customPrimaryColor = customPrimaryColor,
        customSecondaryColor = customSecondaryColor,
        
        -- CHANGE MADE HERE
        chameleon = table.pack(GetVehicleColours(vehicle)),
        -- CHANGE MADE HERE
        
        pearlescentColor = pearlescentColor,
        wheelColor = wheelColor,

        dashboardColor = dashboardColor,
        interiorColor = interiorColor,

        wheels = GetVehicleWheelType(vehicle),
        windowTint = GetVehicleWindowTint(vehicle),
        xenonColor = GetVehicleXenonLightsColor(vehicle),
        customXenonColor = customXenonColor,

        neonEnabled = { IsVehicleNeonLightEnabled(vehicle, 0), IsVehicleNeonLightEnabled(vehicle, 1), IsVehicleNeonLightEnabled(vehicle, 2), IsVehicleNeonLightEnabled(vehicle, 3) },

        neonColor = table.pack(GetVehicleNeonLightsColour(vehicle)),
        extras = extras,
        tyreSmokeColor = table.pack(GetVehicleTyreSmokeColor(vehicle)),

        modSpoilers = GetVehicleMod(vehicle, 0),
        modFrontBumper = GetVehicleMod(vehicle, 1),
        modRearBumper = GetVehicleMod(vehicle, 2),
        modSideSkirt = GetVehicleMod(vehicle, 3),
        modExhaust = GetVehicleMod(vehicle, 4),
        modFrame = GetVehicleMod(vehicle, 5),
        modGrille = GetVehicleMod(vehicle, 6),
        modHood = GetVehicleMod(vehicle, 7),
        modFender = GetVehicleMod(vehicle, 8),
        modRightFender = GetVehicleMod(vehicle, 9),
        modRoof = GetVehicleMod(vehicle, 10),
        modRoofLivery = GetVehicleRoofLivery(vehicle),

        modEngine = GetVehicleMod(vehicle, 11),
        modBrakes = GetVehicleMod(vehicle, 12),
        modTransmission = GetVehicleMod(vehicle, 13),
        modHorns = GetVehicleMod(vehicle, 14),
        modSuspension = GetVehicleMod(vehicle, 15),
        modArmor = GetVehicleMod(vehicle, 16),

        modTurbo = IsToggleModOn(vehicle, 18),
        modSmokeEnabled = IsToggleModOn(vehicle, 20),
        modXenon = IsToggleModOn(vehicle, 22),

        modFrontWheels = GetVehicleMod(vehicle, 23),
        modCustomFrontWheels = GetVehicleModVariation(vehicle, 23),
        modBackWheels = GetVehicleMod(vehicle, 24),
        modCustomBackWheels = GetVehicleModVariation(vehicle, 24),

        modPlateHolder = GetVehicleMod(vehicle, 25),
        modVanityPlate = GetVehicleMod(vehicle, 26),
        modTrimA = GetVehicleMod(vehicle, 27),
        modOrnaments = GetVehicleMod(vehicle, 28),
        modDashboard = GetVehicleMod(vehicle, 29),
        modDial = GetVehicleMod(vehicle, 30),
        modDoorSpeaker = GetVehicleMod(vehicle, 31),
        modSeats = GetVehicleMod(vehicle, 32),
        modSteeringWheel = GetVehicleMod(vehicle, 33),
        modShifterLeavers = GetVehicleMod(vehicle, 34),
        modAPlate = GetVehicleMod(vehicle, 35),
        modSpeakers = GetVehicleMod(vehicle, 36),
        modTrunk = GetVehicleMod(vehicle, 37),
        modHydrolic = GetVehicleMod(vehicle, 38),
        modEngineBlock = GetVehicleMod(vehicle, 39),
        modAirFilter = GetVehicleMod(vehicle, 40),
        modStruts = GetVehicleMod(vehicle, 41),
        modArchCover = GetVehicleMod(vehicle, 42),
        modAerials = GetVehicleMod(vehicle, 43),
        modTrimB = GetVehicleMod(vehicle, 44),
        modTank = GetVehicleMod(vehicle, 45),
        modWindows = GetVehicleMod(vehicle, 46),
        modLivery = GetVehicleMod(vehicle, 48) == -1 and GetVehicleLivery(vehicle) or GetVehicleMod(vehicle, 48),
        modLightbar = GetVehicleMod(vehicle, 49),
    }
end
ESX.Game.SetVehicleProperties
function ESX.Game.SetVehicleProperties(vehicle, props)
    if not DoesEntityExist(vehicle) then
        return
    end
    local colorPrimary, colorSecondary = GetVehicleColours(vehicle)
    local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
    SetVehicleModKit(vehicle, 0)

    if props.tyresCanBurst ~= nil then
        SetVehicleTyresCanBurst(vehicle, props.tyresCanBurst)
    end

    if props.plate ~= nil then
        SetVehicleNumberPlateText(vehicle, props.plate)
    end
    if props.plateIndex ~= nil then
        SetVehicleNumberPlateTextIndex(vehicle, props.plateIndex)
    end
    if props.bodyHealth ~= nil then
        SetVehicleBodyHealth(vehicle, props.bodyHealth + 0.0)
    end
    if props.engineHealth ~= nil then
        SetVehicleEngineHealth(vehicle, props.engineHealth + 0.0)
    end
    if props.tankHealth ~= nil then
        SetVehiclePetrolTankHealth(vehicle, props.tankHealth + 0.0)
    end
    if props.fuelLevel ~= nil then
        SetVehicleFuelLevel(vehicle, props.fuelLevel + 0.0)
    end
    if props.dirtLevel ~= nil then
        SetVehicleDirtLevel(vehicle, props.dirtLevel + 0.0)
    end
    if props.customPrimaryColor ~= nil then
        SetVehicleCustomPrimaryColour(vehicle, props.customPrimaryColor[1], props.customPrimaryColor[2], props.customPrimaryColor[3])
    end
    if props.customSecondaryColor ~= nil then
        SetVehicleCustomSecondaryColour(vehicle, props.customSecondaryColor[1], props.customSecondaryColor[2], props.customSecondaryColor[3])
    end
    if props.color1 ~= nil then
        SetVehicleColours(vehicle, props.color1, colorSecondary)
    end
    if props.color2 ~= nil then
        SetVehicleColours(vehicle, props.color1 or colorPrimary, props.color2)
    end
    if props.pearlescentColor ~= nil then
        SetVehicleExtraColours(vehicle, props.pearlescentColor, wheelColor)
    end
    -- CHANGE MADE HERE
    if props.chameleon then
        SetVehicleColours(vehicle, props.chameleon[1], props.chameleon[1])
    end
    -- CHANGE MADE HERE

    if props.interiorColor ~= nil then
        SetVehicleInteriorColor(vehicle, props.interiorColor)
    end

    if props.dashboardColor ~= nil then
        SetVehicleDashboardColor(vehicle, props.dashboardColor)
    end

    if props.wheelColor ~= nil then
        SetVehicleExtraColours(vehicle, props.pearlescentColor or pearlescentColor, props.wheelColor)
    end
    if props.wheels ~= nil then
        SetVehicleWheelType(vehicle, props.wheels)
    end
    if props.windowTint ~= nil then
        SetVehicleWindowTint(vehicle, props.windowTint)
    end

    if props.neonEnabled ~= nil then
        SetVehicleNeonLightEnabled(vehicle, 0, props.neonEnabled[1])
        SetVehicleNeonLightEnabled(vehicle, 1, props.neonEnabled[2])
        SetVehicleNeonLightEnabled(vehicle, 2, props.neonEnabled[3])
        SetVehicleNeonLightEnabled(vehicle, 3, props.neonEnabled[4])
    end

    if props.extras ~= nil then
        for extraId, enabled in pairs(props.extras) do
            SetVehicleExtra(vehicle, tonumber(extraId), enabled and 0 or 1)
        end
    end

    if props.neonColor ~= nil then
        SetVehicleNeonLightsColour(vehicle, props.neonColor[1], props.neonColor[2], props.neonColor[3])
    end
    if props.xenonColor ~= nil then
        SetVehicleXenonLightsColor(vehicle, props.xenonColor)
    end
    if props.customXenonColor ~= nil then
        SetVehicleXenonLightsCustomColor(vehicle, props.customXenonColor[1], props.customXenonColor[2], props.customXenonColor[3])
    end
    if props.modSmokeEnabled ~= nil then
        ToggleVehicleMod(vehicle, 20, true)
    end
    if props.tyreSmokeColor ~= nil then
        SetVehicleTyreSmokeColor(vehicle, props.tyreSmokeColor[1], props.tyreSmokeColor[2], props.tyreSmokeColor[3])
    end
    if props.modSpoilers ~= nil then
        SetVehicleMod(vehicle, 0, props.modSpoilers, false)
    end
    if props.modFrontBumper ~= nil then
        SetVehicleMod(vehicle, 1, props.modFrontBumper, false)
    end
    if props.modRearBumper ~= nil then
        SetVehicleMod(vehicle, 2, props.modRearBumper, false)
    end
    if props.modSideSkirt ~= nil then
        SetVehicleMod(vehicle, 3, props.modSideSkirt, false)
    end
    if props.modExhaust ~= nil then
        SetVehicleMod(vehicle, 4, props.modExhaust, false)
    end
    if props.modFrame ~= nil then
        SetVehicleMod(vehicle, 5, props.modFrame, false)
    end
    if props.modGrille ~= nil then
        SetVehicleMod(vehicle, 6, props.modGrille, false)
    end
    if props.modHood ~= nil then
        SetVehicleMod(vehicle, 7, props.modHood, false)
    end
    if props.modFender ~= nil then
        SetVehicleMod(vehicle, 8, props.modFender, false)
    end
    if props.modRightFender ~= nil then
        SetVehicleMod(vehicle, 9, props.modRightFender, false)
    end
    if props.modRoof ~= nil then
        SetVehicleMod(vehicle, 10, props.modRoof, false)
    end

    if props.modRoofLivery ~= nil then
        SetVehicleRoofLivery(vehicle, props.modRoofLivery)
    end

    if props.modEngine ~= nil then
        SetVehicleMod(vehicle, 11, props.modEngine, false)
    end
    if props.modBrakes ~= nil then
        SetVehicleMod(vehicle, 12, props.modBrakes, false)
    end
    if props.modTransmission ~= nil then
        SetVehicleMod(vehicle, 13, props.modTransmission, false)
    end
    if props.modHorns ~= nil then
        SetVehicleMod(vehicle, 14, props.modHorns, false)
    end
    if props.modSuspension ~= nil then
        SetVehicleMod(vehicle, 15, props.modSuspension, false)
    end
    if props.modArmor ~= nil then
        SetVehicleMod(vehicle, 16, props.modArmor, false)
    end
    if props.modTurbo ~= nil then
        ToggleVehicleMod(vehicle, 18, props.modTurbo)
    end
    if props.modXenon ~= nil then
        ToggleVehicleMod(vehicle, 22, props.modXenon)
    end
    if props.modFrontWheels ~= nil then
        SetVehicleMod(vehicle, 23, props.modFrontWheels, props.modCustomFrontWheels)
    end
    if props.modBackWheels ~= nil then
        SetVehicleMod(vehicle, 24, props.modBackWheels, props.modCustomBackWheels)
    end
    if props.modPlateHolder ~= nil then
        SetVehicleMod(vehicle, 25, props.modPlateHolder, false)
    end
    if props.modVanityPlate ~= nil then
        SetVehicleMod(vehicle, 26, props.modVanityPlate, false)
    end
    if props.modTrimA ~= nil then
        SetVehicleMod(vehicle, 27, props.modTrimA, false)
    end
    if props.modOrnaments ~= nil then
        SetVehicleMod(vehicle, 28, props.modOrnaments, false)
    end
    if props.modDashboard ~= nil then
        SetVehicleMod(vehicle, 29, props.modDashboard, false)
    end
    if props.modDial ~= nil then
        SetVehicleMod(vehicle, 30, props.modDial, false)
    end
    if props.modDoorSpeaker ~= nil then
        SetVehicleMod(vehicle, 31, props.modDoorSpeaker, false)
    end
    if props.modSeats ~= nil then
        SetVehicleMod(vehicle, 32, props.modSeats, false)
    end
    if props.modSteeringWheel ~= nil then
        SetVehicleMod(vehicle, 33, props.modSteeringWheel, false)
    end
    if props.modShifterLeavers ~= nil then
        SetVehicleMod(vehicle, 34, props.modShifterLeavers, false)
    end
    if props.modAPlate ~= nil then
        SetVehicleMod(vehicle, 35, props.modAPlate, false)
    end
    if props.modSpeakers ~= nil then
        SetVehicleMod(vehicle, 36, props.modSpeakers, false)
    end
    if props.modTrunk ~= nil then
        SetVehicleMod(vehicle, 37, props.modTrunk, false)
    end
    if props.modHydrolic ~= nil then
        SetVehicleMod(vehicle, 38, props.modHydrolic, false)
    end
    if props.modEngineBlock ~= nil then
        SetVehicleMod(vehicle, 39, props.modEngineBlock, false)
    end
    if props.modAirFilter ~= nil then
        SetVehicleMod(vehicle, 40, props.modAirFilter, false)
    end
    if props.modStruts ~= nil then
        SetVehicleMod(vehicle, 41, props.modStruts, false)
    end
    if props.modArchCover ~= nil then
        SetVehicleMod(vehicle, 42, props.modArchCover, false)
    end
    if props.modAerials ~= nil then
        SetVehicleMod(vehicle, 43, props.modAerials, false)
    end
    if props.modTrimB ~= nil then
        SetVehicleMod(vehicle, 44, props.modTrimB, false)
    end
    if props.modTank ~= nil then
        SetVehicleMod(vehicle, 45, props.modTank, false)
    end
    if props.modWindows ~= nil then
        SetVehicleMod(vehicle, 46, props.modWindows, false)
    end

    if props.modLivery ~= nil then
        SetVehicleMod(vehicle, 48, props.modLivery, false)
        SetVehicleLivery(vehicle, props.modLivery)
    end

    if props.windowsBroken ~= nil then
        for k, v in pairs(props.windowsBroken) do
            if v then
                RemoveVehicleWindow(vehicle, tonumber(k))
            end
        end
    end

    if props.doorsBroken ~= nil then
        for k, v in pairs(props.doorsBroken) do
            if v then
                SetVehicleDoorBroken(vehicle, tonumber(k), true)
            end
        end
    end

    if props.tyreBurst ~= nil then
        for k, v in pairs(props.tyreBurst) do
            if v then
                SetVehicleTyreBurst(vehicle, tonumber(k), true, 1000.0)
            end
        end
    end
end

Last updated