Help car backflip - question

pwpwpwn

Member
Joined
May 4, 2024
Messages
9
Reaction score
0
Hello, sorry for "post spam' but im trying to learn. Im developing a car backflip cleo the mod works.. but sometimes the car land upside down. Is there any fix for it?

backflip code:

07D5: set_car 13@ velocity_in_direction_XYZ 0.0 0.0 0.4 rotation_velocitiesXY 0.0 0.0 unk 0.0
07DB: set_car 13@ rotation_velocity_XYZ 8.0 0.0 0.0 through_center_of_mass

Its random, sometimes the car does 2 backflips sometimes 1 sometimes just land upside down.
Is this how gta works or my script has problems?
thanks.
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,700
Reaction score
106
Nice mod idea. Thing is with GTASA is the FPS controls alot of physics, car physics are pretty bad which will affect this mod. For SAMP 90-100 fps (max fps without fpshack) is awful for car rotations, I believe best rotation speed is 51 fps (/fpslimit 48 for me personally idk about u). The code you posted is pretty consistent with typical cars from my brief testing, however it obviously can't flip a dumper without changing the velocity values. You could obviously make it adapt to different cars with some ingenuity depending on how much you care or you could just force a very unnatural backflip by writing to the vehicles pos/velocity memory.

Below code works good on 51 FPS, tinker with it how you wish.
Code:
{$CLEO .cs}

THREAD 'BACKFLIP'

WHILE TRUE
    WAIT 0
    
    0AB1: @RESTART 1 WITH_KEY 88 // KEY_X // GOOD FOR DEBUGGING SCRIPT MAKE SURE FILENAME IS BACKFLIP.CS
    
    IF AND
        00DF:   actor $PLAYER_ACTOR driving
        KEY_DOWN 75
    THEN
        WAIT 250 // STOPS KEY SPAM CAUSING VELOCITY TO STACK/COMPOUND MULTIPLE TIMES
        0@ = actor.CurrentCar($PLAYER_ACTOR)
        07D5: set_car 0@ velocity_in_direction_XYZ 0.0 0.0 0.3 rotation_velocitiesXY 0.0 0.0 unk 0.0 // HEIGHT OF JUMP
        07DB: set_car 0@ rotation_velocity_XYZ 6.0 0.0 0.0 through_center_of_mass // ROTATION VELOCITY
    END
END

:RESTART
IF
0AB0: 0@
THEN
    REPEAT
        WAIT 0
        PRINT "~R~RESTART: ~w~BACKFLIP.CS" 100
    UNTIL 8AB0: 0@
0A92: RESTART "BACKFLIP.CS" // CHANGE THIS IF YOU DECIDE TO CHANGE FILE NAME
004E: STOP THIS CLEO
END
0AB2: 0
 
Top