- Documentation
- Shared functions
- getNearestVehiclePaletteColor
Function
getNearestVehiclePaletteColor
Finds the colour in the game's vehicle palette (0-127) most similar to the given RGB colour. Useful when a player picks a colour with a free colour picker and the script wants to store it as a palette number.
Syntax
int getNearestVehiclePaletteColor(int r, int g, int b)Arguments
rint- Red 0-255.
gint- Green 0-255.
bint- Blue 0-255.
Returns
Colour number 0-127.
Example
local id = getNearestVehiclePaletteColor(200, 30, 30)
outputDebugString("Najblizszy kolor palety: " .. id)
See also
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.setVehicleColorIdSets 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… (getVehiclePaletteColorgives names and colours). Passing one number sets both main colours to it.