getting player speed in kmh [++Rep]
#1

hello guys
is that functions gets player speed in kph or mph

pawn Код:
stock GetPlayerSpeed(playerid, bool:kmh)
{
  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.55):floatround(rtn * 100);
}
pawn Код:
forward Float: ReturnVehicleSpeed(playerid);
public Float: ReturnVehicleSpeed(playerid)
{
    new Float: fVelocity[3];
    GetVehicleVelocity(GetPlayerVehicleID(playerid), fVelocity[0], fVelocity[1], fVelocity[2]);
    return floatsqroot((fVelocity[0] * fVelocity[0]) + (fVelocity[1] * fVelocity[1]) + (fVelocity[2] * fVelocity[2]) + (fVelocity[1] * fVelocity[1]) + (fVelocity[2] * fVelocity[2])) * 140;
}
sorry for my bad englsih
Reply


Messages In This Thread
getting player speed in kmh [++Rep] - by simo0000 - 30.06.2015, 00:51
Re: getting player speed in kmh [++Rep] - by MohammedZ - 30.06.2015, 03:16
Re: getting player speed in kmh [++Rep] - by Suicidal.Banana - 30.06.2015, 10:05
Re: getting player speed in kmh [++Rep] - by baba1234 - 30.06.2015, 13:16

Forum Jump:


Users browsing this thread: 1 Guest(s)