SA-MP Forums Archive
GetPlayerVelocity GetVehicleVelocity - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GetPlayerVelocity GetVehicleVelocity (/showthread.php?tid=105465)



GetPlayerVelocity GetVehicleVelocity - CBFASI - 29.10.2009

Ok I have tried to search and not come up with anything that actually says what a SAMP unit is..

Using these commands may solve a small problem on the server I script for but the old system we used measured distance in metres and thus we coudl easiliy convert to km/h but just want are SAMP units

ALl I need to know is what it takes to convert from SAMP unit to say metres, or even better to km/h

I know how to get 3 dimensional speed (thus not a single geometric direction) but its a matter of knowing what units these new commands work too.

Full speed in Infernus without nitros seems to get about 1.22

Any help will be greatly received.

(Tried various ways to search not successful, lots of topics on the getvehiclevelocity but not one mentions units)



Re: GetPlayerVelocity GetVehicleVelocity - CBFASI - 29.10.2009

Ok still testing....

floatround((floatsqroot((Xvalue * Xvalue) + (Yvalue * Yvalue)+ (Zvalue * Zvalue))*180),floatround_floor);

this gives an Infernus non nitro speed of 221, seems close but...

If this is the case then...

1 Velocity value is about
km/20secs or
50m/sec

so a 50m /sec value ??

is this even close



Re: GetPlayerVelocity GetVehicleVelocity - yom - 29.10.2009

GTA units ARE meters.


Re: GetPlayerVelocity GetVehicleVelocity - CBFASI - 29.10.2009

GTA is metres but the SAMP ones are definately not.

The fact that GTA measurements are metres meant it was rather easy to set up a speed system that worked in km/h.

This new function however is not so straightforward

Veolocity cannot be 1m/s in SAMP, else...well you do the sums

1.22 x 60 = m/min (73.2m/min)
1.22 x 3600 = m/hr (4395m/hr)
1.22 x 3.6 = km/h (4.82km/hr)

Now with that km/h using the previous mentioned system, if its 50m not 1m then it gives us the more believable figure of about 241

Its looking very much like its 50m/s units for SAMP



Re: GetPlayerVelocity GetVehicleVelocity - yom - 29.10.2009

Edit: sorry i think i totally misunderstood -_- (i just woke up )


Re: GetPlayerVelocity GetVehicleVelocity - CracK - 29.10.2009

If you want speed in km/h use this:
pawn Код:
Float:GetVehicleSpeed(vehicleid)
{
  new
    Float:vX,
    Float:vY,
    Float:vZ;
  GetVehicleVelocity(vehicleid, vX, vY, vZ);
  return floatsqroot(vX*vX + vY*vY + vZ*vZ);
}
And do GetVehicleSpeed(vehicleid) * 200 to get speed in km/h.
Equal with camhack's km/h speed.


Re: GetPlayerVelocity GetVehicleVelocity - yom - 29.10.2009

Correcting myself again, the most accurate multiplier, based on the distance travelled during a certain time, is around 195-200.