CLEO Help My code is crash

CLEO related
Status
Not open for further replies.

UG-BASE

Active member
Joined
Apr 20, 2015
Messages
40
Reaction score
0
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:
 

WaTTi

Well-known member
Joined
Jan 4, 2015
Messages
260
Reaction score
8
and line 98
nl1EUWY.png

:youdontsay:
 

UG-BASE

Active member
Joined
Apr 20, 2015
Messages
40
Reaction score
0
WaTTi link said:
and line 98
nl1EUWY.png

:youdontsay:

No, this jump @ 111

Crash.
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 @ 111

: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
 

MrChristmas

Expert
Joined
Jul 29, 2014
Messages
563
Reaction score
26
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.
 

Juanbustillos

Active member
Joined
Mar 29, 2014
Messages
29
Reaction score
4
Location
Ecuador
UG-BASE link said:
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
 
Status
Not open for further replies.
Top