CLEO Help AutoSpec for stuck

CLEO related

NoEy3

Member
Joined
Apr 18, 2022
Messages
7
Reaction score
0
Hello gang, for hours I've been trying to find a way to fix my issue. So, my issue is that when someone does report for being DM the script cleo will spec the player who reported not the one who got reported, this problem is because this script is based on a string that it seems won't stop just for the "Reason" it was given, for me I wanted to only do spec on players that report for the only reason if they got stuck. Here is a look at my code, solutions: how can I limit a string and not going all the way with that text or can I just make another scan string in chat and someone exlude others and only do chat string on the one "stuck"

{$USE CLEO}
{$USE ini}
{$USE file}
{$USE newOpcodes}
{$USE bitwise}
{$USE clipboard}
{$USE CLEO+}
{$CLEO}

0662: "c0d"
thread "c0d"

0B34: samp register_client_command "stopspec" to_label @stopspec

:repeatxx

alloc 29@ 256
0b75: samp get_chat_string 99 text_to 29@ -1 -1 -1

if 0AD4: 18@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: I'm stuck(placeholder). Help!" 11@ 12@ 13@ // this is an placeholder but the problem is the same even with different text since in here is no variable.
if 0AD4: 18@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: - DM." 11@ 12@ 13@ // this is where the problems starts, because it doesn't have any variables, that %s will take any text.
then
wait 2000
0AF9: samp say_msg "/spec %d" 12@
wait 500
0AB1: @PressScreenshot 0
wait 5000
end
SAMP.CmdRet()

free 29@
wait 0
jump @repeatxx

:stopspec
chatmsg "{F5A25D}Modul a fost dezactivat." -1
0A93: end_custom_thread
SAMP.CmdRet()

: PressScreenshot
if 0AA2: 0@ = load_dynamic_library "samp.dll"
then
0@ += 0x119CBC // 0.3.7 R1 > Do screenshot
0A8C: write_memory 0@ size 4 value true virtual_protect 0
end
0AB2: cleo_return 0
SAMP.CmdRet()

:go
0AA2: 0@ = load_library "samp.dll"
0085: 1@ = 0@
1@ += 2203876
0A8D: 3@ = read_memory 1@ size 4 virtual_protect 1
0085: 2@ = 0@
2@ += 409616
ret 0


Thanks.
 

NoEy3

Member
Joined
Apr 18, 2022
Messages
7
Reaction score
0
Sure, the code now looks something like this:
{$USE CLEO}
{$USE ini}
{$USE file}
{$USE newOpcodes}
{$USE bitwise}
{$USE clipboard}
{$USE CLEO+}
{$CLEO}

0662: "c0d"
thread "c0d"

0B34: samp register_client_command "stopspec" to_label @stopspec

:repeatxx

alloc 29@ 256
0b75: samp get_chat_string 99 text_to 29@ -1 -1 -1

if 0AD4: 18@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: Sunt blocat/nu vad nimic. Am nevoie de ajutor!" 11@ 12@ 13@
then
wait 2000
0AF9: samp say_msg "/spec %d" 12@
wait 500
0AB1: @PressScreenshot 0
wait 5000
if 0AD4: 16@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: %s (%d) - reported for DM." 3@ 4@ 5@ 2@ 1@
then
wait 1000
if 0AD4: 17@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: %s (%d) - cheats" 6@ 7@ 8@ 9@ 10@
then
wait 1000
end
end
end
SAMP.CmdRet()

free 29@
wait 0
jump @repeatxx

:stopspec
chatmsg "{F5A25D}Modul a fost dezactivat." -1
0A93: end_custom_thread
SAMP.CmdRet()

:pressScreenshot
if 0AA2: 0@ = load_dynamic_library "samp.dll"
then
0@ += 0x119CBC // 0.3.7 R1 > Do screenshot
0A8C: write_memory 0@ size 4 value true virtual_protect 0
end
0AB2: cleo_return 0
SAMP.CmdRet()

:go
0AA2: 0@ = load_library "samp.dll"
0085: 1@ = 0@
1@ += 2203876
0A8D: 3@ = read_memory 1@ size 4 virtual_protect 1
0085: 2@ = 0@
2@ += 409616
ret 0


so you can see that for
if 0AD4: 16@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: %s (%d) - reported for DM." 3@ 4@ 5@ 2@ 1@
then
wait 1000
if 0AD4: 17@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: %s (%d) - cheats" 6@ 7@ 8@ 9@ 10@
I want to do nothing and only for
if 0AD4: 18@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: Sunt blocat/nu vad nimic. Am nevoie de ajutor!" 11@ 12@ 13@
to do that command.
The screenshots from chat: The problem is that when the user reports another player let's say for cheating this cmd will spectate the player who reported and not the one who got reported, and this applies for DM reports too, I basically want to only trigger when "Sunt blocat/nu vad nimic. Am nevoie de ajutor!" it's detected in chat and nothing else.
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,115
Solutions
5
Reaction score
879
Location
Lithuania
Sure, the code now looks something like this:
{$USE CLEO}
{$USE ini}
{$USE file}
{$USE newOpcodes}
{$USE bitwise}
{$USE clipboard}
{$USE CLEO+}
{$CLEO}

0662: "c0d"
thread "c0d"

0B34: samp register_client_command "stopspec" to_label @stopspec

:repeatxx

alloc 29@ 256
0b75: samp get_chat_string 99 text_to 29@ -1 -1 -1

if 0AD4: 18@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: Sunt blocat/nu vad nimic. Am nevoie de ajutor!" 11@ 12@ 13@
then
wait 2000
0AF9: samp say_msg "/spec %d" 12@
wait 500
0AB1: @PressScreenshot 0
wait 5000
if 0AD4: 16@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: %s (%d) - reported for DM." 3@ 4@ 5@ 2@ 1@
then
wait 1000
if 0AD4: 17@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: %s (%d) - cheats" 6@ 7@ 8@ 9@ 10@
then
wait 1000
end
end
end
SAMP.CmdRet()

free 29@
wait 0
jump @repeatxx

:stopspec
chatmsg "{F5A25D}Modul a fost dezactivat." -1
0A93: end_custom_thread
SAMP.CmdRet()

:pressScreenshot
if 0AA2: 0@ = load_dynamic_library "samp.dll"
then
0@ += 0x119CBC // 0.3.7 R1 > Do screenshot
0A8C: write_memory 0@ size 4 value true virtual_protect 0
end
0AB2: cleo_return 0
SAMP.CmdRet()

:go
0AA2: 0@ = load_library "samp.dll"
0085: 1@ = 0@
1@ += 2203876
0A8D: 3@ = read_memory 1@ size 4 virtual_protect 1
0085: 2@ = 0@
2@ += 409616
ret 0


so you can see that for
if 0AD4: 16@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: %s (%d) - reported for DM." 3@ 4@ 5@ 2@ 1@
then
wait 1000
if 0AD4: 17@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: %s (%d) - cheats" 6@ 7@ 8@ 9@ 10@
I want to do nothing and only for
if 0AD4: 18@ = scan_string 29@ format "Report from %s [ID %d, Level %d]: Sunt blocat/nu vad nimic. Am nevoie de ajutor!" 11@ 12@ 13@
to do that command.
The screenshots from chat: The problem is that when the user reports another player let's say for cheating this cmd will spectate the player who reported and not the one who got reported, and this applies for DM reports too, I basically want to only trigger when "Sunt blocat/nu vad nimic. Am nevoie de ajutor!" it's detected in chat and nothing else.
I will fix it after job today.

By the way.., we have script for codes see in picture how you should write when posting code.

PHP:
Put your code here
 

Attachments

  • Screenshot_20220419_053115_com.android.chrome.jpg
    Screenshot_20220419_053115_com.android.chrome.jpg
    306.3 KB · Views: 11

Parazitas

God
Joined
Jan 2, 2017
Messages
3,115
Solutions
5
Reaction score
879
Location
Lithuania
According you source and picture:
PHP:
{$USE CLEO}
{$USE ini}
{$USE file}
{$USE newOpcodes}
{$USE bitwise}
{$USE clipboard}
{$USE CLEO+}
{$CLEO .cs}

0000: "Hello world"

REPEAT
WAIT 0
UNTIL 0AFA:

0B34: samp register_client_command "stopspec" to_label @stopspec

WHILE TRUE
WAIT 0

IF AND
31@ == FALSE // IF CHAT CHECKING PART IS ENABLED
0B61:  samp is_local_player_spawned
THEN
    0B75: samp get_chat_string 99 text_to 0@ prefix_to 1@ color_to 2@ prefix_color_to 3@
    IF 0C29: $NOT_UED = stristr string1 0@ string2 "Report from"
    THEN
        IF 0C29: 4@ = stristr string1 0@ string2 "[ID"
        THEN
            IF 0AD4: $NOT_UED = scan_string 4@ format "[ID %d" 5@
            THEN
                0209: 6@ = random_int_in_ranges 1000 2000 // 1000 = 1 SECOND
                wait 6@ // RANDOM TIME DELAY BEFORE SENDING COMMAND, RANDOM TIME MAKES YOU BE LESS DETECTABLE
                0AF9: "/spec %d" 5@
                wait 500  // DELAY BEFORE TAKING SCREENSHOT
                0AB1: @PressScreenshot 0
                31@ = TRUE // DISABLE CHAT CHECKING PART WHILE SPECTATING PLAYER, ANTI SPAM SERVER COMMAND..
            END
        END
    END
END

END
               
:stopspec
chatmsg "{F5A25D}Modul a fost dezactivat." -1
31@ = FALSE // ENABLE CHAT CHECKING PART AGAIN
0AF9: "/spec" // THIS COMMMAND WITHOUT PLAYER ID MAKES YOU LEAVE SPACTATING?
SAMP.CmdRet()

:pressScreenshot
IF 0AA2: 31@ = "samp.dll"
THEN
    31@ += 0x119CBC // 0.3.7 R1 > Do screenshot
    0A8C: writeMem 31@ sz 4 vl true vp 0
END
0AB2: cleo_return 0
 

NoEy3

Member
Joined
Apr 18, 2022
Messages
7
Reaction score
0
According you source and picture:
PHP:
{$USE CLEO}
{$USE ini}
{$USE file}
{$USE newOpcodes}
{$USE bitwise}
{$USE clipboard}
{$USE CLEO+}
{$CLEO .cs}

0000: "Hello world"

REPEAT
WAIT 0
UNTIL 0AFA:

0B34: samp register_client_command "stopspec" to_label @stopspec

WHILE TRUE
WAIT 0

IF AND
31@ == FALSE // IF CHAT CHECKING PART IS ENABLED
0B61:  samp is_local_player_spawned
THEN
    0B75: samp get_chat_string 99 text_to 0@ prefix_to 1@ color_to 2@ prefix_color_to 3@
    IF 0C29: $NOT_UED = stristr string1 0@ string2 "Report from"
    THEN
        IF 0C29: 4@ = stristr string1 0@ string2 "[ID"
        THEN
            IF 0AD4: $NOT_UED = scan_string 4@ format "[ID %d" 5@
            THEN
                0209: 6@ = random_int_in_ranges 1000 2000 // 1000 = 1 SECOND
                wait 6@ // RANDOM TIME DELAY BEFORE SENDING COMMAND, RANDOM TIME MAKES YOU BE LESS DETECTABLE
                0AF9: "/spec %d" 5@
                wait 500  // DELAY BEFORE TAKING SCREENSHOT
                0AB1: @PressScreenshot 0
                31@ = TRUE // DISABLE CHAT CHECKING PART WHILE SPECTATING PLAYER, ANTI SPAM SERVER COMMAND..
            END
        END
    END
END

END
              
:stopspec
chatmsg "{F5A25D}Modul a fost dezactivat." -1
31@ = FALSE // ENABLE CHAT CHECKING PART AGAIN
0AF9: "/spec" // THIS COMMMAND WITHOUT PLAYER ID MAKES YOU LEAVE SPACTATING?
SAMP.CmdRet()

:pressScreenshot
IF 0AA2: 31@ = "samp.dll"
THEN
    31@ += 0x119CBC // 0.3.7 R1 > Do screenshot
    0A8C: writeMem 31@ sz 4 vl true vp 0
END
0AB2: cleo_return 0
This cleo doesn't work for spec, if the string is triggered it won't do nothing, even if the reported player isn't for the DM reason.
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,115
Solutions
5
Reaction score
879
Location
Lithuania
This cleo doesn't work for spec, if the string is triggered it won't do nothing, even if the reported player isn't for the DM reason.
PHP:
{$USE CLEO}
{$USE ini}
{$USE file}
{$USE newOpcodes}
{$USE bitwise}
{$USE clipboard}
{$USE CLEO+}
{$CLEO .cs}

0000: "Hello world"

REPEAT
WAIT 0
UNTIL 0AFA:

0B34: samp register_client_command "stopspec" to_label @stopspec

WHILE TRUE
WAIT 0

IF AND
31@ == FALSE // IF CHAT CHECKING PART IS ENABLED
0B61:  samp is_local_player_spawned
THEN
    0B75: samp get_chat_string 99 text_to 0@ prefix_to 1@ color_to 2@ prefix_color_to 3@
    0AC8: 4@ = allocate_memory_size 1024
    0AB1: @DeleteColorCodeFromText 2 text 0@ memory_to_store_characters_as_text 4@
    IF 0C29: $NOT_UED = stristr string1 4@ string2 "Report from"
    THEN
        IF 0C29: 5@ = stristr string1 4@ string2 "[ID"
        THEN
            0C17: 6@ = strlen 5@
            IF 0C29: 7@ = stristr string1 4@ string2 "Level"
            THEN
                0C17: 8@ = strlen 7@
                0062: 6@ -= 8@  // (int)
                0AC8: 9@ = allocate_memory_size 1024
                0C24: strncpy destination 9@ source 5@ size 6@
                0AC8: 10@ = allocate_memory_size 1024
                0AB1: @get_digits_to_print 2 text 9@ memory_to_store_characters_as_text 10@
                    0209: 11@ = random_int_in_ranges 1000 2000 // 1000 = 1 SECOND
                    wait 11@ // RANDOM TIME DELAY BEFORE SENDING COMMAND, RANDOM TIME MAKES YOU BE LESS DETECTABLE
                    0AF9: "/spec %s" 10@
                    0AF8: samp add_message_to_chat "Sent to server: /spec %s" -1 10@  // debug line, just to see what was sent to server..
                    wait 500  // DELAY BEFORE TAKING SCREENSHOT
                    0AB1: @PressScreenshot 0
                    31@ = TRUE // DISABLE CHAT CHECKING PART WHILE SPECTATING PLAYER, ANTI SPAM SERVER COMMAND..
                END
        END
    END
END

END
              
:stopspec
chatmsg "{F5A25D}Modul a fost dezactivat." -1
31@ = FALSE // ENABLE CHAT CHECKING PART AGAIN
0AF9: "/spec" // THIS COMMMAND WITHOUT PLAYER ID MAKES YOU LEAVE SPACTATING?
0B43: samp cmd_ret

:pressScreenshot
IF 0AA2: 31@ = "samp.dll"
THEN
    31@ += 0x119CBC // 0.3.7 R1 > Do screenshot
    0A8C: writeMem 31@ sz 4 vl true vp 0
END
0AB2: cleo_return 0

:DeleteColorCodeFromText
{
    0AC8: 1@ = allocate_memory_size 1024
    0AB1: @DeleteColorCodeFromText 2 text 0@ memory_to_store_characters_as_text 1@
}
5@ = FALSE // inbracket
0C17: 31@ = strlen 0@
    FOR 30@ = 0 TO 31@ 
        0085: 29@ = 0@ // copy pointer
        005A: 29@ += 30@  // add offset (as the loop progresses it becomes pointers to first-last character)
        0A8D: 28@ = read_memory 29@ size 1 virtual_protect 1 // 28@ is the ascii number representing character
        IF 28@ == 123
        THEN 5@ = TRUE // inbracket
        END
       
        IF 5@ == FALSE // inbracket
        THEN
            0A8C: write_memory 1@ size 1 value 28@ virtual_protect 1
            1@ += 1 // move to next address
        END
       
        IF 28@ == 125
        THEN 5@ = FALSE // inbracket
        END
    END
0A8C: write_memory 1@ size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0

:get_digits_to_print
{
    0AC8: 1@ = allocate_memory_size 1024
    0AB1: @DeleteColorCodeFromText 2 text 0@ memory_to_store_characters_as_text 1@
}
0C17: 31@ = strlen 0@
    for 30@ = 0 to 31@ 
        0085: 29@ = 0@ // copy pointer
        005A: 29@ += 30@  // add offset (as the loop progresses it becomes pointers to first-last character)
        0A8D: 28@ = read_memory 29@ size 1 virtual_protect 1 // 28@ is the ascii number representing character
        if and
        28@ >= 0x30 // '0'
        28@ <= 0x39 // '9'
        then
        0A8C: write_memory 1@ size 1 value 28@ virtual_protect 1
        1@ += 1 // move to next address
        end
    end
0A8C: write_memory 1@ size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0



Don't forget leave picture what you got in the chat..
 
Top