Browse docs

ox_lib Vehicle Properties

Copy-and-paste instructions to keep vehicle colours and tuning with Overextended ox_lib 3.39.0.

Use this page for Overextended ox_lib 3.39.0. You can find your version in ox_lib/fxmanifest.lua, on the line that starts with version.

For Qbox, make these changes in ox_lib. Keep your existing exports.ox_lib:getVehicleProperties(vehicle) and exports.ox_lib:setVehicleProperties(vehicle, props) calls. You do not need to edit ox_lib/init.lua or qbx_core.

This guide uses the current Overextended repository. An older CommunityOx download may have different code even though its resource folder is also called ox_lib.

1. Open the file

  1. Stop the server and make a backup of the file below, outside the server's resources folder.
  2. Open ox_lib/resource/vehicleProperties/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. Read custom headlight colours

Inside lib.getVehicleProperties:

Find:

        local extras = {}

Replace with:

        local hasCustomXenonColor, xenonR, xenonG, xenonB = GetVehicleXenonLightsCustomColor(vehicle)
        local customXenonColor = hasCustomXenonColor and { xenonR, xenonG, xenonB } or nil

        local extras = {}

3. Include custom headlight colours in the save

Inside lib.getVehicleProperties:

Find:

            xenonColor = GetVehicleXenonLightsColor(vehicle),

Replace with:

            xenonColor = GetVehicleXenonLightsColor(vehicle),
            customXenonColor = customXenonColor,

4. Restore colours and the paint finish

Inside lib.setVehicleProperties:

Find:

    if props.color1 then
        if type(props.color1) == 'number' then
            ClearVehicleCustomPrimaryColour(vehicle)
            SetVehicleColours(vehicle, props.color1 --[[@as number]], colorSecondary --[[@as number]])
        else
            if props.paintType1 then SetVehicleModColor_1(vehicle, props.paintType1, 0, props.pearlescentColor or 0) end

            SetVehicleCustomPrimaryColour(vehicle, props.color1[1], props.color1[2], props.color1[3])
        end
    end

    if props.color2 then
        if type(props.color2) == 'number' then
            ClearVehicleCustomSecondaryColour(vehicle)
            SetVehicleColours(vehicle, props.color1 or colorPrimary --[[@as number]], props.color2 --[[@as number]])
        else
            if props.paintType2 then SetVehicleModColor_2(vehicle, props.paintType2, 0) end

            SetVehicleCustomSecondaryColour(vehicle, props.color2[1], props.color2[2], props.color2[3])
        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 lib.setVehicleProperties:

Find:

    if props.xenonColor 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
    if props.customXenonColor ~= nil then
        SetVehicleXenonLightsCustomColor(vehicle, props.customXenonColor[1], props.customXenonColor[2], props.customXenonColor[3])
    end

6. Keep tyre protection unchanged

Inside lib.setVehicleProperties:

Find:

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

Replace with:

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

In this checked version, the getter saves whether tyres can burst under the name bulletProofTyres. This replacement makes the setter restore that same value.

7. 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: Overextended ox_lib 3.39.0, source b8f5a043. The examples are not based on a customized server installation.