GetVehicleHeadLightColor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Needs example)
Line 16: Line 16:
</section>
</section>


==Example==  
==Examples==  
<section name="Example" class="server" show="true">
This example outputs the player vehicle head lights color.
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--TODO
function getHeadLightsColor()
local vehicle = getPedOccupiedVehicle(localPlayer) -- We get the player vehicle..
if (vehicle) then -- We check if he's on a vehicle...
local r, g, b = getVehicleHeadLightColor(vehicle) -- We get the vehicle head lights color..
outputChatBox("Your vehicle lights color are: ".. r ..", ".. g ..", ".. b) -- We output them to the chatbox.
end
end
addCommandHandler("lightscolor",getHeadLightsColor) -- Add the command handler attached to the function "getHeadLightsColor".
</syntaxhighlight>
</section>
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
function getHeadLightsColor(thePlayer)
local vehicle = getPedOccupiedVehicle(thePlayer) -- We get the player vehicle..
if (vehicle) then -- We check if he's on a vehicle...
local r, g, b = getVehicleHeadLightColor(vehicle) -- We get the vehicle head lights color..
outputChatBox("Your vehicle lights color are: ".. r ..", ".. g ..", ".. b, thePlayer) -- We output them to the chatbox.
end
end
addCommandHandler("lightscolor",getHeadLightsColor) -- Add the command handler attached to the function "getHeadLightsColor".
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Revision as of 23:26, 28 January 2012

This function will get the headlight color of a vehicle.

Syntax

Click to collapse [-]
Server and Client
int, int, int getVehicleHeadLightColor ( vehicle theVehicle )            

Required Arguments

  • theVehicle: The vehicle that you wish to set the headlight color of.

Returns

Returns three integers for the red, green and blue of the headlight color for the specified vehicle, false if an invalid vehicle was specified.

Examples

This example outputs the player vehicle head lights color.

Click to collapse [-]
Client
function getHeadLightsColor()
	local vehicle = getPedOccupiedVehicle(localPlayer) -- We get the player vehicle..
	if (vehicle) then -- We check if he's on a vehicle...
		local r, g, b = getVehicleHeadLightColor(vehicle) -- We get the vehicle head lights color..
		outputChatBox("Your vehicle lights color are: ".. r ..", ".. g ..", ".. b) -- We output them to the chatbox.
	end
end
addCommandHandler("lightscolor",getHeadLightsColor) -- Add the command handler attached to the function "getHeadLightsColor".
Click to collapse [-]
Server
function getHeadLightsColor(thePlayer)
	local vehicle = getPedOccupiedVehicle(thePlayer) -- We get the player vehicle..
	if (vehicle) then -- We check if he's on a vehicle...
		local r, g, b = getVehicleHeadLightColor(vehicle) -- We get the vehicle head lights color..
		outputChatBox("Your vehicle lights color are: ".. r ..", ".. g ..", ".. b, thePlayer) -- We output them to the chatbox.
	end
end
addCommandHandler("lightscolor",getHeadLightsColor) -- Add the command handler attached to the function "getHeadLightsColor".

See Also