CLEO Help Help with Regular Expression in SB!

CLEO related
Status
Not open for further replies.

Husnain

Well-known member
Joined
May 20, 2016
Messages
228
Reaction score
9
Location
Mars
Hello everyone!

I have a simple request. How can I detect the random name of the person and send auto msg to chat? I mean, I know how to send msg auto on chat but don't know how to work with names.

Like:

"Opcode.eXe has logged in."
Now, the code will be this:

Code:
0B75: samp get_chat_string 99 text_to 1@ prefix_to 2@ color_to 3@ prefix_color_to 4@  
if
  0C18: 5@ = strstr string1 1@ string2 "Opcode.eXe has logged in."
jf @chat
wait 100
say "Welcome back!"
Now it will work only if Opcode is logged in but how I can detect random name has logged in? Like regular Expression. Please, help!
 

Krc

Active member
Joined
Mar 30, 2018
Messages
193
Reaction score
25
Location
Lithuania
0B75: samp get_chat_string 99 text_to 1@ prefix_to 2@ color_to 3@ prefix_color_to 4@
0AC8: 1@ = allocate_memory_size 260
0AC8: 2@ = allocate_memory_size 260
If and
0C29: $NOT_USED = stristr string1 1@ string2 "%s" 6@v
0C29: $NOT_USED = stristr string1 1@ string2 "has logged in."
Then
wait 205
say "Welcome back %s" 6@v
end

// then if u want u can check if player connected, get player nickname lalala...
 

Edvincik

Well-known member
Joined
Mar 15, 2016
Messages
399
Reaction score
27
Didn't test it.
Code:
{$CLEO}
0000:

REPEAT
    WAIT 0
UNTIL 0AFA:

WHILE TRUE
    WAIT 0
    0AC8: 2@ = allocate_memory_size 144
    0AC8: 3@ = allocate_memory_size 144
    FOR 0@ = 0 TO 1000
        IF 0B23:  samp is_player_connected 0@
        THEN
            0B36: samp 1@ = get_player_nickname 0@
            0C11: memset destination 2@ value 0 size 144
            0C11: memset destination 3@ value 0 size 144
            0B75: samp get_chat_string 99 text_to 2@ prefix_to 3@ color_to 4@ prefix_color_to 5@
            IF AND
                0C29: $NOT_USED = stristr string1 2@ string2 1@
                0C29: $NOT_USED = stristr string1 2@ string2 "has logged in."
            THEN SAY "Welcome back!"
            END 
        END
    END
    0AC9: free_allocated_memory 2@
    0AC9: free_allocated_memory 3@
END
 
Status
Not open for further replies.
Top