Garry's Mod Wiki

Revision Difference

GM:PlayerButtonUp#527331

<function name="PlayerButtonUp" parent="GM" type="hook"> <ishook>yes</ishook> <description>Called when a player releases a button. This will not be called if player has a panel opened with keyboard input enabled, use <page>PANEL:OnKeyCodeReleased</page> instead. </description> <realm>Shared</realm> <predicted>Yes</predicted> <args> <arg name="ply" type="Player">Player who released the button</arg> <arg name="button" type="number">The button, see <page>Enums/BUTTON_CODE</page></arg> </args> </function> <example> <description>Prints the person who released the key.</description> <code> hook.Add( "PlayerButtonDown", "ButtonUpWikiExample", function( ply ) -- we don't need the second argument⤶ print( ply:Nick() .. " released me." ) hook.Add( "PlayerButtonDown", "ButtonUpWikiExample", function( ply, button )⤶ print( ply:Nick() .. " released " .. input.GetKeyName(button) ) end) </code> <output>Prints "Arkov Le Chauve released me." to the console.</output> ⤶ ⤶ </example></example>