CLEO Help fix crash cleo code to 0.3.7

CLEO related
Status
Not open for further replies.

UG-BASE

Active member
Joined
Apr 20, 2015
Messages
40
Reaction score
0
Code:
$CLEO}

0000:
thread "veh" 

:1473
 wait 400 ms 
Samp.Available()
jf @1473
 if 
8AAB:   not file_exists "CLEO\vehicle.ini" 
jf @1626
0AD3: 19@v = format "vehicle"  
0AF5: write_string 19@v to_ini_file "cleo\vehicle.ini" section "Configuration" key "Cmd" 
0AF3: write_float -11.0 to_ini_file "cleo\vehicle.ini" section "Configuration" key "Z" 
jump @1626

:1626 
0AF4: 15@v = read_string_from_ini_file "cleo\vehicle.ini" section "Configuration" key "Cmd" 
0B34: samp register_client_command 15@v to_label @1731

:1702
 wait 0 ms 
 if 
0039:   29@ == 1     // 0039
jf @1702
 jump @1740

:1731
 29@ = 1 // 0006
Samp.CmdRet()

:1740
 wait 0 ms 
0B35: samp 2@ = get_last_command_params 
0AD4: 2@ = scan_string 2@ format "%d" 0@  
 if and
  0@ >= 400    // 0029
  not  0@ > 611    //8019:
jf @2619 
 if 
056E:   car 5@ defined 
jf @1841
00A0: store_actor $PLAYER_ACTOR position_to 10@ 11@ 12@ 
0362: remove_actor $PLAYER_ACTOR from_car_and_place_at 10@ 11@ 12@ 
00A6: destroy_car 5@ 

:1841
wait 0 ms 
 if 
0248:   model 0@ available 
jf @1868
jump @1880 

:1868
0247: load_model 0@ 
jump @1841

:1880
0172: 28@ = actor $PLAYER_ACTOR Z_angle 
00A0: store_actor $PLAYER_ACTOR position_to 10@ 11@ 12@ 
00A5: 5@ = create_car 0@ at 10@ 11@ 12@ 
0249: release_model 0@ 
036A: put_actor $PLAYER_ACTOR in_car 5@ 
0175: set_car 5@ Z_angle_to 28@ 
02AC: set_car 5@ immunities BP 1 FP 1 EP 1 CP 1 MP 1 
01EC: make_car 5@ very_heavy 1 
0AF0: 16@ = get_int_from_ini_file "cleo\vehicle.ini" section "Configuration" key "FHmod" 
if 
   16@ == 0      // 0039
0AA0: gosub_if_false @2109
0AD0: show_formatted_text_lowpriority "Car id: ~b~%d ~w~FH mode: ~b~%d ~n~~n~~l~" time 4000 0@ 16@  
 29@ = 0          // 0006
jump @1626

:2109
0AB1: call_scm_func @2479 1 -2126  
return 
0000: NOP 
 if 
0AF2: 10@ = get_float_from_ini_file "cleo\vehicle.ini" section "Configuration" key "Z" 
0AA0: gosub_if_false @2187 
jump @2273

:2187
0AF3: write_float -11.0 to_ini_file "cleo\vehicle.ini" section "Configuration" key "Z" 
0AF2: 10@ = get_float_from_ini_file "cleo\vehicle.ini" section "Configuration" key "Z" 
 return 

:2273
 wait 750 ms 
 if 
00DF:   actor $PLAYER_ACTOR driving 
jf @2342
00A0: store_actor $PLAYER_ACTOR position_to 2@ 3@ 4@ 
0063: 4@ -= 10@ // (float) 
0AB1: call_scm_func @2348 3 2@ 3@ 4@  
jump @2273

:2342
 wait 0 ms 
 end_thread // 004E:

:2348
0B2B: samp 3@ = get_player_id_by_actor_handle $PLAYER_ACTOR 
0B24: samp 3@ = get_player_struct_ptr 3@ 
000A: 3@ += 55    
0AC8: 4@ = allocate_memory_size 68 
0C10: memcpy destination 4@ source 3@ size 68 
0C0D: struct 4@ offset 6 size 4 = 0@ 
0C0D: struct 4@ offset 10 size 4 = 1@ 
0C0D: struct 4@ offset 14 size 4 = 2@ 
0B3D: raknet 5@ = new_bit_stream 
0B40: raknet bit_stream 5@ write 212 type 0 size 1 
0B40: raknet bit_stream 5@ write 4@ type 5 size 68 
0B42: raknet send bit_stream 5@ priority 1 reliability 7 ordering_channel 0 
0B3E: raknet delete_bit_stream 5@ 
0AC9: free_allocated_memory 4@ 
0AB2: ret 0 

:2479
0A9F: 32@ = current_thread_pointer 
000A: 32@ += 16 
0A8D: 32@ = read_memory 32@ size 4 virtual_protect 0 
0062: 32@ -= 0@ // (int) 
0AA7: call_function 4607008 num_params 1 pop 1 32@ 33@  
005A: 32@ += 0@ // (int) 
000A: 33@ += 16 
0A8C: write_memory 33@ size 4 value 32@ virtual_protect 0 
000A: 33@ += 44 
0006: 32@ = 0     

:2570
0A8C: write_memory 33@ size 4 value 1@(32@,30i) virtual_protect 0 
000A: 33@ += 4 
000A: 32@ += 1 
0019:   32@ > 30 
jf @2570 
0AB2: ret 0 

:2619
wait 0
0AF4: 15@v = read_string_from_ini_file "cleo\vehicle.ini" section "Configuration" key "Cmd" 
0AF8: samp add_message_to_chat " Enter /%s [id car]" color 16777215 15@v  
0AF8: samp add_message_to_chat " 400->611" color 16777215  
 29@ = 0 
jump @1702

When activate crash
[member=14423]Ju4n_Kr4t0s[/member]
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,700
Reaction score
106
Springfield link said:
How about you try making something yourself? Or learn what the fuck you're doing for that matter, instead of badly editing scripts and then wonder why the fuck they don't work? 

Sorry just had to quote what springfield said, as you made a topic about this multiple times.

https://ugbase.eu/help-7/my-code-is-crash-x2/msg90732/?topicseen#msg90732
 

UG-BASE

Active member
Joined
Apr 20, 2015
Messages
40
Reaction score
0
zin link said:
Sorry just had to quote what springfield said, as you made a topic about this multiple times.

https://ugbase.eu/help-7/my-code-is-crash-x2/msg90732/?topicseen#msg90732
I corrected, i don't say this my code  :eek:hgodwhy:
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
but what is this code supposed to do? The labels are called using numbers which makes it painful to read, probably it would be a good idea to ask the one who made it to share the source
 

MrChristmas

Expert
Joined
Jul 29, 2014
Messages
563
Reaction score
26
Mr.Christmas link said:
Code:
{$CLEO }
0000: NOP
03F0: enable_text_draw 1 
0B6D: render 30@ = create_font "Verdana" height 7 flags 5 
0006: 12@ = 0 

:42
wait 0
if and
0AB0:   key_pressed 16 
0AB0:   key_pressed 67
0AFA:  is_samp_available 
jf @42 
goto @dialog 

:dialog
wait 0
if and
8B4C:   not samp is_dialog_active -1 
8B21:   not samp is_chat_opened 
jf @42

:82
wait 0
8AB0:   not key_pressed 67 
jf @82 
gosub @201 
jump @301

:111
wait 0
 if 
8AB0:   not key_pressed 16 
jf @133 
jump @608 

:133
wait 0 
 if 
8AB0:   not key_pressed 67 
jf @155 
jump @608 

:155
wait 0
if and
8B4C:   not samp is_dialog_active -1 
8B21:   not samp is_chat_opened 
jf @608

:172
wait 0
8AB0:   not key_pressed 67 
jf @172
 gosub @250 
jump @42

:201
wait 0
0AF8: samp add_message_to_chat "on" color -1342190848  
return

:250
wait 0
0AF8: samp add_message_to_chat " off" color -1342190848  
return

:301
wait 0
 if 
0AFF: samp 0@ = car_handle_by_samp_vehicle_id 12@ 
jf @608
00AA: store_car 0@ position_to 2@ 3@ 4@ 
if
80C2:   not sphere_onscreen 2@ 3@ 4@ radius 0.0 
jf @368
jump [member=9575]111[/member]

:368
wait 0
 if 
80DB:   not actor $PLAYER_ACTOR in_car 0@ 
jf @608
0B55: convert_3D_coords 2@ 3@ 4@ to_screen 22@ 23@ 
0227: 15@ = car 0@ health 
0441: 6@ = car 0@ model 
0ADB: 6@v = car_model 6@ name 
09B3: get_car 0@ door_status 16@ 
 if 
  16@ == 0 
jf @473
0AD3: 13@v = format "Open"  
jump @485

:473
wait 0
0AD3: 13@v = format "Lock"  

:485
wait 0
0AC8: 24@ = allocate_memory_size 180 
0C11: memset destination 24@ value 0 size 180 
0AD3: 24@ = format "%s (ID %d)" 6@v 12@  
0B6F: render font 30@ draw_text 24@ pos 22@ 23@ color -1342190848 
000A: 23@ += 9 
0AD3: 24@ = format "%s (HP %d)" 13@v 15@  
0B6F: render font 30@ draw_text 24@ pos 22@ 23@ color -1342190848 
0AC9: free_allocated_memory 24@ 
jump [member=9575]111[/member]

:608
wait 0
 12@ += 1 
 if 
   12@ > 1400 
jf @301
wait 0
 12@ = 0 
 wait 0 ms 
 jump @301

Learn to check your cleo after you wrote it, you were missing a lot of "wait 0" and many of the "jf" and "goto" weren't completed.

[quote author=UG-BASE link=topic=16385.msg90667#msg90667 date=1453118287]
Code:
{$CLEO }
0000:
 
 wait 0 ms 
 gosub @652 
03F0: enable_text_draw 1 
0B6D: render 30@ = create_font "Verdana" height 7 flags 5 
0006: 12@ = 0 

:42
wait 0 ms 
if and
0AB0:   key_pressed 16 
0AB0:   key_pressed 67 
jf @42 
 if and
8B4C:   not samp is_dialog_active -1 
8B21:   not samp is_chat_opened 
jf @42

:82
 wait 0 ms 
8AB0:   not key_pressed 67 
jf @82 
gosub @201 
 jump @301

:111
 if 
8AB0:   not key_pressed 16 
jf @133 
jump @608 

:133
 if 
8AB0:   not key_pressed 67 
jf @155 
jump @608 

:155
if and
8B4C:   not samp is_dialog_active -1 
8B21:   not samp is_chat_opened 
jf @608

:172
 wait 0 ms 
8AB0:   not key_pressed 67 
jf @172
 gosub @250 
jump @42

:201
0AF8: samp add_message_to_chat "on" color -1342190848  
return

:250
0AF8: samp add_message_to_chat " off" color -1342190848  
return

:301
 if 
0AFF: samp 0@ = car_handle_by_samp_vehicle_id 12@ 
jf @608
00AA: store_car 0@ position_to 2@ 3@ 4@ 
if
80C2:   not sphere_onscreen 2@ 3@ 4@ radius 0.0 
jf 368
jump [member=9575]111[/member] 

:368
 if 
80DB:   not actor $PLAYER_ACTOR in_car 0@ 
jf @608
0B55: convert_3D_coords 2@ 3@ 4@ to_screen 22@ 23@ 
0227: 15@ = car 0@ health 
0441: 6@ = car 0@ model 
0ADB: 6@v = car_model 6@ name 
09B3: get_car 0@ door_status 16@ 
 if 
  16@ == 0 
jf @473
0AD3: 13@v = format "Open"  
jump @485

:473
0AD3: 13@v = format "Lock"  

:485
0AC8: 24@ = allocate_memory_size 180 
0C11: memset destination 24@ value 0 size 180 
0AD3: 24@ = format "%s (ID %d)" 6@v 12@  
0B6F: render font 30@ draw_text 24@ pos 22@ 23@ color -1342190848 
000A: 23@ += 9 
0AD3: 24@ = format "%s (HP %d)" 13@v 15@  
0B6F: render font 30@ draw_text 24@ pos 22@ 23@ color -1342190848 
0AC9: free_allocated_memory 24@ 
jump @ 111

:608
 12@ += 1 
 if 
   12@ > 1400 
jf @301
 12@ = 0 
 wait 0 ms 
 jump @301
 
:652
 if 
8AF7:   not samp 0@ = get_base 
jf @42
return

:imoverit:

I didn't understand your coude but anyway here is a code like yours:

Code:
{$CLEO}
0000:

repeat
    wait 40
until SAMP.Available()

0B34: "test" @ON_OFF
0B6D: 0@ = "Arial" 10 12 
1@ = 1

WHILE TRUE
WAIT 0
    IF 1@ == 1
    THEN
        alloc 9@ 32
        alloc 10@ 32
        alloc 11@ 128
        FOR 2@ = 0 TO 1000
            IF 0AFF: samp 3@ = get_car_handle 2@
            THEN IF 02CA: car 3@ visible
                THEN
                    Car.StorePos(3@, 4@, 5@, 6@)
                    Actor.StorePos($PLAYER_ACTOR, 12@, 13@, 14@)
                    IF AND
                    06BD: no_obstacles_between 4@ 5@ 6@ and 12@ 13@ 14@ solid 1 car 0 actor 0 object 1 particle 0
                    NOT Actor.InCar($PLAYER_ACTOR, 3@)
                    THEN
                        0B55: 4@ 5@ 6@ to 4@ 5@
                        0441: 6@ = car 3@ model
                        0227: 7@ = car 3@ health
                        09B3: get_car 3@ door_status 8@
                        IF 8@ == 1
                        THEN format 9@ "Yes"
                        ELSE format 9@ "No"
                        END
                        0ADB: 10@ = car_model 6@ name
                        format 11@ "ID: %d%cModel: %d%cHP: %d%cLocked: %s%c%s" 2@ 10 6@ 10 7@ 10 9@ 10 10@
                        Render.DrawText(0@, 11@, 4@, 5@, -1)
                    END
                END
            END
        END
        free 9@
        free 10@
        free 11@
    END
END

:ON_OFF
0B12: 1@ = 1@ XOR 1
IF 1@ == 1
THEN chatmsg "on" -1
ELSE chatmsg "off" -1
END
cmdret
[/quote]
 
Status
Not open for further replies.
Top