SetVehicleEngineState

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

This function changes the on/off state of a vehicle's engine

Syntax

bool setVehicleEngineState ( vehicle theVehicle, bool engineOn )

Required Arguments

  • theVehicle: The vehicle you wish to change the engine state of.
  • engineOn: A boolean value representing whether or not the engine will be turned on or off.

Returns

Returns true if the vehicle's engine state was successfully changed, false otherwise.

Example

This example will disallow the use of the engine in any vehicle.

function onPlayerEnterVehicle ( theVehicle, seat, jacked )
    if seat == 0 then                                 -- if they're getting into the driver seat
        setVehicleEngineState ( theVehicle, false )   -- turn off the engine
    end
end
addEventHandler ( "onPlayerEnterVehicle", getRootElement ( ), onPlayerEnterVehicle )

See Also