CLEO Help Stop loop when message appears on chat

CLEO related
Status
Not open for further replies.

mmia

Member
Joined
Apr 30, 2019
Messages
17
Reaction score
0
So, I made loop but I want it to auto disable when certain message appears on chat.
Here is code, what I do wrong that it doesn't auto stop?
Code:
{$CLEO .cs}

0000:

while not SAMP.Available()
wait 100
end

0AC8: 0@ = allocate_memory_size 250
0AC8: 1@ = allocate_memory_size 250

WHILE TRUE
    WAIT 0
    IF
    0AB0:   key_pressed 113
    THEN
        IF
        5@ == TRUE
        THEN
            5@ = FALSE                         
            0AF8: samp add_message_to_chat "Shows toggle message {DC143C}OFF" color -1
        ELSE
            5@ = TRUE
            0AF8: samp add_message_to_chat "Shows toggle message {32CD32}ON" color -1
        END
        WAIT 350       
    END   
    IF
    5@ == TRUE
    THEN
                wait 0
                    for 30@ = 98 to 99
                        0B75: samp get_chat_string 30@ text_to 0@ prefix_to 1@ color_to 2@ prefix_color_to 3@
                        0C26: strupr in 0@ out 1@
                            if
                                0C18: 2@ = strstr string1 1@ string2 "When this appears on chat"
                            then
                                5@ = FALSE
                                0AF8: samp add_message_to_chat "Shows toggle message {DC143C}OFF" color -1
                                wait 5000
                        Break
                    end
                end
        IF
        32@ > 9000
        THEN
            32@ = 0
            0AF9: samp say_msg "/thiscommand"     
        END
    END
END
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
{$CLEO .cs}

0000:

repeat
wait 0
until 0AFA:

WHILE TRUE
    WAIT 0
IF
0AB0:   key_pressed 113
THEN
    IF
    5@ == TRUE
    THEN
        5@ = FALSE                         
        0AF8: samp add_message_to_chat "Shows toggle message {DC143C}OFF" color -1
    ELSE
        5@ = TRUE
        0AF8: samp add_message_to_chat "Shows toggle message {32CD32}ON" color -1
    END
    WAIT 350 // ANTI SPAM       
END  
 
IF
5@ == TRUE
THEN
    FOR 30@ = 98 TO 99
    0AC8: 0@ = allocate_memory_size 260
    0AC8: 1@ = allocate_memory_size 260
    0B75: samp get_chat_string 30@ text_to 0@ prefix_to 1@ color_to 2@ prefix_color_to 3@
    0C26: strupr in 0@ out 1@ // make all text upper...
        IF
        0C29: $NOT_USED = strstr string1 0@ string2 "When this appears on chat"
        THEN
            5@ = FALSE
            0AF8: samp add_message_to_chat "Shows toggle message {DC143C}OFF" color -1
        END
    END
END

IF
32@ > 9000 // 9 sec
THEN
    32@ = 0 // reset timer
    0AF9: samp say_msg "/thiscommand"     
END

END
 

mmia

Member
Joined
Apr 30, 2019
Messages
17
Reaction score
0
In your script when I press button (113) to disable or "When this appears on chat" it doesn't switch off at all. It does show "Shows toggle message {DC143C}OFF" in chat but it doesn't stop spamming "/thiscommand"
 
Status
Not open for further replies.
Top