ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. getNearestVehiclePaletteColor

Function

getNearestVehiclePaletteColor

Server and clientVehiclesTrilogy Hub only

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