SA-MP Forums Archive
directional speedboost - 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)
+--- Thread: directional speedboost (/showthread.php?tid=583318)



directional speedboost - suni - 27.07.2015

hey how to script an directional speedboost? not the normal speedboost that increase your speed when you are in a moving vehicle, the speedboost that push your vehicle to where it is facing. hope you understand me.


Re: directional speedboost - xVIP3Rx - 27.07.2015

Depend on GetVehicleZAngle and SetVehicleVelocety


Re: directional speedboost - Vince - 27.07.2015

You mean from standstill to full speed? Something like this should get you started;
PHP код:
new
    
vehicleid GetPlayerVehicleID(playerid);
new
    
Float:x,
    
Float:y,
    
Float:angle;
GetVehicleZAngle(vehicleidangle);
floatsin(-angledegrees) * 1.5;
floatcos(-angledegrees) * 1.5;
SetVehicleVelocity(vehicleidxy0.0); 
Unsure if it works. You may also need to fiddle with the multiplier (* 1.5) to get something you like. It might give some odd result if you do it while the vehicle is at an angle, for example on the hills in SF, because it doesn't take into account the upward or downward movement. Implementing that would mean messing with GetVehicleRotationQuat and I'm not knowledgeable about that.

PS: Accidentally posted before completing my message.


Re: directional speedboost - suni - 27.07.2015

------


Re: directional speedboost - suni - 29.07.2015

hey how can I make it work while pressing other keys?