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

Function

getVehicleColor

Server and clientVehiclesIdentical to MTA:SA

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 = false
true = 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