Simulate key press?

Is there a “command” to make a player simulate a keypress?
like this:
ply:PressKey(“KEY_NONE,KEY_FIRST”)

I think you need to do it in

GM:SetupMove, but what are you actually trying to do? There might be a better way.


input.IsKeyDown( number key )

https://wiki.garrysmod.com/page/Enums/KEY <- use the decimal values from here to determine if the correct key is pressed.

Wiki: https://wiki.garrysmod.com/page/input/IsKeyDown

If this is too hard, i recommend you to recreate the actions more than inputs

cmd:SetButtons(KEY_?/IN_?)

I’m not sure if when you do that it’s recognized by input.IsKeyDown or KeyPressed.

Im trying to make a towtruck that has buttons to “effect” the winch on it

[editline]21st November 2016[/editline]

What you mean with “actions”?

[editline]21st November 2016[/editline]

Im trying to make a towtruck that has buttons to “effect” the winch on it

Don’t overcomplicate it, see winch tool and see how does it manages winch

Winch tool?
And by the way, shouldn’t it work if i make the tow truck use a command?