SA-MP Forums Archive
How create IsPlayerMoving or not? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How create IsPlayerMoving or not? (/showthread.php?tid=259636)



How create IsPlayerMoving or not? - GaudenasLT - 05.06.2011

Hi, i have a question. How create IsPlayerMoving or not. I am trying so
Код:
stock bool:IsPlayerMoving(playerid)
{
	new Float:Velocity[3];
	GetPlayerVelocity(playerid, Velocity[0], Velocity[1], Velocity[2]);
	if(Velocity[0] == 0 && Velocity[1] == 0 && Velocity[2] == 0) return true;
	return false;
}
and check
Код:
if(IsPlayerMoving(playerid))
{
	
}
else
{
	
}
But, i getting variables or moneys. Where is the problem?


Re: How create IsPlayerMoving or not? - Y2K - 05.06.2011

The problem is that you say the player is moving when the velocity is zero.


This forum requires that you wait 120 seconds between posts. Please try again in 18 seconds.


Re: How create IsPlayerMoving or not? - GaudenasLT - 05.06.2011

Can you give me example?


Re: How create IsPlayerMoving or not? - Calgon - 05.06.2011

You put the returns the wrong way around.

pawn Код:
stock bool:IsPlayerMoving(playerid)
{
    new Float:Velocity[3];
    GetPlayerVelocity(playerid, Velocity[0], Velocity[1], Velocity[2]);
    if(Velocity[0] == 0 && Velocity[1] == 0 && Velocity[2] == 0) return false;
    return true;
}



Re: How create IsPlayerMoving or not? - GaudenasLT - 05.06.2011

Thanks. ;]