Check if player is running

How can I check if player is running? Or if player is executing the console command +speed?

Thank you for read.

-snip-

I is wrong, look below.

okay, what a noob I am :’(

Last time I checked there was no shame in not knowing a function :smiley:

Correct me if I’m wrong, but isn’t it IN_SPEED and not IN_BULLRUSH?

That’s what I thought.

IN_BULLRUSH does exist, but I don’t know wtf it does.

I did a quick test w/



	if(LocalPlayer():KeyDown(IN_BULLRUSH)) then
		print("Hello!")
	end

And it definitely doesn’t correspond to the sprint key

That’s how I remember it, oh well. Now, let’s go find out what it DOES do :buddy:

It’s unused.

Bull… squid? I don’t know :saddowns:

it’s IN_RUN

No, it is IN_SPEED.

Why not just use GetVelocity?

**[CMoveData.GetVelocity

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=CMoveData.GetVelocity)**

Means you can compare the speeds instead of having to check if a bunch of buttons are pressed.

What if the gamemode has changed the default walking speed to above that or the default running speed? Doing it that way would cause the script to think you were always running.

Yes and no. That function doesn’t state whether they’re running or walking, it just gets the velocity which the user can then compare themselves.

Just checking for IN_SPEED isn’t a good way either as the player doesn’t have to be moving.

Check for their horizontal velocity to be greater than zero ( vertical means falling / jumping ).
Check for an additional movement key ( IN_FORWARD, IN_BACK, IN_MOVERIGHT, IN_MOVELEFT ).
Check against being underwater ( WaterLevel( ) > 2 )
Check for being in a vehicle ( anything off the jeep base has turbo )

That’s how I’d go about it.

CMoveData is only available in the GM:Move hook.