Author Topic: How to check if a key is held down and then Add Velocity in that direction  (Read 929 times)

so i want to check if the player is holding down W,A,S,or D and while also holding Shift and if true Add Velocity in that direction

could use something similar to the crouch racer

If I'm not mistaken, there's no way to do it with the direction keys. Crouch Racer is a playertype, if my memory serves me well. You can use armor:onTrigger to call your code when someone jumps/rightclicks/leftclicks/crouches, or servercmdLight when someone presses R.

Look into space guy's double jump code for his bat. That's probably the best you can do.

You can with vectors.

Look into space guy's double jump code for his bat. That's probably the best you can do.
I'd say something similar to crouch racer with tons of air control while airborn would work
You can with vectors.
yes, adding velocity is the easy part
now for the hard part, how to detect the client trying to move forward/backwards/strafe?

If i made a player type could i have it send what key the player is pressing?

No, you'd need a clientside add-on to tell the server when a key is being pressed


Just make a playertype with modified crouch speeds.
You could use armor::ontrigger and addvelocity but it's much more complicated for the exact same end result
« Last Edit: June 21, 2015, 04:54:23 PM by Headcrab Zombie »

No, you'd need a clientside add-on to tell the server when a key is being pressed


Just make a playertype with modified crouch speeds.
You could use armor::ontrigger and addvelocity but it's much more complicated for the exact same end result
Ok sounds good thanks