Garry's Mod Wiki

GM:VehicleMove

  GM:VehicleMove( Player ply, Vehicle veh, CMoveData mv )
This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.

Description

Called when you are driving a vehicle. This hook works just like GM:Move.

This hook is called before GM:Move and will be called when GM:PlayerTick is not.

Arguments

1 Player ply
Player who is driving the vehicle
2 Vehicle veh
The vehicle being driven
3 CMoveData mv
Move data

Example

Disables the base gamemode's 3rd person vehicle camera option.

hook.Add( "VehicleMove", "DisableVehicle3rdPerson", function( ply, vehicle, mv ) if ( mv:KeyPressed( IN_DUCK ) && vehicle.SetThirdPersonMode ) then vehicle:SetThirdPersonMode( false ) return true -- Block the GM:VehicleMove which sets the 3rd person mode end end )