Revision Difference
Player:KeyPressed#527137
<function name="KeyPressed" parent="Player" type="classfunc">
<description>Gets whether a key was just pressed this tick</description>
<realm>Shared</realm>
<args>
<arg name="key" type="number">Corresponds to an <page>Enums/IN</page></arg>
</args>
<rets>
<ret name="" type="boolean">Was pressed or not</ret>
</rets>
</function>
<example>
<description>Prints whenever the first player first starts pressing W</description>
<code>
hook.Add( "Tick", "CheckPlayer1Forward", function()
if( Entity( 1 ):KeyPressed( IN_FORWARD )) then
print( "Ent1 just started moving forward!" )
end
if ( Entity( 1 ):KeyPressed( IN_FORWARD ) ) then
print( "Player1 just started moving forward!" )
end
end )
</code>
</example>