Browse docs

ESX Vehicle Properties

Copy-and-paste vehicle-property fixes for ESX with esx_lib and older ESX versions without it.

Choose the section matching your installed ESX files. You can find your version in es_extended/fxmanifest.lua, on the line that starts with version.

Your installationInstructionsFile to edit
ESX with esx_lib (reference: 1.15.2)With esx_libesx_lib/imports/game/client.lua
Older ESX without esx_libWithout esx_libes_extended/client/functions.lua

Both variants keep ESX.Game.GetVehicleProperties and ESX.Game.SetVehicleProperties as your garage's normal calls. Use only the section for your installation. You do not need to install esx_lib on an older server or create a replacement framework file.

Before editing

Stop the server and back up the file you will edit, outside the server's resources folder.

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.

ESX with esx_lib

This section uses ESX 1.15.2. ESX forwards its existing ESX.Game calls to xLib.game. For an older installation without that library, go to ESX without esx_lib.

1. Open the file

Open esx_lib/imports/game/client.lua in your host's file editor or your usual code editor. Keep that file open for steps 2–8 in this section.

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.

ESX without esx_lib

Use this section when the vehicle functions are defined directly in es_extended/client/functions.lua. The blocks were checked against ESX 1.9.4, 1.10.10, 1.11.4, 1.12.4, 1.13.4 and 1.13.5. Compare the shown blocks with your file even when the version matches.

1. Open the older ESX file

Open es_extended/client/functions.lua. Find both function headers with Ctrl+F:

function ESX.Game.GetVehicleProperties(vehicle)
function ESX.Game.SetVehicleProperties(vehicle, props)

Keep these functions and their surrounding code. Apply the changes below inside them; do not replace the whole file with a file from another ESX version.

2. Save the paint finish in older ESX

Inside ESX.Game.GetVehicleProperties:

Find:

        color1 = colorPrimary,

Replace with:

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

Keep the existing color2, customPrimaryColor and customSecondaryColor fields if present. The colour step below supports those older saved RGB fields as well.

3. Save both types of livery in older ESX

Inside ESX.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 in older ESX

Inside ESX.Game.SetVehicleProperties, find one of the two blocks below and replace it with the single Replace with block. Leave the following props.pearlescentColor block in place.

Find — ESX 1.13.4 / 1.13.5:

    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, props.color1 or colorPrimary, props.color2)
        end
    end

Find — ESX 1.9.4 / 1.10.10 / 1.11.4 / 1.12.4:

    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

In ESX 1.9.4, each SetVehicleCustom... call wraps onto a second line. Include that line when selecting the block; the arguments are the same.

Replace with — for either block:

    -- Accept both older separate RGB fields and RGB stored in color1/color2.
    local primary_color = props.customPrimaryColor or props.color1
    local secondary_color = props.customSecondaryColor or props.color2
    local primary_index = type(props.color1) == "number" and props.color1 or colorPrimary
    local secondary_index = type(props.color2) == "number" and props.color2 or colorSecondary

    if props.paintType1 ~= nil then
        SetVehicleModColor_1(vehicle, props.paintType1, primary_index, props.pearlescentColor or pearlescentColor)
    end
    if props.paintType2 ~= nil then
        SetVehicleModColor_2(vehicle, props.paintType2, secondary_index)
    end
    if type(props.color1) == "number" or type(props.color2) == "number" then
        SetVehicleColours(vehicle, primary_index, secondary_index)
    end
    if primary_color ~= nil then
        if type(primary_color) == "table" then
            SetVehicleCustomPrimaryColour(vehicle, primary_color[1], primary_color[2], primary_color[3])
        else
            ClearVehicleCustomPrimaryColour(vehicle)
        end
    end
    if secondary_color ~= nil then
        if type(secondary_color) == "table" then
            SetVehicleCustomSecondaryColour(vehicle, secondary_color[1], secondary_color[2], secondary_color[3])
        else
            ClearVehicleCustomSecondaryColour(vehicle)
        end
    end

5. Restore headlight colours in older ESX

Inside ESX.Game.SetVehicleProperties:

Find:

    if props.xenonColor ~= nil then
        SetVehicleXenonLightsColor(vehicle, props.xenonColor)
    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

Keep the existing if props.customXenonColor ~= nil then ... end block immediately below it. That block restores headlight colours saved in the older separate RGB field.

6. Allow tyre smoke to be switched off in older ESX

Inside ESX.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 in older ESX

Inside ESX.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 test older ESX

Save es_extended/client/functions.lua and upload it to the same location if you edited a downloaded copy. Follow Garage Integration to restart and test saving, parking and taking the vehicle out. Include a mixed RGB/palette colour, a return to a palette colour, both livery types, headlight colours and tyre smoke switched off.

Extras are already part of ESX's vehicle properties. Keep its existing extras getter and setter; these instructions do not add a second extras save or restore system.

Reference versions

The esx_lib 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.

The older ESX blocks were checked against these unmodified official versions on 16 September 2026: