directional speedboost
#1

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.
Reply
#2

Depend on GetVehicleZAngle and SetVehicleVelocety
Reply
#3

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.
Reply
#4

------
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)