Get Speed of a player.
#3

Quote:
Originally Posted by //exora
0.3 only.

pawn Код:
stock GetPlayerSpeed(playerid, bool:kmh) // by misco
{
  new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
  if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz);
  rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
  return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
}
Thanks xD

Just when I found out a way to do it on my own -.-

I got mine working,

Saved the players pos,

Took the distance to that pos 1 sec later,

multiplied the distance by 2.7 and got out a speed.

Not too realistic speed but at least something xD

Thanks anyway man
Reply


Messages In This Thread
Get Speed of a player. - by introzen - 30.10.2009, 20:28
Re: Get Speed of a player. - by woot - 30.10.2009, 20:49
Re: Get Speed of a player. - by introzen - 30.10.2009, 21:24

Forum Jump:


Users browsing this thread: 1 Guest(s)