Garry's Mod Wiki

GM:PlayerButtonDown

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

Description

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.

Arguments

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

Example

Prints the person who pressed the key.

hook.Add( "PlayerButtonDown", "ButtonUpWikiExample", function( ply, button ) print( ply:Nick() .. " pressed " .. input.GetKeyName(button) ) end)

Page Links


Special Pages


Wikis

?

Render Time: 36ms

DB GetPage 3
Generate Html 5
SaveChanges (1) 12
Render Body 0
Render Sidebar 13