SA-MP Forums Archive
Cruise control - 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: Cruise control (/showthread.php?tid=130618)



Cruise control - mick88 - 27.02.2010

Hi, this was already tried and failed (http://forum.sa-mp.com/index.php?topic=65043.0) but I have and actual working idea for cruise control for my trucking server, only i need some help.

When I press KEY_ACTION, my VehicleVelocity is saved to 2 variables: X and Y, and as long as KEY_ACTION is pressed, every second my VehicleVelocity is set for the variable.
This works fine, but now I want to enable player to make turns while using cruise control. I need to release KEY_ACTION, change direction and then press KEY_ACTION again, otherwise, vehicle will keep going forward sideways.

Now my idea is to save speed into one variable and set VehicleVelocity depending on its Z-angle. I'm not that good at math, but if someone knows how to get X and Y velocity from angle and speed of car it'd help a lot.