Garry's Mod Wiki



  GM:PlayerButtonDown( Player ply, number button )
This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.


Called when a player presses a button.

This will not be called if player has a panel opened with keyboard input enabled, use PANEL:OnKeyCodePressed instead.


1 Player ply
Player who pressed the button
2 number button
The button, see Enums/BUTTON_CODE


Prints the person who pressed the key.

hook.Add( "PlayerButtonDown", "PlayerButtonDownWikiExample", function( ply, button ) if CLIENT then if ( IsFirstTimePredicted() ) then print( ply:Nick() .. " pressed " .. input.GetKeyName( button ) ) end else print( ply:Nick() .. " pressed " .. button ) end end)

Special Pages



Render Time: 74ms

DB GetPage 53
Generate Html 6
SaveChanges (1) 6
Render Body 0
Render Sidebar 7