setVehicleHeadLightColor | Multi Theft Auto: Wiki Skip to content

setVehicleHeadLightColor

Client-side
Server-side
Shared

Pair: getVehicleHeadLightColor

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function will set the headlight color of a vehicle. valid Red Green and Blue arguments range from 0-255

Syntax

setVehicleHeadLightColor ( )

Code Examples

server

It shows error if player isn't in vehicle or color failed to change. It shows a message if color changed successful.

function changeCarLightsColor ( thePlayer, command, red, green, blue )
local theVehicle = getPedOccupiedVehicle ( thePlayer )
if ( not theVehicle ) then
return outputChatBox( "You don't have vehicle!" )
end
red = tonumber ( red )
green = tonumber ( green )
blue = tonumber ( blue )
-- check if the colour values for red, green and blue are valid
if red and green and blue then
local color = setVehicleHeadLightColor ( theVehicle, red, green, blue )
if(not color) then
outputChatBox( "Failed to change vehicle lights color" )
else
outputChatBox ( "Vehicle lights color changed sucessfully" )
end
else
outputChatBox( "Failed to change vehicle lights color" )
end
end
addCommandHandler ( "carlights", changeCarLightsColor )

See Also

Vehicle Functions