Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions [core]/es_extended/client/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -805,14 +805,18 @@ function ESX.Game.GetVehicleProperties(vehicle)
return
end

---@type number | number[], number | number[]
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) }

if GetIsVehiclePrimaryColourCustom(vehicle) then
colorPrimary = { GetVehicleCustomPrimaryColour(vehicle) }
end

if GetIsVehicleSecondaryColourCustom(vehicle) then
colorSecondary = { GetVehicleCustomSecondaryColour(vehicle) }
end

local hasCustomXenonColor, customXenonColorR, customXenonColorG, customXenonColorB = GetVehicleXenonLightsCustomColor(vehicle)
Expand All @@ -821,12 +825,6 @@ function ESX.Game.GetVehicleProperties(vehicle)
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
Expand Down Expand Up @@ -879,8 +877,6 @@ function ESX.Game.GetVehicleProperties(vehicle)
dirtLevel = ESX.Math.Round(GetVehicleDirtLevel(vehicle), 1),
color1 = colorPrimary,
color2 = colorSecondary,
customPrimaryColor = customPrimaryColor,
customSecondaryColor = customSecondaryColor,

pearlescentColor = pearlescentColor,
wheelColor = wheelColor,
Expand Down Expand Up @@ -991,17 +987,19 @@ function ESX.Game.SetVehicleProperties(vehicle, props)
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)
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
SetVehicleColours(vehicle, props.color1 or colorPrimary, props.color2)
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
if props.pearlescentColor ~= nil then
SetVehicleExtraColours(vehicle, props.pearlescentColor, wheelColor)
Expand Down