Re: GetPlayerSpeed, No timers-Player Speed instantly -
beckzy - 04.09.2009
Why use floatpower? Just multiply it by itself.
Re: GetPlayerSpeed, No timers-Player Speed instantly -
Gamer_Z - 04.09.2009
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..
Re: GetPlayerSpeed, No timers-Player Speed instantly -
misco - 04.09.2009
i have edited it last time. if you have better solution about this speed calculation be free and share it
Re: GetPlayerSpeed, No timers-Player Speed instantly - Zeex - 04.09.2009
Omg... Square of sum is not the same as sum of squares.
Re: GetPlayerSpeed, No timers-Player Speed instantly -
NeedAName - 05.09.2009
Just a note: GetPlayerVelocity returns as 0 when in a vehicle so you need to use GetVehicleVelocity to calculate a vehicles velocity
Re: GetPlayerSpeed, No timers-Player Speed instantly -
Norn - 05.09.2009
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.
Re: GetPlayerSpeed, No timers-Player Speed instantly -
misco - 05.09.2009
Was an previous speedo better(or accurate) ?
Re: GetPlayerSpeed, No timers-Player Speed instantly -
lavamike - 05.09.2009
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.
Re: GetPlayerSpeed, No timers-Player Speed instantly -
papagei9 - 06.09.2009
Hm.. GetPlayerSpeed doesn't work for me. It returns everytime 0
Re: GetPlayerSpeed, No timers-Player Speed instantly -
Frankylez - 06.09.2009
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.
Re: GetPlayerSpeed, No timers-Player Speed instantly -
wofka13 - 02.06.2010
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
Re: GetPlayerSpeed, No timers-Player Speed instantly -
IcyBlight - 04.06.2010
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.