SetVehicleOverrideLights

From Multi Theft Auto: Wiki
Revision as of 20:00, 15 August 2007 by Arc (talk | contribs)
Jump to navigation Jump to search

This function changes the light overriding setting on a vehicle, possible values are: 0 (No override), 1 (Force off), 2 (Force on)

Syntax

bool setVehicleOverrideLights ( vehicle theVehicle, int value )

Required Arguments

  • theVehicle: The vehicle you wish to change the override lights setting of.
  • value: A whole number representing 1 of the 3 settings (0,1,2)

Returns

Returns true if the vehicle's lights setting was changed. Otherwise false.

Example

This example will toggle the car lights on and off for a player's vehicle

function vehicleLights ( source )
    playervehicle = getPlayerOccupiedVehicle ( source )              -- get the player's vehicle
    if ( playervehicle ) then                                        -- if he was in one
        if ( getVehicleOverrideLights ( playervehicle ) ~= 2 ) then  -- if the current state isn't 'force on'
            setVehicleOverrideLights ( playervehicle, 2 )            -- force the lights on
        else
            setVehicleOverrideLights ( playervehicle, 1 )            -- otherwise, force the lights off
        end
    end
end
addCommandHandler ( "vehiclelights", vehicleLights )

See Also