Garry's Mod Wiki

GM:InputMouseApply

  boolean GM:InputMouseApply( CUserCmd cmd, number x, number y, Angle ang )

Description

Allows you to modify the supplied User Command with mouse input. This could be used to make moving the mouse do funky things to view angles.

Arguments

1 CUserCmd cmd
User command.
2 number x
The amount of mouse movement across the X axis this frame.
3 number y
The amount of mouse movement across the Y axis this frame.
4 Angle ang
The current view angle.

Returns

1 boolean
Return true if we modified something.

Example

Prevents all players from turning with the mouse.

hook.Add( "InputMouseApply", "FreezeTurning", function( cmd ) cmd:SetMouseX( 0 ) cmd:SetMouseY( 0 ) return true end )