GetPlayerSpeed, No timers-Player Speed instantly
#21

Why use floatpower? Just multiply it by itself.
Reply
#22

why use GetPlayerVehicleID(playerid)... if the player is in a vehicle the player and vehicle are both moving lol....
btw will this work?:
pawn Код:
floatsqroot(Vx*Vx + Vy*Vy + Vz*Vz);

stock GetPlayerSpeed(playerid,bool:kmh) // by misco edit by gamer_z
{
  new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
  GetPlayerVelocity(playerid,Vx,Vy,Vz);
  rtn = floatsqroot(Vx*Vx + Vy*Vy + Vz*Vz);
  return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
}
i read everyones post and combined with mine idea lol..
Reply
#23

i have edited it last time. if you have better solution about this speed calculation be free and share it
Reply
#24

Omg... Square of sum is not the same as sum of squares.
Reply
#25

Just a note: GetPlayerVelocity returns as 0 when in a vehicle so you need to use GetVehicleVelocity to calculate a vehicles velocity
Reply
#26

I'm using it for a speedo, but if i drive down the road full speed then turn left it goes back to like 20mph lol.
Reply
#27

Was an previous speedo better(or accurate) ?
Reply
#28

Quote:
Originally Posted by misco
Was an previous speedo better(or accurate) ?
By previous you mean the ones before Get...Velocity?

If so, yes they were both slower and inaccurate.

The old one got the players position with GetPlayerPos and then set a timer which got their pos in the next few seconds and calculated how far they traveled in a the timer time, thus getting the speed. However the problem with it was if you got lag and other issues with timers and teleporting it can be buggy at times.
Reply
#29

Hm.. GetPlayerSpeed doesn't work for me. It returns everytime 0
Reply
#30

Quote:
Originally Posted by papagei9
Hm.. GetPlayerSpeed doesn't work for me. It returns everytime 0
GetPlayerVelocity returns 0 when you are in a vehicle.
Hence use GetVehicleVelocity.
Reply
#31

Quote:
Originally Posted by Seif_
Quote:
Originally Posted by wofka13
(Sry for bad english )
My question is how to do that it will increment as in the video
) 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 .....)
http://www.xfire.com/video/2489a5/
Elaborate please.
What do you mean? i dont udnerstand xD
Reply
#32

Bump.

I used this, and when I turn at some places, my speed increases unrealisticly much.

Like from 60 to 100 in a second.

It seems to be when turning north and when turning south, but I'm not sure.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)