GM/PlayerBindPress

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(localplayer note, I wonder why the player is even an argument here)
Line 9: Line 9:
 
|type=Player
 
|type=Player
 
|name=ply
 
|name=ply
|desc=The player who used the command
+
|desc=The player who used the command; this will always be equal to {{GlobalFunction|LocalPlayer}}
 
}}
 
}}
 
{{Arg
 
{{Arg

Revision as of 20:13, 19 February 2015

 GM:PlayerBindPress( )

Contents

Description

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

Arguments

Player ply

The player who used the command; this will always be equal to LocalPlayer

Arguments

string bind

The bind command

Arguments

boolean pressed

If the bind was activated or deactivated

Returns

boolean

Return true to prevent the bind

Examples

Example

Prevents players from using flashlight.

function GM:PlayerBindPress( 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


Personal tools
Navigation