Garry's Mod Wiki

drive

The drive library is for adding custom control modes to the new "remote control" entity piloting system in Garry's Mod 13. See Entity Driving.

Methods

boolean drive.CalcView( Player ply, table view )
This is used internally - although you're able to use it you probably shouldn't. Optionally alter the view.
This is used internally - although you're able to use it you probably shouldn't. Clientside, the client creates the cmd (usercommand) from their input device (mouse, keyboard) and then it's sent to the server. Restrict view angles here.
drive.DestroyMethod( Player ply )
This is used internally - although you're able to use it you probably shouldn't. Destroys players current driving method.
drive.End( Player ply, Entity ent )
Player has stopped driving the entity.
This is used internally - although you're able to use it you probably shouldn't. The move is finished. Copy mv back into the target.
table drive.GetMethod( Player ply )
This is used internally - although you're able to use it you probably shouldn't. Returns ( or creates if inexistent ) a driving method.
boolean drive.Move( Player ply, CMoveData mv )
This is used internally - although you're able to use it you probably shouldn't. The move is executed here.
drive.PlayerStartDriving( Player ply, Entity ent, string mode )
Starts driving for the player.
Stops the player from driving anything. ( For example a prop in sandbox )
drive.Register( string name, table data, string base = nil )
Registers a new entity drive.
drive.Start( Player ply, Entity ent )
Called when the player first starts driving this entity
boolean drive.StartMove( Player ply, CMoveData mv, CUserCmd cmd )
This is used internally - although you're able to use it you probably shouldn't. The user command is received by the server and then converted into a move. This is also run clientside when in multiplayer, for prediction to work.