diff --git a/client/functions.lua b/client/functions.lua index 5b04a88..d63db74 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -303,13 +303,7 @@ end QBCore.Functions.GetVehicleProperties = function(vehicle) if DoesEntityExist(vehicle) then - local paintType1, whoCaresColor1, whoCaresPearlescentColor1 = GetVehicleModColor_1(vehicle) - local paintType2, whoCaresColor2, whoCaresPearlescentColor2 = GetVehicleModColor_2(vehicle) - local color1 = {} - local color2 = {} - color1[1], color1[2], color1[3] = GetVehicleCustomPrimaryColour(vehicle) - color2[1], color2[2], color2[3] = GetVehicleCustomSecondaryColour(vehicle) - + local colorPrimary, colorSecondary = GetVehicleColours(vehicle) local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) local extras = {} @@ -333,9 +327,8 @@ QBCore.Functions.GetVehicleProperties = function(vehicle) fuelLevel = Round(GetVehicleFuelLevel(vehicle), 1), dirtLevel = Round(GetVehicleDirtLevel(vehicle), 1), - color1 = color1, - color2 = color2, - paintType = {paintType1, paintType2}, + color1 = colorPrimary, + color2 = colorSecondary, pearlescentColor = pearlescentColor, wheelColor = wheelColor, @@ -412,6 +405,8 @@ end QBCore.Functions.SetVehicleProperties = function(vehicle, props) if DoesEntityExist(vehicle) then + local colorPrimary, colorSecondary = GetVehicleColours(vehicle) + local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) SetVehicleModKit(vehicle, 0) if props.plate ~= nil then @@ -438,29 +433,20 @@ QBCore.Functions.SetVehicleProperties = function(vehicle, props) SetVehicleDirtLevel(vehicle, props.dirtLevel + 0.0) end - if props.paintType ~= nil then - SetVehicleModColor_1(vehicle, props.paintType[1], 0, 0) - SetVehicleModColor_2(vehicle, props.paintType[2], 0, 0) - end - if props.color1 ~= nil then - ClearVehicleCustomPrimaryColour(vehicle) - SetVehicleCustomPrimaryColour(vehicle, props.color1[1], props.color1[2], props.color1[3]) + SetVehicleColours(vehicle, props.color1, colorSecondary) end if props.color2 ~= nil then - ClearVehicleCustomSecondaryColour(vehicle) - SetVehicleCustomSecondaryColour(vehicle, props.color2[1], props.color2[2], props.color2[3]) + SetVehicleColours(vehicle, props.color1 or colorPrimary, props.color2) end if props.pearlescentColor ~= nil then - local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) - SetVehicleExtraColours(vehicle, props.pearlescentColor, wheelColor) + SetVehicleExtraColours(vehicle, props.pearlescentColor, wheelColor) end if props.wheelColor ~= nil then - local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) - SetVehicleExtraColours(vehicle, pearlescentColor, props.wheelColor) + SetVehicleExtraColours(vehicle, props.pearlescentColor or pearlescentColor, props.wheelColor) end if props.wheels ~= nil then