Browse docs

ESX Vehicle Properties

Copy-and-paste instructions to keep vehicle colours and tuning with ESX 1.15.2.

Use this page for ESX 1.15.2. You can find your version in es_extended/fxmanifest.lua, on the line that starts with version.

In this ESX version, the vehicle functions are in esx_lib. Your garage keeps using ESX.Game.GetVehicleProperties and ESX.Game.SetVehicleProperties; ESX forwards those calls to the functions in this file. If you do not have this file, send your ESX version to support. Do not create an empty replacement file.

1. Open the file

  1. Stop the server and make a backup of the file below, outside the server's resources folder.
  2. Open esx_lib/imports/game/client.lua in your host's file editor or your usual code editor.
  3. Keep that file open for every step on this page.

How to use each step: press Ctrl+F to find the first line of the Find block. Select the entire shown block in your file, then paste the complete Replace with block over it. Leave the surrounding code in place. You do not need to understand or rewrite the code.

If the Replace with block is already there, skip that step. If neither block matches, stop editing and restore your backup before starting the server. Send the file and your version to support. Versions and edited files can differ; do not guess where to paste.

2. Save the paint finish

Inside xLib.game.getVehicleProperties:

Find:

        color1 = colorPrimary,

Replace with:

        paintType1 = GetVehicleModColor_1(vehicle),
        paintType2 = GetVehicleModColor_2(vehicle),
        color1 = colorPrimary,

3. Save both types of livery

Inside xLib.game.getVehicleProperties:

Find:

        modLivery = GetVehicleMod(vehicle, 48) == -1 and GetVehicleLivery(vehicle) or GetVehicleMod(vehicle, 48),

Replace with:

        modLivery = GetVehicleMod(vehicle, 48),
        livery = GetVehicleLivery(vehicle),

4. Restore colours and the paint finish

Inside xLib.game.setVehicleProperties:

Find:

    if props.color1 ~= nil then
        if type(props.color1) == "table" then
            SetVehicleCustomPrimaryColour(vehicle, props.color1[1], props.color1[2], props.color1[3])
        else
            SetVehicleColours(vehicle, props.color1, colorSecondary)
        end
    end
    if props.color2 ~= nil then
        if type(props.color2) == "table" then
            SetVehicleCustomSecondaryColour(vehicle, props.color2[1], props.color2[2], props.color2[3])
        else
            SetVehicleColours(vehicle, type(props.color1) == "number" and props.color1 or colorPrimary, props.color2)
        end
    end

Replace with:

    -- Preserve paint finishes, palette resets and mixed RGB/palette colours.
    local primaryIndex = type(props.color1) == 'number' and props.color1 or colorPrimary
    local secondaryIndex = type(props.color2) == 'number' and props.color2 or colorSecondary
    if props.paintType1 ~= nil then
        SetVehicleModColor_1(vehicle, props.paintType1, primaryIndex, props.pearlescentColor or pearlescentColor)
    end
    if props.paintType2 ~= nil then
        SetVehicleModColor_2(vehicle, props.paintType2, secondaryIndex)
    end
    if type(props.color1) == 'number' or type(props.color2) == 'number' then
        SetVehicleColours(vehicle, primaryIndex, secondaryIndex)
    end
    if props.color1 ~= nil then
        if type(props.color1) == 'table' then
            SetVehicleCustomPrimaryColour(vehicle, props.color1[1], props.color1[2], props.color1[3])
        else
            ClearVehicleCustomPrimaryColour(vehicle)
        end
    end
    if props.color2 ~= nil then
        if type(props.color2) == 'table' then
            SetVehicleCustomSecondaryColour(vehicle, props.color2[1], props.color2[2], props.color2[3])
        else
            ClearVehicleCustomSecondaryColour(vehicle)
        end
    end

5. Restore headlight colours

Inside xLib.game.setVehicleProperties:

Find:

    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

Replace with:

    if props.xenonColor ~= nil then
        if type(props.xenonColor) == 'table' then
            SetVehicleXenonLightsCustomColor(vehicle, props.xenonColor[1], props.xenonColor[2], props.xenonColor[3])
        else
            ClearVehicleXenonLightsCustomColor(vehicle)
            SetVehicleXenonLightsColor(vehicle, props.xenonColor)
        end
    end
    if props.customXenonColor ~= nil then
        SetVehicleXenonLightsCustomColor(vehicle, props.customXenonColor[1], props.customXenonColor[2], props.customXenonColor[3])
    end

6. Allow tyre smoke to be switched off

Inside xLib.game.setVehicleProperties:

Find:

    if props.modSmokeEnabled ~= nil then
        ToggleVehicleMod(vehicle, 20, true)
    end

Replace with:

    if props.modSmokeEnabled ~= nil then
        ToggleVehicleMod(vehicle, 20, props.modSmokeEnabled)
    end

7. Restore both types of livery

Inside xLib.game.setVehicleProperties:

Find:

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

Replace with:

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

8. Save and finish

Save the file. If you edited a downloaded copy, upload it back to the same location on the server. Then return to Garage Integration for the MSK notes and the vehicle test.

Your existing vehicle functions now include the changes above. Keep the framework's normal get/set calls in other scripts. Do not copy Sky function bodies into framework core files.

Reference version

The Find blocks were checked against the unmodified official repository on 11 September 2026: ESX 1.15.2, source fe59ca0b. The examples are not based on a customized server installation.