- Documentation
- Server functions
- setVehicleColorId
Function
setVehicleColorId
Sets a vehicle's colours using numbers from the San Andreas vehicle palette (0-127), as in the classic game and the carcols files. Number 0 is black, 1 white, 3 red, 6 yellow… (getVehiclePaletteColor gives names and colours). Passing one number sets both main colours to it.
Syntax
bool setVehicleColorId(vehicle vehicle, int id1 [, int id2 = id1, int id3 = nil, int id4 = id3])Arguments
vehiclevehicle- The vehicle.
id1int- Main colour number 0-127 (out-of-range values are clamped).
id2int, optional = id1- Second colour number 0-127.
id3int, optional = nil- Colour 3 number; without it colours 3 and 4 return to the model's own.
id4int, optional = id3- Colour 4 number.
Returns
true on success.
Example
local taxi = createVehicle(420, 1780, -1890, 13.4)
setVehicleColorId(taxi, 6, 1)
See also
getVehicleColorIdReturns the two palette numbers set withsetVehicleColorId. When the vehicle has RGB colours fromsetVehicleColor(or none yet), it returnsfalse; usegetVehicleColorthen.getVehiclePaletteColorReturns the colour with the given number from the game's vehicle palette (0-127) and its name. The RGB values are exactly what the Definitive Edition draws, so they suit e.g. a colour preview in a paint shop.setVehicleColorSets a vehicle's paint colours as any RGB colours, visible to every player. A vehicle has up to four colours: 1 = main paint, 2 = second colour (stripes, roof, rims depending on the model), 3 and 4 = extra parts of some models. Pass only the first three numbers and the second colour will match the first. Colours not in the game palette are drawn exactly, without rounding to the palette.