PDA

View Full Version : Most efficient way..


Luis-
16/01/2012, 12:31 AM
Of making a car do a front flip, i've got this code but all it does is does any random flip.

if(newkeys & KEY_ANALOG_UP)
{
if(IsInDerby[playerid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "ERROR: You can't use this in the derby!");
SetVehicleVelocity(GetPlayerVehicleID(playerid), 0.0, 0.0, 0.2);
SetVehicleAngularVelocity(GetPlayerVehicleID(playe rid), 0.2, 0.0, 0.0);
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000000000.0);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~y~WOW, NICE FLIP!!", 6000, 3);
}

Thanks. Can it also be made so that it doesn't slow the player down when flipping, so he's still doing his speed when flipping.

Luis-
16/01/2012, 02:57 AM
Anyone?

coole210
16/01/2012, 03:28 AM
I don't really understand, do you need the most efficient way or do you need this to work properly?..

CyNiC
16/01/2012, 03:39 AM
if(newkeys & KEY_ANALOG_UP)
{
new Float:vel[3], Float:angle;
GetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
GetVehicleVelocity(GetPlayerVehicleID(playerid), vel[0], vel[1], vel[2]);
SetVehicleVelocity(GetPlayerVehicleID(playerid), vel[0], vel[1], vel[2] + 0.3);
SetVehicleAngularVelocity(GetPlayerVehicleID(playe rid), floatsin(-angle - 90.0, degrees)/7.0, floatcos(-angle - 90.0, degrees)/7.0, 0.0);
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000000000.0);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~y~WOW, NICE FLIP!!", 6000, 3);
}

Luis-
16/01/2012, 12:33 PM
I'll try it when I get home.