SA-MP Forums Archive
Most efficient way.. - 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: Most efficient way.. (/showthread.php?tid=311301)



Most efficient way.. - Luis- - 15.01.2012

Of making a car do a front flip, i've got this code but all it does is does any random flip.
pawn Код:
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(playerid), 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.


Re: Most efficient way.. - Luis- - 16.01.2012

Anyone?


Re: Most efficient way.. - coole210 - 16.01.2012

I don't really understand, do you need the most efficient way or do you need this to work properly?..


Re: Most efficient way.. - CyNiC - 16.01.2012

pawn Код:
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(playerid), 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);
    }



Re: Most efficient way.. - Luis- - 16.01.2012

I'll try it when I get home.