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 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.
This does not run for function keys binds (F1-F12).


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: 46ms

DB GetPage 3
Generate Html 18
SaveChanges (1) 10
Render Body 0
Render Sidebar 12