SetVehicleLightState: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (void -> bool)
No edit summary
Line 8: Line 8:
==Required Arguments==
==Required Arguments==
*'''theVehicle:''' A handle to the [[vehicle]] that you wish to change the light state of.
*'''theVehicle:''' A handle to the [[vehicle]] that you wish to change the light state of.
*'''light:''' A whole number determining the individual light.
*'''light:''' A whole number determining the individual light. (0 - 3)
*'''state:''' A whole number determining the new state of the light. ''0'' represents normal lights, and ''1'' represents broken lights.
*'''state:''' A whole number determining the new state of the light. ''0'' represents normal lights, and ''1'' represents broken lights.
===Returns===
Returns ''true'' if the light state was set, ''false'' if invalid arguments were passed to the function.


==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
newcar = createVehicle ( 520, 1024, 1024, 1024 )  -- create a new vehicle
newcar = createVehicle ( 520, 1024, 1024, 1024 )  -- create a new vehicle
state = setVehicleLightState ( newcar, 0,  1 )    -- break one of its lights
state = setVehicleLightState ( newcar, 0,  1 )    -- break the left front light
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Vehicle functions}}
{{Vehicle functions}}

Revision as of 19:21, 15 April 2009

This function sets the state of the light on the vehicle.

Syntax

bool setVehicleLightState ( vehicle theVehicle, int light, int state )

Required Arguments

  • theVehicle: A handle to the vehicle that you wish to change the light state of.
  • light: A whole number determining the individual light. (0 - 3)
  • state: A whole number determining the new state of the light. 0 represents normal lights, and 1 represents broken lights.

Returns

Returns true if the light state was set, false if invalid arguments were passed to the function.

Example

newcar = createVehicle ( 520, 1024, 1024, 1024 )   -- create a new vehicle
state = setVehicleLightState ( newcar, 0,  1 )     -- break the left front light

See Also