CLEO Auto response with command

CLEO related

mmadaaa

Member
Joined
Oct 31, 2021
Messages
24
Reaction score
0
Location
Alba
Hi, i tried to make a CMD when someone say in chat a thing to auto response after 5 seconds with a command, but when i try to compile gives me the error Not enough actual parameters. Expected 2 params.

Code:
{$CLEO .cs}

0000: NOP

REPEAT
wait 0
UNTIL 0AFA:

0AF8: samp add_message_to_chat "{FFFFFF}Auto"
0B34: "activatecmd" @CMD

0AC8: 2@ = allocate_memory_size 258
0AC8: 3@ = allocate_memory_size 258

WHILE TRUE
wait 0

FOR 1@ = 98 TO 99
0B75: samp get_chat_string 1@ text_to 2@ prefix_to 3@ color_to 4@ prefix_color_to 5@

IF
0@ == TRUE
THEN
    IF
    0C29: $NOT_USED = stristr string1 2@ string2 "x"
    THEN
        wait 5000
        0AF9: samp say_msg "/command"
        0AB0:   key_pressed 13
    END
END

END

END

:CMD
0B12: 0@ = 0@ XOR TRUE

IF
0@ == FALSE
THEN
    print "~y~Auto: ~r~off" 2000
ELSE
    print "~y~Auto: ~g~on" 2000
END

0B43:
 

mmadaaa

Member
Joined
Oct 31, 2021
Messages
24
Reaction score
0
Location
Alba
Code:
{$CLEO .cs}

0000:

REPEAT
   WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

WHILE TRUE
   WAIT 0


IF
0B61:  samp is_local_player_spawned
THEN
    FOR 0@ = 99 TO 99
        0AC8: 1@ = allocate_memory_size 260
        0AC8: 2@ = allocate_memory_size 260
        0B75: samp get_chat_string 0@ text_to 1@ prefix_to 2@ color_to 3@ prefix_color_to 4@
        IF
        0C29: $NOT_USED = stristr string1 1@ string2 "is in need of a instructor, location"
        THEN
                wait 5000
                say "/calls" 4@v
                wait 10
                0AB0:   key_pressed 13
                wait 50
        END
    END
END

END


I made this script which works very well, but now I need to make a command to stop and start it when I need
 

mmadaaa

Member
Joined
Oct 31, 2021
Messages
24
Reaction score
0
Location
Alba
Now i have this and works but after 6 second crash

Code:
{$CLEO .cs}
{$USE bitwise}
0000:

0B34: samp register_client_command "autorepair" to_label @cmd_mycmd

WHILE TRUE
WAIT 0

IF 30@ == 1
THEN
    FOR 0@ = 99 TO 99
        0AC8: 1@ = allocate_memory_size 260
        0AC8: 2@ = allocate_memory_size 260
        0B75: samp get_chat_string 0@ text_to 1@ prefix_to 2@ color_to 3@ prefix_color_to 4@
        IF
        0C29: $NOT_USED = stristr string1 1@ string2 "is in need of a instructor, location"
        THEN
                wait 5000
                say "/calls" 4@v
                wait 10
                0AB0:   key_pressed 13
                wait 50
        END
    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
 

mmadaaa

Member
Joined
Oct 31, 2021
Messages
24
Reaction score
0
Location
Alba
Works better now and the last thing i need is to press enter when dialog from /calls open
Code:
{$CLEO .cs}
{$USE bitwise}
0000:

0B34: samp register_client_command "skemaresita" to_label @cmd_mycmd

WHILE TRUE
WAIT 0

IF 30@ == 1
THEN
    FOR 0@ = 99 TO 99
        0AC8: 1@ = allocate_memory_size 260
        0AC8: 2@ = allocate_memory_size 260
        0B75: samp get_chat_string 0@ text_to 1@ prefix_to 2@ color_to 3@ prefix_color_to 4@
        IF
        0C29: $NOT_USED = stristr string1 1@ string2 "is in need of a instructor, location"
        THEN
                wait 4000
                say "/calls"
                0AB1: @Set_Virtual_Key 2 KeyOffSet 0x0D state 255
                wait 10 
        END
    END
END
end


:Set_Virtual_Key
{
    255 = true
    0 = false
    0AB1: @Set_Virtual_Key 2 KeyOffSet 0x0D state 255
}
2@ = 0xB72CC8
0@ *= 2
005A: 2@ += 0@  // (int)
0A8C: write_memory 2@ size 1 value 1@ virtual_protect 0
0AB2: ret 0

:cmd_mycmd
0B12: 30@ = 30@ XOR 1
IF 30@ == 1
THEN 0AF8: samp add_message_to_chat "{00FF00}[== Mod bengos a pornit ==]" color -1
ELSE 0AF8: samp add_message_to_chat "{FF0000}[== Mod bengos a fost oprit ==]" color -1
END
cmdret
 
Top