Garry's Mod Wiki


boolean GM:PlayerBindPress( Player ply, string bind, boolean pressed )


Runs when a bind has been pressed. Allows to block commands.

By using the "alias" console command, this hook can be effectively circumvented. To prevent this use input.TranslateAlias.

To stop the user from using +attack, +left and any other movement commands of the sort, please look into using GM:StartCommand instead.

The third argument will always be true.

Issue Tracker: 1176
This does not run for function keys binds (F1-F12).

Issue Tracker: 2888


1 Player ply
The player who used the command; this will always be equal to LocalPlayer.
2 string bind
The bind command.
3 boolean pressed
If the bind was activated or deactivated.


1 boolean
Return true to prevent the bind.


Prevents players from using flashlight.

hook.Add( "PlayerBindPress", "PlayerBindPressExample", function( ply, bind, pressed ) --To block more commands, you could add another line similar to --the one below, just replace the command if ( string.find( bind, "impulse 100" ) ) then return true end end )

Page Links

Special Pages



Render Time: 77ms

DB GetPage 50
Generate Html 5
SaveChanges (1) 8
Render Body 0
Render Sidebar 12