SetVehicleHeadLightColor: Difference between revisions
Jump to navigation
Jump to search
m (Needs example) |
No edit summary |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setVehicleHeadLightColor ( vehicle theVehicle, int red, int green, int blue) | bool setVehicleHeadLightColor ( vehicle theVehicle, int red, int green, int blue) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[vehicle]]:setHeadLightColor||getVehicleHeadLightColor}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theVehicle:''' The [[vehicle]] that you wish to set the headlight color of. | *'''theVehicle:''' The [[vehicle]] that you wish to set the headlight color of. | ||
Line 17: | Line 16: | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if vehicle's headlight color was set, ''false'' if an invalid vehicle or invalid color ranges were specified for red,green or blue. | Returns ''true'' if vehicle's headlight color was set, ''false'' if an invalid vehicle or invalid color ranges were specified for red,green or blue. | ||
==Example== | ==Example== | ||
This example changes car lights color with command ''/carlights red_color, green_color, blue_color'' | |||
It shows error if player isn't in vehicle or color failed to change. It shows a message if color changed successful. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | 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 ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Vehicle_functions}} | {{Vehicle_functions}} | ||
Latest revision as of 22:21, 18 December 2014
This function will set the headlight color of a vehicle. valid Red Green and Blue arguments range from 0-255
Syntax
bool setVehicleHeadLightColor ( vehicle theVehicle, int red, int green, int blue)
OOP Syntax Help! I don't understand this!
- Method: vehicle:setHeadLightColor(...)
- Counterpart: getVehicleHeadLightColor
Required Arguments
- theVehicle: The vehicle that you wish to set the headlight color of.
- red: An integer indicating the amount of red for the vehicle's headlights
- green: An integer indicating the amount of green for the vehicle's headlights
- blue: An integer indicating the amount of blue for the vehicle's headlights
Returns
Returns true if vehicle's headlight color was set, false if an invalid vehicle or invalid color ranges were specified for red,green or blue.
Example
This example changes car lights color with command /carlights red_color, green_color, blue_color
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
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates