GM/PlayerBindPress

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{Hook |Name=PlayerBindPress |Parent=GM |Description= |Realm=Client }}")
 
Line 2: Line 2:
 
|Name=PlayerBindPress
 
|Name=PlayerBindPress
 
|Parent=GM
 
|Parent=GM
|Description=
+
|Description=Runs when a bind has been pressed. Allows to block commands.
 
|Realm=Client
 
|Realm=Client
 +
}}
 +
{{Arg
 +
|type=Player
 +
|name=ply
 +
|desc=The player who used the command
 +
}}
 +
{{Arg
 +
|type=string
 +
|name=cmd
 +
|desc=The bind command
 +
}}
 +
{{Arg
 +
|type=Player
 +
|name=pressed
 +
|desc=If the bind was activated or deactivated
 +
}}
 +
{{Example
 +
|Description=Prevents players from using flashlight.
 +
|Code=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
 
}}
 
}}

Revision as of 22:58, 1 May 2013

 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 cmd

The bind command

Arguments

Player pressed

If the bind was activated or deactivated

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