[HELP] Configure showroom vehicle colors

Hi,
I have a script with which I can display vehicles in my dealership.
I can configure a lot of things (as you can see below), but I would like to find a solution to configure the colors of each vehicle.

Currently vehicles spawn with a random color, and it changes every time I restart the script or the server.

Config.cars = {
    {
        model = "adder", -- spawn name of car
        label = nil, -- label to show in menu above car (set to nil to get name from model)
        pos = vector3(-787.65,-207.1,36.79), -- position - vector3(x,y,z)
        heading = 118.87,
        price = 10000000
    },

}

Thanks for reading me :wink:

Use SetVehicleColours native.

Thank you for your answer!

Can you tell me where to put it please? I would like to be able to choose the color on each vehicle, so I guess I have to integrate it into each “config.cars”?

Compared to the code I put above, can you tell me precisely what to write in it please?

U sent here only some part of ur config. If you want to choose color of each vehicle, u will need to make function that will change color of ur selected vehicle. For example something like:

function setVehColors(paintIndex, secondary)
  local playerPed = PlayerPedId()
  local vehicle = GetVehiclePedIsIn(playerPed, false)
  local color1, color2 = GetVehicleColours(vehicle)

  if not secondary then SetVehicleColours(vehicle, paintIndex, color2)
  else SetVehicleColours(vehicle, color1, paintIndex)
  end
end)