Detect if player is running
#1

Anybody know a best way to detect if player is running?

I trying this:
Код:
		if(HOLDING(KEY_SPRINT) || PRESSING(newkeys, KEY_SPRINT ))
		{
			if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
			{
				PlayerRunning(playerid);
			}
		}
		if(RELEASED(KEY_SPRINT))
		{
			CounterStopRunning[playerid] = SetTimerEx("PlayerNotRunning", 100, 0, "i", playerid);
		}
But sometimes it bug, when player fall, player anim...
Its show player running when player is not and show player not running when player is running
Reply
#2

checking the animation and velocity is better I think.
Reply
#3

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
checking the animation and velocity is better I think.
Like he said ^
Check if the animation equals to the running animation
Reply
#4

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
checking the animation and velocity is better I think.
You mean checking anim ID?
GetPlayerAnimationIndex(playerid) == X
Because it's sometimes bug here with no UsePlayerPedAnims();
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)