CLEO Help Read multiple chat lines?

CLEO related

Derrekgamer

Active member
Joined
Oct 26, 2020
Messages
93
Reaction score
1
Location
Grecee
Its there any way to detect 2 chat lines from chat log?
and if both of lines was detected, then perform an action like: 0C29: $NOT_USED = stristr string1 1@ string2 "Text lines succesfully detected"

Example:

if
0C29: $NOT_USED = stristr string1 1@ string2 "Your car has been stolen by""
was detected
then
if
0C29: $NOT_USED = stristr string1 1@ string2 "You have 5 seconds to type the command /releaseveh"
was also detected
then
if both of lines are detected in chat
then
0C29: $NOT_USED = stristr string1 1@ string2 "Text lines succesfully detected"

If the first string its detected,: "hey whats'up" but the second string was not detected : "are you good"
then reset the proces, do noging and wait until you get all the 2 lines in chat line.

I tryed something like this but not succes :

Code:
{$CLEO}


REPEAT
   WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

WHILE TRUE
   WAIT 0

IF
0B61:  samp is_local_player_spawned                                                                      
THEN
    FOR 0@ = 98 TO 99 /
        0AC8: 1@ = allocate_memory_size 260
        0AC8: 2@ = allocate_memory_size 260                                                                            
        :detect1
        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 "Your car has been stolen by" // Text 1 here
        THEN
                jump if false @detect1
                if
                :detect2
                0C29: $NOT_USED = stristr string1 1@ string2 "You have 5 seconds to type the command /releaseveh" // Text 2 here
                then
                jump if false @detect2
                wait 100
                0AF8: samp add_message_to_chat "Text lines succesfully detected"
                jump @continue1
                end
             
                :continue1
                IF
                0C29: $NOT_USED = stristr string1 1@ string2 "Text lines succesfully detected"
                THEN
                wait 500
                0AF9: samp say_msg "/releaseveh"
                end
            end
         end    
    end

It will keep saying me that : A jump to offset 0 found

@ajom @Parazitas

if u want to help

the lines will apear in the same secoond like this:

[09:08:46] Your car has been stolen by
[09:08:46 ]You have 5 seconds to type the command /releaseveh
 
Last edited:

Derrekgamer

Active member
Joined
Oct 26, 2020
Messages
93
Reaction score
1
Location
Grecee
It was already implemented in your previous topic. Avoid making the same thread.
Nope bro this is another the hitman cmd works, i tested it on samp default. and works. Than you so much for that help dude.

This is a diferrent thread, that will help also another people, because i cant find anywhere here a script to do what i explained

and also i need that because im not always at pc and if someone stole my car i need to wait 2 hours to get it back, that rp servers

Its there any script to perform that actions? i can't find it and i tryed it by my self but getting error: A jump to offset 0 found

Today i tested the hitman on default game and works, so i changed this topic name and info. I want to learn how to that script to read 2 lines from chat
 
Last edited:

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
270
Location
Pluto
As saam said, always put NOP after the directive.
Code:
{$CLEO}
0000:

...

Then test the script you just made.
 

Derrekgamer

Active member
Joined
Oct 26, 2020
Messages
93
Reaction score
1
Location
Grecee
As saam said, always put NOP after the directive.
Code:
{$CLEO}
0000:

...

Then test the script you just made.

i did, now i can compile it, but not work.. crash. tryed diferent jump and other things, but stii crash at game start or when the text was detected..
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
i did, now i can compile it, but not work.. crash. tryed diferent jump and other things, but stii crash at game start or when the text was detected..
As saam said, always put NOP after the directive.
Code:
{$CLEO}
0000:

...

Then test the script you just made.

Let's save some time...
PHP:
{$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@ = 98 to 99 
        0AC8: 1@ = allocate_memory_size 1024
        0AC8: 2@ = allocate_memory_size 1024                                                                           
        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 "Your car has been stolen by" // Text 1 here
        then
        
            if 0C29: $NOT_USED = stristr string1 1@ string2 "You have 5 seconds to type the command /releaseveh" // Text 2 here
            then
                wait 100
                0AF8: samp add_message_to_chat "Text lines succesfully detected"
            end
         
            
            if 0C29: $NOT_USED = stristr string1 1@ string2 "Text lines succesfully detected"
            then
                wait 500
                0AF9: samp say_msg "/releaseveh"
            end
        end
    end
end

end
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
270
Location
Pluto
Its there any way to detect 2 chat lines from chat log?
and if both of lines was detected, then perform an action like: 0C29: $NOT_USED = stristr string1 1@ string2 "Text lines succesfully detected"

Example:

if
0C29: $NOT_USED = stristr string1 1@ string2 "Your car has been stolen by""
was detected
then
if
0C29: $NOT_USED = stristr string1 1@ string2 "You have 5 seconds to type the command /releaseveh"
was also detected
then
if both of lines are detected in chat
then
0C29: $NOT_USED = stristr string1 1@ string2 "Text lines succesfully detected"

If the first string its detected,: "hey whats'up" but the second string was not detected : "are you good"
then reset the proces, do noging and wait until you get all the 2 lines in chat line.

I tryed something like this but not succes :

Code:
{$CLEO}


REPEAT
   WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

WHILE TRUE
   WAIT 0

IF
0B61:  samp is_local_player_spawned                                                                     
THEN
    FOR 0@ = 98 TO 99 /
        0AC8: 1@ = allocate_memory_size 260
        0AC8: 2@ = allocate_memory_size 260                                                                           
        :detect1
        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 "Your car has been stolen by" // Text 1 here
        THEN
                jump if false @detect1
                if
                :detect2
                0C29: $NOT_USED = stristr string1 1@ string2 "You have 5 seconds to type the command /releaseveh" // Text 2 here
                then
                jump if false @detect2
                wait 100
                0AF8: samp add_message_to_chat "Text lines succesfully detected"
                jump @continue1
                end
            
                :continue1
                IF
                0C29: $NOT_USED = stristr string1 1@ string2 "Text lines succesfully detected"
                THEN
                wait 500
                0AF9: samp say_msg "/releaseveh"
                end
            end
         end   
    end

It will keep saying me that : A jump to offset 0 found

@ajom @Parazitas

if u want to help

the lines will apear in the same secoond like this:

[09:08:46] Your car has been stolen by
[09:08:46 ]You have 5 seconds to type the command /releaseveh


A version which doesn't rely on a waiting for a dummy message to appear, I think this is what you need:
Code:
{$CLEO}
0000:

repeat
    wait 0
until 0AFA:  is_samp_available

while true
    wait 0
    if gosub @mypatternexists
    then
        // 0AD1: show_formatted_text_highpriority "DETECTED!" time 200 // for debugging purposes

        //
            // Some Lines of Code you will do when it gets detected, put it here
        0AF9: samp say_msg "/releaseveh"
        //

            // waits for the latest message to be updated! This avoids detecting the pattern multiple times
        while gosub @mypatternexists
            wait 0
        end
            //
    end
end

:mypatternexists
    0AB1: @GETCHATENTRYTEXT 1 _Index 98 _ReturnStringPtr 0@ // previous received chat message
    0AB1: @GETCHATENTRYTEXT 1 _Index 99 _ReturnStringPtr 1@ // latest received chat message
    if and
        0C29: 2@ = stristr string1 0@ string2 "Your car has been stolen by" // make sure the previous message contains this string
        0C29: 2@ = stristr string1 1@ string2 "You have 5 seconds to type the command /releaseveh" // make sure the latest message contains this string
    then return_true
    else return_false
    end
return

:getChatEntryText // for R1
    0AF7: samp 1@ = get_base
    1@ += 0x21A0E4 // SAMP_CHAT_INFO_OFFSET
    0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
    1@ += 0x136 // stChatInfo:stChatEntry[0]
    0@ *= 252 // size of stChatEntry
    005A: 1@ += 0@ // stChatEntry[n]
    1@ += 28 // szText
0AB2: ret 1 1@
 

mohammad0070069

Active member
Joined
Mar 30, 2023
Messages
27
Reaction score
0
Let's save some time...
PHP:
{$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@ = 98 to 99
        0AC8: 1@ = allocate_memory_size 1024
        0AC8: 2@ = allocate_memory_size 1024                                                                         
        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 "Your car has been stolen by" // Text 1 here
        then
      
            if 0C29: $NOT_USED = stristr string1 1@ string2 "You have 5 seconds to type the command /releaseveh" // Text 2 here
            then
                wait 100
                0AF8: samp add_message_to_chat "Text lines succesfully detected"
            end
       
          
            if 0C29: $NOT_USED = stristr string1 1@ string2 "Text lines succesfully detected"
            then
                wait 500
                0AF9: samp say_msg "/releaseveh"
            end
        end
    end
end

end
can you made on/off for this?
 

Fr0z3n

Well-known member
Joined
Nov 20, 2019
Messages
300
Reaction score
36
Location
Srbija
can you made on/off for this?

here is an optimized version with on/off:

PHP:
{$CLEO.cs}

0000:
// On/off flag
0A8D: 5@ = read_memory 0xBAA428 size 4 virtual_protect 0  // Score0

:MAIN_LOOP
wait 0

0AFA: if SAMP_IS_READY
then
    // Toggle script with score0
    if 5@ == 0
    then
        wait 1000
        jump @MAIN_LOOP
    end

    0B61: if samp is_local_player_spawned
    then
        for 0@ = 98 to 99
            0AC8: 1@ = allocate_memory_size 1024
            0AC8: 2@ = allocate_memory_size 1024
            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 "Your car has been stolen by"
            then
                if 0C29: $NOT_USED = stristr string1 1@ string2 "You have 5 seconds to type the command /releaseveh"
                then
                    wait 100
                    0AF8: samp add_message_to_chat "Text lines successfully detected"
                end
            end

            if 0C29: $NOT_USED = stristr string1 1@ string2 "Text lines successfully detected"
            then
                wait 500
                0AF9: samp say_msg "/releaseveh"
            end

            0AC9: free_allocated_memory 1@
            0AC9: free_allocated_memory 2@
        end
    end
end
jump @MAIN_LOOP

This optimized version adds an on/off command using the score0 value as a flag. When score0 is 0, the script will be inactive. To activate it, set score0 to a non-zero value. Memory allocation is now freed after use to avoid memory leaks, and a few typos have been corrected in the chat message.
 

mohammad0070069

Active member
Joined
Mar 30, 2023
Messages
27
Reaction score
0
here is an optimized version with on/off:

PHP:
{$CLEO.cs}

0000:
// On/off flag
0A8D: 5@ = read_memory 0xBAA428 size 4 virtual_protect 0  // Score0

:MAIN_LOOP
wait 0

0AFA: if SAMP_IS_READY
then
    // Toggle script with score0
    if 5@ == 0
    then
        wait 1000
        jump @MAIN_LOOP
    end

    0B61: if samp is_local_player_spawned
    then
        for 0@ = 98 to 99
            0AC8: 1@ = allocate_memory_size 1024
            0AC8: 2@ = allocate_memory_size 1024
            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 "Your car has been stolen by"
            then
                if 0C29: $NOT_USED = stristr string1 1@ string2 "You have 5 seconds to type the command /releaseveh"
                then
                    wait 100
                    0AF8: samp add_message_to_chat "Text lines successfully detected"
                end
            end

            if 0C29: $NOT_USED = stristr string1 1@ string2 "Text lines successfully detected"
            then
                wait 500
                0AF9: samp say_msg "/releaseveh"
            end

            0AC9: free_allocated_memory 1@
            0AC9: free_allocated_memory 2@
        end
    end
end
jump @MAIN_LOOP

This optimized version adds an on/off command using the score0 value as a flag. When score0 is 0, the script will be inactive. To activate it, set score0 to a non-zero value. Memory allocation is now freed after use to avoid memory leaks, and a few typos have been corrected in the chat message.
oh
no
can you make on/off with cmd or kay (J)
 
Top