CLEO Help vehicle recording crash game

CLEO related
Status
Not open for further replies.

thorus

Member
Joined
Apr 4, 2020
Messages
16
Reaction score
0
Location
dsfd
hello, I wanted to change the activation buttons from "o" and "p" to "o + 0" and "p + 0". But when compiled, the mod crashes when used in-game, even if we don't change anything in the code and compile it, it still crashes. What to do?
@Opcode.eXe

Code:
{$CLEO .cs}
0000:


REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

0B6D: 31@ CREATE_FONT "Arial Black" HEIGHT 10 FLAGS 0x5
0BFC: set_global_var "font" = 31@

0B34: "VehicleRecording" @VehicleRecording
0B34: "VehicleRecordingLoop" @VehicleRecordingLoop

0AF8: "{FF0000}/VehicleRecording:{FFFFFF} to get help!" -1





WHILE TRUE
    WAIT 0
    IF
    00DF:   actor $PLAYER_ACTOR driving
    THEN
        IF AND
        8B21: NOT_CHAT_OPEN
        0AB0: 79 {O}
        THEN
            REPEAT
                WAIT 0
            UNTIL  8AB0: 79 {O}
            32@ = 0
            IF
            0AAB:   file_exists "CLEO\VehicleRecording.path"
            THEN
                0B00: delete_file "CLEO\VehicleRecording.path"
            END           
            0AF8: "{FF0000}Vehicle Recording:{FFFFFF} recording a new path!!" -1 
            03C0: 0@ = actor $PLAYER_ACTOR car
            0407: 1@ 2@ 3@ CAR 0@ w_OFFSET 0.0 0.0 0.0 
            018A: 29@ = create_checkpoint_at 1@ 2@ 3@
 

            0A9A: 31@ = openfile "CLEO\VehicleRecording.path" mode "wb+"
            
            
            REPEAT
                WAIT 0
                IF
                80DF:   actor $PLAYER_ACTOR driving
                THEN
                    0AF8: "{FF0000}Vehicle Recording:{FFFFFF} just saved ur ass from a crash. Recording failed." -1
                    BREAK
                END
                0AB1: @DRAW_TEXT_RECORDING 0
                IF
                32@ > 200
                THEN
                    32@ = 0
                    03C0: 0@ = actor $PLAYER_ACTOR car
                    0407: 1@ 2@ 3@ CAR 0@ w_OFFSET 0.0 0.0 0.0 
                    02E3: 4@ = car 0@ speed
                    0A9E: writefile 31@ size 16 from 1@
                    018C: play_sound 1052 at 0.0 0.0 0.0
                END   
            UNTIL 0AB0: 79

            0164: disable_marker 29@

            0A9B: closefile 31@
            0AF8: "{FF0000}Vehicle Recording:{FFFFFF} recording has been stopped." -1
            REPEAT
                WAIT 0
            UNTIL  8AB0: 79 {O}               
        END   
    
        IF
        8B21: NOT_CHAT_OPEN
        THEN
            IF OR
            30@ == TRUE
            0AB0: 80 {P}
            THEN
                REPEAT
                    WAIT 0
                UNTIL  8AB0: 80 {p}
                IF
                0AAB:   file_exists "CLEO\VehicleRecording.path"
                THEN
                    0AF8: "{FF0000}Vehicle Recording:{FFFFFF} playing the path now!" -1
                    
                    0A9A: 31@ = openfile "CLEO\VehicleRecording.path" mode "rb"
                    
                    REPEAT
                    WAIT 0
                        IF
                        80DF:   actor $PLAYER_ACTOR driving
                        THEN
                            0AF8: "{FF0000}Vehicle Recording:{FFFFFF} just saved ur ass from a crash." -1
                            BREAK
                        END     
                        IF AND
                        8B21: NOT_CHAT_OPEN
                        0AB0: 80 {p}
                        THEN
                            BREAK
                        END                     
    
                        03C0: 0@ = actor $PLAYER_ACTOR car
    
                        0A9D: readfile 31@ size 4 to 1@
                        0A9D: readfile 31@ size 4 to 2@
                        0A9D: readfile 31@ size 4 to 3@
                        0A9D: readfile 31@ size 4 to 4@
                        0A9D: readfile 31@ size 4 to 1@
                        0A9D: readfile 31@ size 4 to 2@
                        0A9D: readfile 31@ size 4 to 3@
                        0A9D: readfile 31@ size 4 to 4@
                                                
                        REPEAT
                        WAIT 0
                            IF
                            80DF:   actor $PLAYER_ACTOR driving
                            THEN
                                0AF8: "{FF0000}Vehicle Recording:{FFFFFF} just saved ur ass from a crash." -1
                                30@ = FALSE
                                0AF8: "{FF0000}Vehicle Recording:{FFFFFF} disabled looping." -1
                                BREAK
                            END     
                            IF
                            0AB0: 80 {p}
                            THEN
                                30@ = FALSE
                                0AF8: "{FF0000}Vehicle Recording:{FFFFFF} disabled looping." -1
                                BREAK
                            END           
                            0AB1: @DRAW_TEXT_PLAYING 0         
                            0407: 6@ 7@ 8@ CAR 0@ w_OFFSET 0.0 0.0 0.0 
                            0AB1: call_scm_func @turning_mechanism 4 1@ 2@ 6@ 7@ 
                            02E3: 5@ = car 0@ speed
                            IF
                            0025:   5@ > 4@  // (float)
                            THEN
                                0AB1: @BRAKE 0
                                ELSE
                                0AB1: @GAS 0
                            END
                            0B55: convert_3D_coords 1@ 2@ 3@ to_screen 9@ 10@
                            0B55: convert_3D_coords 6@ 7@ 8@ to_screen 11@ 12@
                            if
                            00C2:   sphere_onscreen 1@ 2@ 3@ radius 5.0
                            then
                                0B68: render draw_line_point1 11@ 12@ point2 9@ 10@ width 2 color 0xFFFF0000
                                0B70: render draw_polygon_pos 9@ 10@ size 10 10 corners 14 rotation 0 color 0xFF000000
                                0B70: render draw_polygon_pos 11@ 12@ size 10 10 corners 14 rotation 0 color 0xFF000000
                            end
                        UNTIL 0100:   actor $PLAYER_ACTOR in_sphere 1@ 2@ 3@ radius 5.0 5.0 5.0 sphere 0 in_car
                        
                    UNTIL 0AD6:   end_of_file 31@ reached               
        
                    0AF8: "{FF0000}Vehicle Recording:{FFFFFF} playing has been stopped!" -1               
                    0A9B: closefile 31@
                    REPEAT
                        WAIT 0
                    UNTIL  8AB0: 80 {p}           
                    
                END
            END   
        END
    
    
        

        
    END
END






//0AB1: call_scm_func @turning_mechanism 4 XY XY
:turning_mechanism
0AB1: @getZAngleBetweenPoints 4 from_XY 0@ 1@ and_XY 2@ 3@ store_to 31@       
0172: 30@ = actor $PLAYER_ACTOR Z_angle
30@ -= 360.0
0097: make 30@ absolute_float
005B: 31@ += 30@
02F6: 30@ = sine 31@
02F7: 31@ = cosine 31@
0604: get_Z_angle_for_point 30@ 31@ store_to 31@
    if and
    0021:   31@ > 180.0
    0023:   355.0 > 31@
    then //press left
    0B56: set_game_key 0 state -255
    //0B56: set_game_key 16 state 255
        if
        0023:   200.0 > 31@
        then
        0B56: set_game_key 6 state 255
        else
        0B56: set_game_key 6 state 0
        end                           
    else
        if and
        0021:   31@ > 5.0
        0033:   180.0 >= 31@ //lower or equal 
        then //press right 
        0B56: set_game_key 0 state 255
        //0B56: set_game_key 16 state 255
            if
            0021:   31@ > 160.0
            then
            0B56: set_game_key 6 state 255
            else
            0B56: set_game_key 6 state 0
            end
        else
        0B56: set_game_key 0 state 0
        0B56: set_game_key 6 state 0
        //0B56: set_game_key 16 state 255
        end
    end
0AB2: ret 0

:getZAngleBetweenPoints
0063: 0@ -= 2@
0063: 1@ -= 3@
0604: get_Z_angle_for_point 0@ 1@ store_to 4@
0AB2: 1 4@

:DRAW_TEXT_PLAYING
if
00DF:   actor $PLAYER_ACTOR driving
then
    03C0: 0@ = actor $PLAYER_ACTOR car
    0407: 1@ 2@ 3@ CAR 0@ w_OFFSET 0.0 0.0 0.0   
    0BFD: 31@ = get_global_var "font"
    0B55: convert_3D_coords 1@ 2@ 3@ to_screen 4@ 5@
    0B6B: 6@ = FONT 31@ TEXT "PLAYING" LENGTH
    6@ /= 2
    0062: 4@ -= 6@
    0B6F: FONT 31@ DRAW_TEXT "PLAYING" POS 4@ 5@ COLOR 0xFFFF0000
end
0AB2: 0

:DRAW_TEXT_RECORDING
if
00DF:   actor $PLAYER_ACTOR driving
then
    03C0: 0@ = actor $PLAYER_ACTOR car
    0407: 1@ 2@ 3@ CAR 0@ w_OFFSET 0.0 0.0 0.0   
    0BFD: 31@ = get_global_var "font"
    0B55: convert_3D_coords 1@ 2@ 3@ to_screen 4@ 5@
    0B6B: 6@ = FONT 31@ TEXT "RECORDING" LENGTH
    6@ /= 2
    0062: 4@ -= 6@
    0B6F: FONT 31@ DRAW_TEXT "RECORDING" POS 4@ 5@ COLOR 0xFFFF0000
end
0AB2: 0

:BRAKE
0@ = 0xB73458
0@ += 0xC
0A8C: write_memory 0@ size 1 value 255 virtual_protect 0
0AB2: 0

:GAS
0@ = 0xB73458
0@ += 0x20
0A8C: write_memory 0@ size 1 value 255 virtual_protect 0
0AB2: 0

:VehicleRecordingLoop
IF
30@ == TRUE
THEN
    30@ = FALSE
    0AF8: "{FF0000}Vehicle Recording:{FFFFFF} disabled looping." -1
ELSE
    30@ = TRUE
     0AF8: "{FF0000}Vehicle Recording:{FFFFFF} enabled looping." -1
END
0B43:











:VehicleRecording
0AF8: "{FF0000}Vehicle Recording:{FFFFFF} made by Opcode.eXe ;)" -1
0AF8: "{FF0000}Vehicle Recording:{FFFFFF} use O to start/stop recording." -1
0AF8: "{FF0000}Vehicle Recording:{FFFFFF} press P to play/stop the recorded path." -1
0AF8: "{FF0000}Vehicle Recording:{FFFFFF} write /VehicleRecordingLoop play it without stopping." -1

0B43:
 

Attachments

  • VehicleRecording.cs
    29.5 KB · Views: 5
Status
Not open for further replies.
Top