Garry's Mod Wiki

Revision Difference

GM:InputMouseApply#527804

<function name="InputMouseApply" parent="GM" type="hook"> <ishook>yes</ishook> <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.</description> <realm>Client</realm> <predicted>No</predicted> <args> <arg name="cmd" type="CUserCmd">User command</arg>⤶ <arg name="x" type="number">The amount of mouse movement across the X axis this frame</arg>⤶ <arg name="y" type="number">The amount of mouse movement across the Y axis this frame</arg>⤶ <arg name="ang" type="Angle">The current view angle</arg>⤶ <arg name="cmd" type="CUserCmd">User command.</arg>⤶ <arg name="x" type="number">The amount of mouse movement across the X axis this frame.</arg>⤶ <arg name="y" type="number">The amount of mouse movement across the Y axis this frame.</arg>⤶ <arg name="ang" type="Angle">The current view angle.</arg>⤶ </args> <rets> <ret name="" type="boolean">Return true if we modified something</ret>⤶ <ret name="" type="boolean">Return true if we modified something.</ret>⤶ </rets> </function> <example> <description>Prevents all players from turning with the mouse.</description> <code> hook.Add("InputMouseApply", "FreezeTurning", function( cmd ) cmd:SetMouseX(0) cmd:SetMouseY(0) return true⤶ end)⤶ hook.Add( "InputMouseApply", "FreezeTurning", function( cmd ) cmd:SetMouseX( 0 ) cmd:SetMouseY( 0 ) ⤶ return true⤶ end )⤶ </code> ⤶ </example></example>