Garry's Mod Wiki

Player:KeyPressed

boolean Player:KeyPressed( number key )

Description

Gets whether a key was just pressed this tick

Arguments

1 number key
Corresponds to an Enums/IN

Returns

1 boolean
Was pressed or not

Example

Prints whenever the first player first starts pressing W

hook.Add( "Tick", "CheckPlayer1Forward", function() if( Entity( 1 ):KeyPressed( IN_FORWARD )) then print( "Ent1 just started moving forward!" ) end end )

Page Links


Special Pages


Wikis

?

Render Time: 31ms

Session 0
DB GetPage 3
Generate Html 7
SaveChanges 8
Render Body 0
Render Sidebar 12