GM/PlayerBindPress

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Undo revision 12815 by Dane (talk))
Line 4: Line 4:
 
|Description=Runs when a bind has been pressed. Allows to block commands.
 
|Description=Runs when a bind has been pressed. Allows to block commands.
 
|Realm=Client
 
|Realm=Client
 +
|Predicted=No
 
}}
 
}}
 
{{Arg
 
{{Arg
Line 19: Line 20:
 
|name=pressed
 
|name=pressed
 
|desc=If the bind was activated or deactivated
 
|desc=If the bind was activated or deactivated
 +
}}
 +
{{Ret
 +
|type=boolean
 +
|desc=Return true to prevent the bind
 
}}
 
}}
 
{{Example
 
{{Example

Revision as of 10:16, 26 October 2014

 GM:PlayerBindPress( )

Contents

Description

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

Arguments

Player ply

The player who used the command

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