CLEO Help Add ON/OFF by a command

CLEO related

KeyCap

Member
Joined
Nov 2, 2021
Messages
16
Reaction score
0
Location
Germany
Hi all, I wrote a command that enables and disables this script, but when I start the game and enter that command in the text chat, the game totally crashes. what is causing that and how can I fix it? I will upload the original script.

{$CLEO .cs}

0000: NOP

:NONAME_2
wait 0
SAMP.Available
jf @NONAME_2
wait 8000
//chatmsg "Developed by Xth!ns | vk.com/xthnisofficialpage" color 52479

0@ = 1


0B34: "autorepair" @my_cmd

:NONAME_77
wait 0
Actor.Driving($PLAYER_ACTOR)
jf @NONAME_77
20@ = Actor.CurrentCar($PLAYER_ACTOR)
0A97: 0@ = car 20@ struct
0A8E: 1@ = 0@ + 1216 // int
0A8D: 2@ = read_memory 1@ size 4 virtual_protect 1
if or
018F: car 20@ flipped_for_2_seconds
not 2@ >= 450.0
jf @NONAME_234
0A8C: write_memory 1@ size 4 value 1000.0 virtual_protect 1
0731: set_car 20@ y_angle_to 0
0699: set_car 20@ repair_tire 1
0699: set_car 20@ repair_tire 2
0699: set_car 20@ repair_tire 3
0699: set_car 20@ repair_tire 4
//chatmsg "Your car repaired" color 10027263

:NONAME_234
jump @NONAME_77

:my_cmd
if 0@ == 1
then
chatmsg "Disabled"
0@ = 0
else
0@ = 1
chatmsg "Enabled"
end
cmdret
 

Attachments

  • AutoRepair.cs
    18 KB · Views: 3
Solution
PHP:
{$CLEO .cs}
{$USE bitwise}
0000:

0B34: samp register_client_command "autorepair" to_label @cmd_mycmd

WHILE TRUE
WAIT 0

IF 30@ == 1
THEN
    IF 0AB0:   key_pressed 88 // X
    THEN
        IF Actor.Driving($PLAYER_ACTOR)
        THEN
            20@ = Actor.CurrentCar($PLAYER_ACTOR)
            0A97: 0@ = car 20@ struct
            0A8E: 1@ = 0@ + 1216 // int
            0A8D: 2@ = read_memory 1@ size 4 virtual_protect 1
            IF OR
            018F:   car 20@ flipped_for_2_seconds
            NOT 2@ >= 450.0
            THEN
                0A8C: write_memory 1@ size 4 value 1000.0 virtual_protect 1
                0731: set_car 20@ y_angle_to 0
                0699: set_car 20@ repair_tire 1
                0699: set_car...

dphome

Well-known member
Joined
Mar 21, 2020
Messages
456
Solutions
9
Reaction score
166
Location
Poland
PHP:
{$CLEO .cs}
{$USE bitwise}
0000:

0B34: samp register_client_command "autorepair" to_label @cmd_mycmd

WHILE TRUE
WAIT 0

IF 30@ == 1
THEN
    IF 0AB0:   key_pressed 88 // X
    THEN
        IF Actor.Driving($PLAYER_ACTOR)
        THEN
            20@ = Actor.CurrentCar($PLAYER_ACTOR)
            0A97: 0@ = car 20@ struct
            0A8E: 1@ = 0@ + 1216 // int
            0A8D: 2@ = read_memory 1@ size 4 virtual_protect 1
            IF OR
            018F:   car 20@ flipped_for_2_seconds
            NOT 2@ >= 450.0
            THEN
                0A8C: write_memory 1@ size 4 value 1000.0 virtual_protect 1
                0731: set_car 20@ y_angle_to 0
                0699: set_car 20@ repair_tire 1
                0699: set_car 20@ repair_tire 2
                0699: set_car 20@ repair_tire 3
                0699: set_car 20@ repair_tire 4    
            END
        END
        WAIT 1337
    END
END

END

:cmd_mycmd
0B12: 30@ = 30@ XOR 1
IF 30@ == 1
THEN 0AF8: samp add_message_to_chat "{00FF00}[== Enable ==]" color -1
ELSE 0AF8: samp add_message_to_chat "{FF0000}[== Disable ==]" color -1
END
cmdret
 

Attachments

  • Script.cs
    18.6 KB · Views: 5
Solution

blvck0v

Active member
Joined
Feb 23, 2019
Messages
97
Reaction score
51
Location
ugbase.eu
PHP:
{$CLEO .cs}
{$USE bitwise}
0000:

0B34: samp register_client_command "autorepair" to_label @cmd_mycmd

WHILE TRUE
WAIT 0

IF 30@ == 1
THEN
    IF 0AB0:   key_pressed 88 // X
    THEN
        IF Actor.Driving($PLAYER_ACTOR)
        THEN
            20@ = Actor.CurrentCar($PLAYER_ACTOR)
            0A97: 0@ = car 20@ struct
            0A8E: 1@ = 0@ + 1216 // int
            0A8D: 2@ = read_memory 1@ size 4 virtual_protect 1
            IF OR
            018F:   car 20@ flipped_for_2_seconds
            NOT 2@ >= 450.0
            THEN
                0A8C: write_memory 1@ size 4 value 1000.0 virtual_protect 1
                0731: set_car 20@ y_angle_to 0
                0699: set_car 20@ repair_tire 1
                0699: set_car 20@ repair_tire 2
                0699: set_car 20@ repair_tire 3
                0699: set_car 20@ repair_tire 4   
            END
        END
        WAIT 1337
    END
END

END

:cmd_mycmd
0B12: 30@ = 30@ XOR 1
IF 30@ == 1
THEN 0AF8: samp add_message_to_chat "{00FF00}[== Enable ==]" color -1
ELSE 0AF8: samp add_message_to_chat "{FF0000}[== Disable ==]" color -1
END
cmdret
if you ever get annoyed by $USE, try this https://ugbase.eu/threads/properly-setup-your-cleo-coding-tools-to-avoid-problems.15815/post-107225
 
Top