Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

Fix paintType application for default and custom vehicle colors #753

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 27 additions & 11 deletions resource/vehicleProperties/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -347,26 +347,42 @@ function lib.setVehicleProperties(vehicle, props, fixVehicle)
end

if props.color1 then
if type(props.color1) == 'number' then
if type(props.color1) == 'table' then
-- Cor personalizada (RGB)
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])
if props.paintType1 then
SetVehicleModColor_1(vehicle, props.paintType1, 0, props.pearlescentColor or 0)
end
elseif type(props.color1) == 'number' then
-- Cor padrão
ClearVehicleCustomPrimaryColour(vehicle)
SetVehicleColours(vehicle, props.color1, GetVehicleColours(vehicle))
if props.paintType1 then
SetVehicleModColor_1(vehicle, props.paintType1, 0, props.pearlescentColor or 0)
end
end
end

if props.color2 then
if type(props.color2) == 'number' then
if type(props.color2) == 'table' then
-- Cor personalizada (RGB)
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])
if props.paintType2 then
SetVehicleModColor_2(vehicle, props.paintType2, 0)
end
elseif type(props.color2) == 'number' then
-- Cor padrão
ClearVehicleCustomSecondaryColour(vehicle)
local primaryColor = select(1, GetVehicleColours(vehicle))
SetVehicleColours(vehicle, primaryColor, props.color2)
if props.paintType2 then
SetVehicleModColor_2(vehicle, props.paintType2, 0)
end
end
end


if props.pearlescentColor or props.wheelColor then
SetVehicleExtraColours(vehicle, props.pearlescentColor or pearlescentColor, props.wheelColor or wheelColor)
Expand Down