Vehicle distance. - 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: Vehicle distance. (
/showthread.php?tid=276648)
Vehicle distance. -
budelis - 14.08.2011
Hi all.Maybe somebody know how to get all vehicle distance,and save it?
Re: Vehicle distance. -
Darnell - 14.08.2011
What do you mean, vehicle distance ?
Re: Vehicle distance. -
TouR - 14.08.2011
You maybe mean coordinates?
Re: Vehicle distance. -
budelis - 14.08.2011
No. i don't know how it say correct in your language,it's like run with vehicle distance.
Re: Vehicle distance. -
Improvement™ - 14.08.2011
Are you talking about the '
Stunt Bonus' as in the San Andreas Single Player?
Re: Vehicle distance. -
budelis - 14.08.2011
No no.But i do it myself it look like that:
Код:
new Float:ST[4];
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 180.3;
vehicleDB[vehicleid][prav] += ST[3];
And i use:
Код:
vehicleDB[vehicleid][prav]/10000 to get correct.
Re: Vehicle distance. -
TouR - 14.08.2011
You mean the speed?
Re: Vehicle distance. -
Babul - 14.08.2011
i think its about a "taxo-meter". the distance travelled so far...
the squareroot is a good beginning. but instead of using the vehiclevelocity:
store actual vehicle position in an array (x_old,y_old,z_old).
wait some time (timer?), let the player drive some distance.
get his vehicles position again (store it into another array, this time x_new,y_new,z_new), and subtract each values like
new x_travelled= x_old-x_new;
new y_travelled= y_old-z_new;
new z_travelled= y_old-z_new;
you will get some "delta"values, the travelled distances in each axis:
x_travelled=123.4560
y_travelled=-80.0000
z_travelled=1.0131
dont worry about negative values. powering them will make them positive...
after adding the newly calculated "short time" distance to the ever-lasting counter:
x_travelled_atall+=travelledX;
, dont forget to copy the x_new into the x_old coordinate, so the next call will use the x_new as x_old, since the x_new will get calced again..
Re: Vehicle distance. -
budelis - 15.08.2011
I don't understand here nothing.Maybe you have time and can my make a meter?
Re: Vehicle distance. -
doreto - 15.08.2011
budelis use
****** Translete if you cant say