Garry's Mod Wiki

Revision Difference

input.IsKeyDown#515926

<function name="IsKeyDown" parent="input" type="libraryfunc"> <description>Gets whether a key is down</description> <realm>Client and Menu</realm> <args> <arg name="key" type="number">The key, see &lt;page&gt;KEY&lt;/page&gt;.</arg> </args> <rets> <ret name="" type="boolean">Is the key down</ret> </rets> </function> ⤶ <example>⤶ <description>Show cursor if you press alt.</description>⤶ <code>⤶ hook.Add("Think", "BM_Clients_Key", function()⤶ gui.EnableScreenClicker( input.IsKeyDown( KEY_LALT ) ) end)⤶ ⤶ {{Example⤶ | Description = Show cursor if you press alt.| Code = hook.Add("Think", "BM_Clients_Key", function()⤶ ```⤶ gui.EnableScreenClicker( input.IsKeyDown( KEY_LALT ) ) ```⤶ ⤶ end)⤶ // Note this may prevent the cursor from naturally appearing without alt </code>⤶ ⤶ </example>}}