Get samp text chat

tuananh225tn

Member
Joined
Mar 14, 2022
Messages
9
Reaction score
0
I want to make a cleo that will send a comment when a specified text chat appear
SAMP 0.3DL
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
458
Solutions
9
Reaction score
166
Location
Poland
I want to make a cleo that will send a comment when a specified text chat appear
SAMP 0.3DL
PHP:
{$CLEO .cs}

0000: NOP

WAIT 8500

WHILE TRUE
WAIT 0

IF 0256:   player $PLAYER_CHAR defined
THEN
    IF 0ADC:   test_cheat "SIEMA"
    THEN
        IF 30@ == FALSE
        THEN
            30@ = TRUE       
            0AD1: "~g~ON" 1337
        ELSE
            30@ = FALSE
            0AD1: "~r~OFF" 137    
        END
    END
   
    IF 30@ == TRUE
    THEN   
        0AC8: 1@ = allocate_memory_size 1024
        0AC8: 2@ = allocate_memory_size 1024
        0AB1: @getChatString 2 SampVersionID 3 ChatID 99 _Returned: Text 1@ PrefixText 2@ Color 3@ PrefixColor 4@       
        0AC8: 5@ = allocate_memory_size 1024
        0AB1: @DeleteColorCodeFromText 2 text 1@ memory_to_store_characters_as_text 5@
       
        0AC8: 9@ = allocate_memory_size 1024
        0AD3: 9@ = format "OK!"               
        0AC8: 6@ = allocate_memory_size 1024
        0AD3: 6@ = "test1"
        IF 0AB1: @IfTextContains 2 String1 5@ String2 6@ _Returned: Text 20@
        THEN
            0AB1: @Chatmsg 3 SampVersionID 3 text 9@ color 0xFF00FF00
        END
        0AC8: 7@ = allocate_memory_size 1024
        0AD3: 7@ = "test2"       
        IF 0AB1: @IfTextContains 2 String1 5@ String2 7@ _Returned: Text 20@
        THEN
            0AB1: @Chatmsg 3 SampVersionID 3 text 9@ color 0xFF00FF00
        END
        0AC8: 8@ = allocate_memory_size 1024
        0AD3: 8@ = "test3"       
        IF 0AB1: @IfTextContains 2 String1 5@ String2 8@ _Returned: Text 20@
        THEN
            0AB1: @Chatmsg 3 SampVersionID 3 text 9@ color 0xFF00FF00
        END                 
    END   
END

END

:getChatString
{
    0AC8: 1@ = allocate_memory_size 1024
    0AC8: 2@ = allocate_memory_size 1024
    0AB1: @getChatString 2 SampVersionID 0@ ChatID 99 _Returned: Text 1@ PrefixText 2@ Color 3@ PrefixColor 4@
}
IF 0AA2: 31@ = "samp.dll"
THEN
    IF NOT 0@ < 1
    THEN
        IF 0@ == 1 // 0.3.7 R1
        THEN
            31@ += 0x21A0E4 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END
        IF 0@ == 2 // 0.3.7 R2
        THEN
            31@ += 0x21A0EC // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END

        IF 0@ == 3 // 0.3.DL
        THEN
            31@ += 0x2ACA10 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END

        IF 0@ == 4 // 0.3.7 R3
        THEN 
            31@ += 0x26E8C8 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END

        IF 0@ == 5 // 0.3.7 R4
        THEN
            31@ += 0x26E9F8 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END
     
        IF 0@ == 6 // 0.3.7 R4 - v2
        THEN
            31@ += 0x26E9F8 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END
    END
    0AA3: 31@
END
0AB2: ret 4 30@ 29@ 27@ 24@

:DeleteColorCodeFromText
{
    0AC8: 1@ = allocate_memory_size 1024
    0AB1: @DeleteColorCodeFromText 2 text 0@ memory_to_store_characters_as_text 1@
}
//*********************** Strlen *********************\\
0085: 27@ = 0@ // copy pointer
FOR 31@ = 0 TO 1024
    0A8D: 26@ = read_memory 27@ size 1 virtual_protect 0
    IF NOT 26@ == 0
    JF BREAK
    27@ += 1
END   
//****************************************************\\
5@ = FALSE // inbracket
    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 begin
        END
       
        IF 5@ == FALSE // not 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
    END
0A8C: write_memory 1@ size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0

:IfTextContains
//0AB1: @IfTextContains 2 String1 0@ String2 1@ _Returned: Text 2@
0AB1: @strlen 1 string 0@ _length 31@
0AB1: @strlen 1 string 1@ _length 30@

//initial length check (the phrase can't be longer than the main text)
if 001D:   30@ > 31@  // (int)
then
059A:  return_false
0AB2: ret 1 0
end

31@ -= 1
26@ = 0 // counter of the same chars in a row
for 29@ = 0 to 31@ // for each char of the main text  (29@ = index)
    0085: 24@ = 0@ // (int)
    005A: 24@ += 29@  // (int)
    0A8D: 28@ = read_memory 24@ size 1 virtual_protect 0

    0085: 23@ = 1@ // (int)
    005A: 23@ += 26@  // (int)
    0A8D: 27@ = read_memory 23@ size 1 virtual_protect 0

    if 003B:   28@ == 27@  // (int)
    then
    26@++
        if 002D:   26@ >= 30@  // (int)
        then
        0485:  return_true
        0062: 24@ -= 30@  // (int)
        24@ += 1
        0AB2: ret 1 24@
        end
    else
        if 26@ > 0
        then
        29@-- //check the same char again and assume it's the begining of the string but only if there was matching parts before (otherwise it would go back all the time and make infinite loop)
        end
    26@ = 0
    end
end

059A:  return_false
0AB2: ret 1 0

:strlen
// 0AB1: @strlen 1 string 1@ _return: size 3@
for 1@ = 0 to 1024
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
    if not 2@ == 0
    jf break
    0@ += 1
end
0AB2: ret 1 1@

:Chatmsg
/*
     0AC8: 4@ = allocate_memory_size 1024
     0AD3: 4@ = format "{FFFFFF}Auto Accept: {00FF00}ON"
     0AB1: @Chatmsg 3 SampVersionID 0@ text 4@ color 0xFF00FF00
*/
IF 0AA2: 31@ = "samp.dll"
THEN
    IF NOT 0@ < 1
    THEN
        IF 0@ == 1 // 0.3.7 R1
        THEN
            0A8E: 30@ = 31@ + 0x21A0E4            // SAMP_CHAT_INFO_OFFSET (R1)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x64010             // FUNC_ADDTOCHATWND (R1)
        END

        IF 0@ == 2 // 0.3.7 R2
        THEN
            0A8E: 30@ = 31@ + 0x21A0EC            // SAMP_CHAT_INFO_OFFSET (R2)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x640E0            // FUNC_ADDTOCHATWND (R2)
        END

        IF 0@ == 3 // 0.3.DL
        THEN
            0A8E: 30@ = 31@ + 0x2ACA10            // SAMP_CHAT_INFO_OFFSET (DL)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67650             // FUNC_ADDTOCHATWND (DL)
        END

        IF 0@ == 4 // 0.3.7 R3
        THEN
            0A8E: 30@ = 31@ + 0x26E8C8            // SAMP_CHAT_INFO_OFFSET (R3)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67460             // FUNC_ADDTOCHATWND (R3)
        END

        IF 0@ == 5 // 0.3.7 R4
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BA0             // FUNC_ADDTOCHATWND (R4) 699D0
        END
     
        IF 0@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BE0            // FUNC_ADDTOCHATWND (R4)
        END
        IF 2@ == -1
        THEN 2@ = 0xFFFFFFFF
        END
        0AA6: call 29@ struct 30@ num_params 5 pop 0 params 0 2@ 0 1@ 8
    END
END
0AB2: 0
 

tuananh225tn

Member
Joined
Mar 14, 2022
Messages
9
Reaction score
0
PHP:
{$CLEO .cs}

0000: NOP

WAIT 8500

WHILE TRUE
WAIT 0

IF 0256:   player $PLAYER_CHAR defined
THEN
    IF 0ADC:   test_cheat "SIEMA"
    THEN
        IF 30@ == FALSE
        THEN
            30@ = TRUE      
            0AD1: "~g~ON" 1337
        ELSE
            30@ = FALSE
            0AD1: "~r~OFF" 137   
        END
    END
  
    IF 30@ == TRUE
    THEN  
        0AC8: 1@ = allocate_memory_size 1024
        0AC8: 2@ = allocate_memory_size 1024
        0AB1: @getChatString 2 SampVersionID 3 ChatID 99 _Returned: Text 1@ PrefixText 2@ Color 3@ PrefixColor 4@      
        0AC8: 5@ = allocate_memory_size 1024
        0AB1: @DeleteColorCodeFromText 2 text 1@ memory_to_store_characters_as_text 5@
      
        0AC8: 9@ = allocate_memory_size 1024
        0AD3: 9@ = format "OK!"              
        0AC8: 6@ = allocate_memory_size 1024
        0AD3: 6@ = "test1"
        IF 0AB1: @IfTextContains 2 String1 5@ String2 6@ _Returned: Text 20@
        THEN
            0AB1: @Chatmsg 3 SampVersionID 3 text 9@ color 0xFF00FF00
        END
        0AC8: 7@ = allocate_memory_size 1024
        0AD3: 7@ = "test2"      
        IF 0AB1: @IfTextContains 2 String1 5@ String2 7@ _Returned: Text 20@
        THEN
            0AB1: @Chatmsg 3 SampVersionID 3 text 9@ color 0xFF00FF00
        END
        0AC8: 8@ = allocate_memory_size 1024
        0AD3: 8@ = "test3"      
        IF 0AB1: @IfTextContains 2 String1 5@ String2 8@ _Returned: Text 20@
        THEN
            0AB1: @Chatmsg 3 SampVersionID 3 text 9@ color 0xFF00FF00
        END                
    END  
END

END

:getChatString
{
    0AC8: 1@ = allocate_memory_size 1024
    0AC8: 2@ = allocate_memory_size 1024
    0AB1: @getChatString 2 SampVersionID 0@ ChatID 99 _Returned: Text 1@ PrefixText 2@ Color 3@ PrefixColor 4@
}
IF 0AA2: 31@ = "samp.dll"
THEN
    IF NOT 0@ < 1
    THEN
        IF 0@ == 1 // 0.3.7 R1
        THEN
            31@ += 0x21A0E4 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END
        IF 0@ == 2 // 0.3.7 R2
        THEN
            31@ += 0x21A0EC // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END

        IF 0@ == 3 // 0.3.DL
        THEN
            31@ += 0x2ACA10 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END

        IF 0@ == 4 // 0.3.7 R3
        THEN
            31@ += 0x26E8C8 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END

        IF 0@ == 5 // 0.3.7 R4
        THEN
            31@ += 0x26E9F8 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END
    
        IF 0@ == 6 // 0.3.7 R4 - v2
        THEN
            31@ += 0x26E9F8 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END
    END
    0AA3: 31@
END
0AB2: ret 4 30@ 29@ 27@ 24@

:DeleteColorCodeFromText
{
    0AC8: 1@ = allocate_memory_size 1024
    0AB1: @DeleteColorCodeFromText 2 text 0@ memory_to_store_characters_as_text 1@
}
//*********************** Strlen *********************\\
0085: 27@ = 0@ // copy pointer
FOR 31@ = 0 TO 1024
    0A8D: 26@ = read_memory 27@ size 1 virtual_protect 0
    IF NOT 26@ == 0
    JF BREAK
    27@ += 1
END  
//****************************************************\\
5@ = FALSE // inbracket
    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 begin
        END
      
        IF 5@ == FALSE // not 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
    END
0A8C: write_memory 1@ size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0

:IfTextContains
//0AB1: @IfTextContains 2 String1 0@ String2 1@ _Returned: Text 2@
0AB1: @strlen 1 string 0@ _length 31@
0AB1: @strlen 1 string 1@ _length 30@

//initial length check (the phrase can't be longer than the main text)
if 001D:   30@ > 31@  // (int)
then
059A:  return_false
0AB2: ret 1 0
end

31@ -= 1
26@ = 0 // counter of the same chars in a row
for 29@ = 0 to 31@ // for each char of the main text  (29@ = index)
    0085: 24@ = 0@ // (int)
    005A: 24@ += 29@  // (int)
    0A8D: 28@ = read_memory 24@ size 1 virtual_protect 0

    0085: 23@ = 1@ // (int)
    005A: 23@ += 26@  // (int)
    0A8D: 27@ = read_memory 23@ size 1 virtual_protect 0

    if 003B:   28@ == 27@  // (int)
    then
    26@++
        if 002D:   26@ >= 30@  // (int)
        then
        0485:  return_true
        0062: 24@ -= 30@  // (int)
        24@ += 1
        0AB2: ret 1 24@
        end
    else
        if 26@ > 0
        then
        29@-- //check the same char again and assume it's the begining of the string but only if there was matching parts before (otherwise it would go back all the time and make infinite loop)
        end
    26@ = 0
    end
end

059A:  return_false
0AB2: ret 1 0

:strlen
// 0AB1: @strlen 1 string 1@ _return: size 3@
for 1@ = 0 to 1024
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
    if not 2@ == 0
    jf break
    0@ += 1
end
0AB2: ret 1 1@

:Chatmsg
/*
     0AC8: 4@ = allocate_memory_size 1024
     0AD3: 4@ = format "{FFFFFF}Auto Accept: {00FF00}ON"
     0AB1: @Chatmsg 3 SampVersionID 0@ text 4@ color 0xFF00FF00
*/
IF 0AA2: 31@ = "samp.dll"
THEN
    IF NOT 0@ < 1
    THEN
        IF 0@ == 1 // 0.3.7 R1
        THEN
            0A8E: 30@ = 31@ + 0x21A0E4            // SAMP_CHAT_INFO_OFFSET (R1)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x64010             // FUNC_ADDTOCHATWND (R1)
        END

        IF 0@ == 2 // 0.3.7 R2
        THEN
            0A8E: 30@ = 31@ + 0x21A0EC            // SAMP_CHAT_INFO_OFFSET (R2)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x640E0            // FUNC_ADDTOCHATWND (R2)
        END

        IF 0@ == 3 // 0.3.DL
        THEN
            0A8E: 30@ = 31@ + 0x2ACA10            // SAMP_CHAT_INFO_OFFSET (DL)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67650             // FUNC_ADDTOCHATWND (DL)
        END

        IF 0@ == 4 // 0.3.7 R3
        THEN
            0A8E: 30@ = 31@ + 0x26E8C8            // SAMP_CHAT_INFO_OFFSET (R3)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67460             // FUNC_ADDTOCHATWND (R3)
        END

        IF 0@ == 5 // 0.3.7 R4
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BA0             // FUNC_ADDTOCHATWND (R4) 699D0
        END
    
        IF 0@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BE0            // FUNC_ADDTOCHATWND (R4)
        END
        IF 2@ == -1
        THEN 2@ = 0xFFFFFFFF
        END
        0AA6: call 29@ struct 30@ num_params 5 pop 0 params 0 2@ 0 1@ 8
    END
END
0AB2: 0
Tks :3
 

tuananh225tn

Member
Joined
Mar 14, 2022
Messages
9
Reaction score
0
PHP:
{$CLEO .cs}

0000: NOP

WAIT 8500

WHILE TRUE
WAIT 0

IF 0256:   player $PLAYER_CHAR defined
THEN
    IF 0ADC:   test_cheat "SIEMA"
    THEN
        IF 30@ == FALSE
        THEN
            30@ = TRUE      
            0AD1: "~g~ON" 1337
        ELSE
            30@ = FALSE
            0AD1: "~r~OFF" 137   
        END
    END
  
    IF 30@ == TRUE
    THEN  
        0AC8: 1@ = allocate_memory_size 1024
        0AC8: 2@ = allocate_memory_size 1024
        0AB1: @getChatString 2 SampVersionID 3 ChatID 99 _Returned: Text 1@ PrefixText 2@ Color 3@ PrefixColor 4@      
        0AC8: 5@ = allocate_memory_size 1024
        0AB1: @DeleteColorCodeFromText 2 text 1@ memory_to_store_characters_as_text 5@
      
        0AC8: 9@ = allocate_memory_size 1024
        0AD3: 9@ = format "OK!"              
        0AC8: 6@ = allocate_memory_size 1024
        0AD3: 6@ = "test1"
        IF 0AB1: @IfTextContains 2 String1 5@ String2 6@ _Returned: Text 20@
        THEN
            0AB1: @Chatmsg 3 SampVersionID 3 text 9@ color 0xFF00FF00
        END
        0AC8: 7@ = allocate_memory_size 1024
        0AD3: 7@ = "test2"      
        IF 0AB1: @IfTextContains 2 String1 5@ String2 7@ _Returned: Text 20@
        THEN
            0AB1: @Chatmsg 3 SampVersionID 3 text 9@ color 0xFF00FF00
        END
        0AC8: 8@ = allocate_memory_size 1024
        0AD3: 8@ = "test3"      
        IF 0AB1: @IfTextContains 2 String1 5@ String2 8@ _Returned: Text 20@
        THEN
            0AB1: @Chatmsg 3 SampVersionID 3 text 9@ color 0xFF00FF00
        END                
    END  
END

END

:getChatString
{
    0AC8: 1@ = allocate_memory_size 1024
    0AC8: 2@ = allocate_memory_size 1024
    0AB1: @getChatString 2 SampVersionID 0@ ChatID 99 _Returned: Text 1@ PrefixText 2@ Color 3@ PrefixColor 4@
}
IF 0AA2: 31@ = "samp.dll"
THEN
    IF NOT 0@ < 1
    THEN
        IF 0@ == 1 // 0.3.7 R1
        THEN
            31@ += 0x21A0E4 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END
        IF 0@ == 2 // 0.3.7 R2
        THEN
            31@ += 0x21A0EC // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END

        IF 0@ == 3 // 0.3.DL
        THEN
            31@ += 0x2ACA10 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END

        IF 0@ == 4 // 0.3.7 R3
        THEN
            31@ += 0x26E8C8 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END

        IF 0@ == 5 // 0.3.7 R4
        THEN
            31@ += 0x26E9F8 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END
    
        IF 0@ == 6 // 0.3.7 R4 - v2
        THEN
            31@ += 0x26E9F8 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END
    END
    0AA3: 31@
END
0AB2: ret 4 30@ 29@ 27@ 24@

:DeleteColorCodeFromText
{
    0AC8: 1@ = allocate_memory_size 1024
    0AB1: @DeleteColorCodeFromText 2 text 0@ memory_to_store_characters_as_text 1@
}
//*********************** Strlen *********************\\
0085: 27@ = 0@ // copy pointer
FOR 31@ = 0 TO 1024
    0A8D: 26@ = read_memory 27@ size 1 virtual_protect 0
    IF NOT 26@ == 0
    JF BREAK
    27@ += 1
END  
//****************************************************\\
5@ = FALSE // inbracket
    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 begin
        END
      
        IF 5@ == FALSE // not 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
    END
0A8C: write_memory 1@ size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0

:IfTextContains
//0AB1: @IfTextContains 2 String1 0@ String2 1@ _Returned: Text 2@
0AB1: @strlen 1 string 0@ _length 31@
0AB1: @strlen 1 string 1@ _length 30@

//initial length check (the phrase can't be longer than the main text)
if 001D:   30@ > 31@  // (int)
then
059A:  return_false
0AB2: ret 1 0
end

31@ -= 1
26@ = 0 // counter of the same chars in a row
for 29@ = 0 to 31@ // for each char of the main text  (29@ = index)
    0085: 24@ = 0@ // (int)
    005A: 24@ += 29@  // (int)
    0A8D: 28@ = read_memory 24@ size 1 virtual_protect 0

    0085: 23@ = 1@ // (int)
    005A: 23@ += 26@  // (int)
    0A8D: 27@ = read_memory 23@ size 1 virtual_protect 0

    if 003B:   28@ == 27@  // (int)
    then
    26@++
        if 002D:   26@ >= 30@  // (int)
        then
        0485:  return_true
        0062: 24@ -= 30@  // (int)
        24@ += 1
        0AB2: ret 1 24@
        end
    else
        if 26@ > 0
        then
        29@-- //check the same char again and assume it's the begining of the string but only if there was matching parts before (otherwise it would go back all the time and make infinite loop)
        end
    26@ = 0
    end
end

059A:  return_false
0AB2: ret 1 0

:strlen
// 0AB1: @strlen 1 string 1@ _return: size 3@
for 1@ = 0 to 1024
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
    if not 2@ == 0
    jf break
    0@ += 1
end
0AB2: ret 1 1@

:Chatmsg
/*
     0AC8: 4@ = allocate_memory_size 1024
     0AD3: 4@ = format "{FFFFFF}Auto Accept: {00FF00}ON"
     0AB1: @Chatmsg 3 SampVersionID 0@ text 4@ color 0xFF00FF00
*/
IF 0AA2: 31@ = "samp.dll"
THEN
    IF NOT 0@ < 1
    THEN
        IF 0@ == 1 // 0.3.7 R1
        THEN
            0A8E: 30@ = 31@ + 0x21A0E4            // SAMP_CHAT_INFO_OFFSET (R1)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x64010             // FUNC_ADDTOCHATWND (R1)
        END

        IF 0@ == 2 // 0.3.7 R2
        THEN
            0A8E: 30@ = 31@ + 0x21A0EC            // SAMP_CHAT_INFO_OFFSET (R2)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x640E0            // FUNC_ADDTOCHATWND (R2)
        END

        IF 0@ == 3 // 0.3.DL
        THEN
            0A8E: 30@ = 31@ + 0x2ACA10            // SAMP_CHAT_INFO_OFFSET (DL)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67650             // FUNC_ADDTOCHATWND (DL)
        END

        IF 0@ == 4 // 0.3.7 R3
        THEN
            0A8E: 30@ = 31@ + 0x26E8C8            // SAMP_CHAT_INFO_OFFSET (R3)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67460             // FUNC_ADDTOCHATWND (R3)
        END

        IF 0@ == 5 // 0.3.7 R4
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BA0             // FUNC_ADDTOCHATWND (R4) 699D0
        END
    
        IF 0@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BE0            // FUNC_ADDTOCHATWND (R4)
        END
        IF 2@ == -1
        THEN 2@ = 0xFFFFFFFF
        END
        0AA6: call 29@ struct 30@ num_params 5 pop 0 params 0 2@ 0 1@ 8
    END
END
0AB2: 0
what about sending command instead of sending comment can u help me
 

tuananh225tn

Member
Joined
Mar 14, 2022
Messages
9
Reaction score
0
PHP:
{$CLEO .cs}

0000: NOP

WAIT 8500
WHILE TRUE
WAIT 0
IF 0256:   player $PLAYER_CHAR defined
THEN
    IF 0ADC:   test_cheat "SIEMA"
    THEN
        IF 30@ == FALSE
        THEN
            30@ = TRUE       
            0AD1: "~g~ON" 1337
        ELSE
            30@ = FALSE
            0AD1: "~r~OFF" 1337    
        END
    END
    IF 30@ == TRUE
    THEN
        0AC8: 1@ = allocate_memory_size 1024
        0AC8: 2@ = allocate_memory_size 1024   
        0AB1: @getChatString 2 SampVersionID 3 ChatID 99 _Returned: Text 1@ PrefixText 2@ Color 3@ PrefixColor 4@       
        0AC8: 5@ = allocate_memory_size 1024
        0AB1: @DeleteColorCodeFromText 2 text 1@ memory_to_store_characters_as_text 5@
       
        0AC8: 9@ = allocate_memory_size 1024
        0AD3: 9@ = format "/cmd"               
        0AC8: 8@ = allocate_memory_size 260
        0AD3: 8@ = "test3"       
        IF 0AB1: @IfTextContains 2 String1 5@ String2 8@ _Returned: Text 20@
        THEN
            0AB1: @sendCommand 1 9@
        END                 
    END   
END

END

:getChatString
{
    0AC8: 1@ = allocate_memory_size 1024
    0AC8: 2@ = allocate_memory_size 1024
    0AB1: @getChatString 2 SampVersionID 0@ ChatID 99 _Returned: Text 1@ PrefixText 2@ Color 3@ PrefixColor 4@
}
IF 0AA2: 31@ = "samp.dll"
THEN
    IF NOT 0@ < 1
    THEN
        IF 0@ == 1 // 0.3.7 R1
        THEN
            31@ += 0x21A0E4 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END
        IF 0@ == 2 // 0.3.7 R2
        THEN
            31@ += 0x21A0EC // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END

        IF 0@ == 3 // 0.3.DL
        THEN
            31@ += 0x2ACA10 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END

        IF 0@ == 4 // 0.3.7 R3
        THEN 
            31@ += 0x26E8C8 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END

        IF 0@ == 5 // 0.3.7 R4
        THEN
            31@ += 0x26E9F8 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END
     
        IF 0@ == 6 // 0.3.7 R4 - v2
        THEN
            31@ += 0x26E9F8 // SAMP_CHAT_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x132
            1@ *= 0xFC
            005A: 31@ += 1@
            0A8E: 30@ = 31@ + 0x20 // CHAT_TEXT_OFFSET
            0A8E: 29@ = 31@ + 0x4 // CHAT_PREFIX_TEXT_OFFSET
            0A8E: 28@ = 31@ + 0xF4 // CHAT_COLOR_OFFSET
            0A8D: 27@ readMem 28@ sz 4 vp 0 // HEX Color
            0A8E: 26@ = 31@ + 0xF8 // CHAT_PREFIX_COLOR_OFFSET
            0A8D: 25@ readMem 26@ sz 1 vp 0
            IF NOT 25@ > 0
            THEN 24@ = 0
            ELSE 0A8D: 24@ readMem 26@ sz 4 vp 0
            END
        END
    END
    0AA3: 31@
END
0AB2: ret 4 30@ 29@ 27@ 24@

:DeleteColorCodeFromText
{
    0AC8: 1@ = allocate_memory_size 1024
    0AB1: @DeleteColorCodeFromText 2 text 0@ memory_to_store_characters_as_text 1@
}
//*********************** Strlen *********************\\
0085: 27@ = 0@ // copy pointer
FOR 31@ = 0 TO 1024
    0A8D: 26@ = read_memory 27@ size 1 virtual_protect 0
    IF NOT 26@ == 0
    JF BREAK
    27@ += 1
END   
//****************************************************\\
5@ = FALSE // inbracket
    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 begin
        END
       
        IF 5@ == FALSE // not 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
    END
0A8C: write_memory 1@ size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0

:IfTextContains
//0AB1: @IfTextContains 2 String1 0@ String2 1@ _Returned: Text 2@
0AB1: @strlen 1 string 0@ _length 31@
0AB1: @strlen 1 string 1@ _length 30@

//initial length check (the phrase can't be longer than the main text)
if 001D:   30@ > 31@  // (int)
then
059A:  return_false
0AB2: ret 1 0
end

31@ -= 1
26@ = 0 // counter of the same chars in a row
for 29@ = 0 to 31@ // for each char of the main text  (29@ = index)
    0085: 24@ = 0@ // (int)
    005A: 24@ += 29@  // (int)
    0A8D: 28@ = read_memory 24@ size 1 virtual_protect 0

    0085: 23@ = 1@ // (int)
    005A: 23@ += 26@  // (int)
    0A8D: 27@ = read_memory 23@ size 1 virtual_protect 0

    if 003B:   28@ == 27@  // (int)
    then
    26@++
        if 002D:   26@ >= 30@  // (int)
        then
        0485:  return_true
        0062: 24@ -= 30@  // (int)
        24@ += 1
        0AB2: ret 1 24@
        end
    else
        if 26@ > 0
        then
        29@-- //check the same char again and assume it's the begining of the string but only if there was matching parts before (otherwise it would go back all the time and make infinite loop)
        end
    26@ = 0
    end
end

059A:  return_false
0AB2: ret 1 0

:strlen
// 0AB1: @strlen 1 string 1@ _return: size 3@
for 1@ = 0 to 1024
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
    if not 2@ == 0
    jf break
    0@ += 1
end
0AB2: ret 1 1@

:Chatmsg
/*
     0AC8: 4@ = allocate_memory_size 1024
     0AD3: 4@ = format "{FFFFFF}Auto Accept: {00FF00}ON"
     0AB1: @Chatmsg 3 SampVersionID 0@ text 4@ color 0xFF00FF00
*/
IF 0AA2: 31@ = "samp.dll"
THEN
    IF NOT 0@ < 1
    THEN
        IF 0@ == 1 // 0.3.7 R1
        THEN
            0A8E: 30@ = 31@ + 0x21A0E4            // SAMP_CHAT_INFO_OFFSET (R1)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x64010             // FUNC_ADDTOCHATWND (R1)
        END

        IF 0@ == 2 // 0.3.7 R2
        THEN
            0A8E: 30@ = 31@ + 0x21A0EC            // SAMP_CHAT_INFO_OFFSET (R2)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x640E0            // FUNC_ADDTOCHATWND (R2)
        END

        IF 0@ == 3 // 0.3.DL
        THEN
            0A8E: 30@ = 31@ + 0x2ACA10            // SAMP_CHAT_INFO_OFFSET (DL)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67650             // FUNC_ADDTOCHATWND (DL)
        END

        IF 0@ == 4 // 0.3.7 R3
        THEN
            0A8E: 30@ = 31@ + 0x26E8C8            // SAMP_CHAT_INFO_OFFSET (R3)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67460             // FUNC_ADDTOCHATWND (R3)
        END

        IF 0@ == 5 // 0.3.7 R4
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BA0             // FUNC_ADDTOCHATWND (R4) 699D0
        END
     
        IF 0@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BE0            // FUNC_ADDTOCHATWND (R4)
        END
        IF 2@ == -1
        THEN 2@ = 0xFFFFFFFF
        END
        0AA6: call 29@ struct 30@ num_params 5 pop 0 params 0 2@ 0 1@ 8
    END
END
0AB2: 0
:sendCommand
    if 0AA2: 1@ = "samp.dll"
    then
        1@ += 0x69340
        0AA5: call 1@ num_param 1 pop 0 0@
    end
    0AB2: 0
 
Top