Automatic /rr

SPARK1337

New member
Joined
Nov 18, 2023
Messages
1
Reaction score
0
Hello!

I have this mod called 'Reconnect.cs' (this mod works like this -> when I use the command '/rr' in chat, it reconnects me to the server). I want to add to this mod, or create another one separately, the ability that when the message ''You are banned from this server'' or ''Server closed the connection.'' is detected in the chat, it automatically reconnects me to the server (i.e., it automatically uses the /rr command). In addition to this, I want the original mod to still work when I manually use the command '/rr' in chat.

The mod can be found below.

Thanks in advance.
 

Attachments

  • Reconnect.cs
    18.7 KB · Views: 9

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
882
Location
Lithuania
PHP:
{$CLEO}

thread "scripter"

0000:

repeat
    wait 0
until 0AFA:

0B63: "rr"
0B63: "Name"

0B34: "Name" @Name       
0b34: "rr" @asd

while true
wait 0 

if 17@ == 1
then
    0B28: 0
    wait 1050
    0B27: 1
    17@ = 0 
end

IF 0256:   player $PLAYER_CHAR defined
THEN
    0AC8: 17@ = allocate_memory_size 260 // ALLOCATE MEMORY FOR THE CHAT STRING
    0AC8: 18@ = allocate_memory_size 260 // ALLOCATE MEMORY FOR THE CHAT STRING
    0B75: samp get_chat_string 99 text_to 17@ prefix_to 18@ color_to 19@ prefix_color_to 20@
    IF 0C29: $NOT_USED = stristr string1 17@ string2 "Server closed the connection." // COMPARE STRING 17@ WITH "Server closed the connection."
    THEN
        0B28: 0
        wait 1050
        0B27: 1
    END
    0AC9: free_allocated_memory 17@
    0AC9: free_allocated_memory 18@
END

END

:asd 
0AC8: 0@ = mem 124
0B2B: 15@ = $PLAYER_ACTOR
0B36: 0@ = 15@

0AC8: 1@ = mem 124
0AB1: @nic 4 0@ 91 93 1@
printf "Nume: %s" 4000 1@

0B29: 1@
17@ = 1
free 0@ 
free 1@
cmdret

:nic
5@ = FALSE 
0C17: 31@ = strlen 0@
    for 30@ = 0 to 31@
        0085: 29@ = 0@
        005A: 29@ += 30@
        0A8D: 28@ = mem 29@ 1 1 
        if
        003B:   28@ == 1@
        then
            5@ = TRUE 
        end
 
        if
        5@ == FALSE 
        THEN
            0A8C: 3@ 1 28@ 1
            3@ += 1 
        END
 
        if
        003B:   28@ == 2@
        then
            5@ = FALSE 
        end
    end
0A8C: m 3@ s 1 v 0 v 1 
0AB2: ret 0


:Name
if SAMP.IsCommandTyped(0@)
then 
    0B29: name 0@
    printf "Nume: %s" 4000 0@
else printf "Introdu un nume" 4000
end
cmdret
 
Top