- Documentation
- Shared functions
- getVehicleColor
Function
getVehicleColor
Returns a vehicle's colours. Without the second argument it gives four game palette numbers (when the car has RGB colours, the numbers are the nearest palette colours). With rgb = true it returns twelve numbers: r, g, b for colours 1-4 in turn, exactly as seen in the game.
Syntax
int... getVehicleColor(vehicle vehicle [, bool rgb = false])Arguments
vehiclevehicle- The vehicle.
rgbbool, optional = falsetrue= return RGB values instead of palette numbers.
Returns
4 palette numbers or 12 RGB components.
Example
addCommandHandler("kolor", function(player)
local vehicle = getPedOccupiedVehicle(player)
if not vehicle then return end
local r, g, b = getVehicleColor(vehicle, true)
outputChatBox(("Lakier: %d, %d, %d"):format(r, g, b), player, r, g, b)
end)
See also
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.getVehicleColorIdReturns the two palette numbers set withsetVehicleColorId. When the vehicle has RGB colours fromsetVehicleColor(or none yet), it returnsfalse; usegetVehicleColorthen.