Garry's Mod Wiki

Vehicle

This is a list of all methods only available for vehicles. It is also possible to call Entity functions on vehicles.

Inherits methods from Entity.

Methods

Returns the remaining boosting time left.
Vector Vehicle:CheckExitPoint( number yaw, number distance )
Tries to find an Exit Point for leaving vehicle, if one is unobstructed in the direction given.
Vehicle:EnableEngine( boolean enable )
Sets whether the engine is enabled or disabled, i. e. can be started or not.
Returns information about the ammo of the vehicle
Returns third person camera distance.
Entity Vehicle:GetDriver()
Gets the driver of the vehicle, returns NULL if no driver is present.
number Vehicle:GetHLSpeed()
Returns the current speed of the vehicle in Half-Life Hammer Units (in/s). Same as Entity:GetVelocity + Vector:Length.
Returns the max speed of the vehicle in MPH.
Returns some info about the vehicle.
Entity Vehicle:GetPassenger( number passenger )
Gets the passenger of the vehicle, returns NULL if no drivers is present.
Returns the seat position and angle of a given passenger seat.
number Vehicle:GetRPM()
Returns the current RPM of the vehicle. This value is fake and doesn't actually affect the vehicle movement.
number Vehicle:GetSpeed()
Returns the current speed of the vehicle in MPH.
Returns the current steering of the vehicle.
Returns the maximum steering degree of the vehicle
Returns if vehicle has thirdperson mode enabled or not.
Returns the current throttle of the vehicle.
Returns the vehicle class name. This is only useful for Sandbox spawned vehicles or any vehicle that properly sets the vehicle class with Vehicle:SetVehicleClass.
Returns the vehicle parameters of given vehicle.
Returns the view position and forward angle of a given passenger seat.
PhysObj Vehicle:GetWheel( number wheel )
Returns the PhysObj of given wheel.
Returns the base wheel height.
Returns the wheel contact point.
Returns the wheel count of the vehicle
Returns the total wheel height.
boolean Vehicle:HasBoost()
Returns whether this vehicle has boost at all.
Returns whether this vehicle has a brake pedal. See Vehicle:SetHasBrakePedal.
Returns whether this vehicle is currently boosting or not.
Returns whether the engine is enabled or not, i. e. whether it can be started.
Returns whether the engine is started or not.
Returns true if the vehicle object is a valid or not. This will return false when Vehicle functions are not usable on the vehicle.
Returns whether this vehicle's engine is underwater or not. ( Internally the attachment point "engine" or "vehicle_engine" is checked )
Vehicle:ReleaseHandbrake()
Releases the vehicle's handbrake (Jeep) so it can roll without any passengers. This will be overwritten if the vehicle has a driver. Same as Vehicle:SetHandbrake( false )
Vehicle:SetBoost( number boost )
Sets the boost. It is possible that this function does not work while the vehicle has a valid driver in it.
Vehicle:SetCameraDistance( number distance )
Sets the third person camera distance of the vehicle.
Vehicle:SetHandbrake( boolean handbrake )
Turns on or off the Jeep handbrake so it can roll without a driver inside. Does nothing while the vehicle has a driver in it.
Vehicle:SetHasBrakePedal( boolean brakePedal )
Sets whether this vehicle has a brake pedal.
Vehicle:SetMaxReverseThrottle( number maxRevThrottle )
Sets maximum reverse throttle
Vehicle:SetMaxThrottle( number maxThrottle )
Sets maximum forward throttle
Vehicle:SetSpringLength( number wheel, number length )
Sets spring length of given wheel
Vehicle:SetSteering( number front, number rear )
Sets the steering of the vehicle. The correct range, 0 to 1 or -1 to 1
Vehicle:SetSteeringDegrees( number steeringDegrees )
Sets the maximum steering degrees of the vehicle
Vehicle:SetThirdPersonMode( boolean enable )
Sets the third person mode state.
Vehicle:SetThrottle( number throttle )
Sets the throttle of the vehicle. It is possible that this function does not work with a valid driver in it.
Vehicle:SetVehicleClass( string class )
This is used internally - although you're able to use it you probably shouldn't. Sets the vehicle class name.
Sets whether the entry or exit camera animation should be played or not.
Vehicle:SetVehicleParams( table params )
Sets the vehicle parameters for given vehicle. Not all variables from the VehicleParams structure can be set.
Vehicle:SetWheelFriction( number wheel, number friction )
Sets friction of given wheel. This function may be broken.
Vehicle:StartEngine( boolean start )
Starts or stops the engine.