Garry's Mod Wiki

Revision Difference

GM:KeyRelease#511139

<function name="KeyRelease" parent="GM" type="hook">⤶ <ishook>yes</ishook>⤶ <description>⤶ Runs when a IN key was released by a player.⤶ ⤶ For a more general purpose function that handles all kinds of input, see <page>GM:PlayerButtonUp</page>⤶ </description>⤶ <realm>Shared</realm>⤶ <predicted>Yes</predicted>⤶ <args>⤶ <arg name="ply" type="Player">The player releasing the key. If running client-side, this will always be &lt;page&gt;Global.LocalPlayer&lt;/page&gt;</arg>⤶ <arg name="key" type="number">The key that the player released using &lt;page&gt;IN&lt;/page&gt;.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>"hi" will be printed to the console when the player releases the IN_USE (E) key.</description>⤶ <code>⤶ function GM:KeyRelease( player, key )⤶ if ( key == IN_USE ) then⤶ print( "hi" )⤶ end⤶ end⤶ </code>⤶ <outputfixedwidth>Fixed width</outputfixedwidth>⤶ <output>hi</output>⤶ ⤶ </example>