GetPlayerSpeed Question
#1

First, excuse me for my bad English!
So, I use this option for my Speedometer
Код:
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);
}
http://forum.sa-mp.com/index.php?topic=120115.0

Exist currently a faster stock?
Reply
#2

Read replies in that topic and you will get answer.
Reply
#3

Maybe

pawn Код:
stock GetPlayerSpeed(playerid)
{
  new Float:x,Float:y,Float:z;
  if(IsPlayerInAnyVehicle(playerid))
GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
else
GetPlayerVelocity(playerid,x,y,z);
return floatround((ServerVariables[SPEED_3D]?floatsqroot(x*x+y*y+z*z):floatsqroot(x*x+y*y))*100.0*1.6);
}
Reply
#4

Oh, sorry, I'm lost and not noticed that I write in SA-MP Scripting and Plugins thread ..
Can someone please move the thread?
My problem is with the speed that the numbers from 0 to 11.34 and so on,
But times have I seen a video, where the display with the speed of 0 is risen, and so 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14 more ..
Reply
#5

Quote:
Originally Posted by wofka13
Oh, sorry, I'm lost and not noticed that I write in SA-MP Scripting and Plugins thread ..
Can someone please move the thread?
My problem is with the speed that the numbers from 0 to 11.34 and so on,
But times have I seen a video, where the display with the speed of 0 is risen, and so 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14 more ..
So you want to round?
Use %0.f in your string then.
Reply
#6

Does not work with
Код:
%0.f
The Speed ist always 0
Here is a video what i meant
http://www.xfire.com/video/2489a5/
The Speed starts from 0 and a number always rises higher (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 ,20,21,22,23,24,25.....)
Reply
#7

Nobody knows anything?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)