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.

Methods

number Vehicle:BoostTimeLeft()
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.
number, number, number Vehicle:GetAmmo()
Returns information about the ammo of the vehicle
number Vehicle:GetCameraDistance()
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.
number Vehicle:GetMaxSpeed()
Returns the max speed of the vehicle in MPH.
table Vehicle:GetOperatingParams()
Returns some info about the vehicle.
Entity Vehicle:GetPassenger( number passenger )
Gets the passenger of the vehicle, returns NULL if no drivers is present.
Vector, Angle Vehicle:GetPassengerSeatPoint( number role )
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.
number Vehicle:GetSteering()
Returns the current steering of the vehicle.
number Vehicle:GetSteeringDegrees()
Returns the maximum steering degree of the vehicle
boolean Vehicle:GetThirdPersonMode()
Returns if vehicle has thirdperson mode enabled or not.
number Vehicle:GetThrottle()
Returns the current throttle of the vehicle.
string Vehicle:GetVehicleClass()
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.
table Vehicle:GetVehicleParams()
Returns the vehicle parameters of given vehicle.
Vector, Angle, number Vehicle:GetVehicleViewPosition( number role = 0 )
Returns the view position and forward angle of a given passenger seat.
PhysObj Vehicle:GetWheel( number wheel )
Returns the PhysObj of given wheel.
number Vehicle:GetWheelBaseHeight( number wheel )
Returns the base wheel height.
Vector, number, boolean Vehicle:GetWheelContactPoint( number wheel )
Returns the wheel contact point.
number Vehicle:GetWheelCount()
Returns the wheel count of the vehicle
number Vehicle:GetWheelTotalHeight( number wheel )
Returns the total wheel height.
boolean Vehicle:HasBoost()
Returns whether this vehicle has boost at all.
boolean Vehicle:HasBrakePedal()
Returns whether this vehicle has a brake pedal. See Vehicle:SetHasBrakePedal.
boolean Vehicle:IsBoosting()
Returns whether this vehicle is currently boosting or not.
boolean Vehicle:IsEngineEnabled()
Returns whether the engine is enabled or not, i.e. whether it can be started.
boolean Vehicle:IsEngineStarted()
Returns whether the engine is started or not.
boolean Vehicle:IsValidVehicle()
Returns true if the vehicle object is a valid or not. This will return false when Vehicle functions are not usable on the vehicle.
boolean Vehicle:IsVehicleBodyInWater()
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: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.
Vehicle:SetVehicleEntryAnim( boolean bOn )
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 Structures/VehicleParams can be set.Because this method uses miles per hour but Vehicle:GetVehicleParams returns Hammer units per second, this method incorrectly modifies the vehicle engine's "boostMaxSpeed", "maxRevSpeed" and "maxSpeed" even when not explicitly set in a call to this method. Workaround: In order to retain the original values for these fields, call Vehicle:GetVehicleParams yourself, conv..
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.

Page Links


Special Pages


Wikis

?

Render Time: 22ms

Session 0
DB GetPage 4
Generate Html 2
SaveChanges 8
Render Body 0
Render Sidebar 6