Types of Sign Check and Sources , etc...

OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
2,143
Likes
385
Points
113
Location
Lithuania
Website
ugbase.eu
20
#23
My respects.

What I need is that when this dialog appears, the cancel button is chosen automatically.

Honors.

Please help me.
PHP:
{$CLEO .cs}

0000:

repeat
wait 0
until 0AA2: [email protected] = "samp.dll"

0AC8: [email protected] = allocate_memory_size 260
0AD3: [email protected] = format "Sign check"

0AB1: @get_samp_version_id 0 _Returned: ID [email protected]

WHILE TRUE
WAIT 0

IF
0256:   player $PLAYER_CHAR defined
THEN
    IF
    0AB1: @isDialogOpen 1 SampVersionID [email protected]
    THEN
        IF
        0AB1: @GetDialogCaption 1 SampVersionID [email protected] _Return: caption [email protected]
        THEN
            0AC8: [email protected] = allocate_memory_size 260
            0AB1: @DeleteColorCodeFromText 4 text [email protected] FirstCharacter 123 SecondCharacter 125  memory_to_store_characters_as_text [email protected]
            IF
            0AB1: @IfTextContains 2 String1 [email protected] String2 [email protected] _returned: Text [email protected]
            THEN
                0AB1: @CloseCurrentDialogWithButton 2 SampVersionID [email protected] Button 1 // 1 = Left , 0 = Right
            END
        END
    END
END

END

:get_samp_version_id
// 0AB1: @get_samp_version_id 0 _returned: id [email protected]
[email protected] = 0
IF 0AA2: [email protected] = load_library "samp.dll" // IF and SET
THEN
    [email protected] += 0x128
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1
    IF [email protected] == 0x5542F47A
    THEN // 0.3.7 R1
        [email protected] = 1
    END

    IF [email protected] == 0x59C30C94
    THEN // 0.3.7 R2
        [email protected] = 2
    END

    IF [email protected] == 0x5A6A3130
    THEN // 0.3.DL
        [email protected] = 3
    END

    [email protected] -= 8 // reading samp.dll + 0x120
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1

    IF [email protected] == 0x5C0B4243
    THEN // 0.3.7 R3
        [email protected] = 4
    END

    IF [email protected] == 0x5DD606CD
    THEN // 0.3.7 R4
        [email protected] = 5
    END
END
0AB2: ret 1 [email protected]

:isDialogOpen
// 0AB1: @isDialogOpen 1 SampVersionID [email protected]
0AA2: [email protected] = "samp.dll"
IF [email protected] == 1 // 0.3.7 R1
THEN      
    0A8E: [email protected] = [email protected] + 0x21A0B8
END
IF [email protected] == 2 // 0.3.7 R2
THEN      
    0A8E: [email protected] = [email protected] + 0x21A0C0
END

IF [email protected] == 3 // 0.3.DL
THEN      
    0A8E: [email protected] = [email protected] + 0x2AC9E0
END

IF [email protected] == 4 // 0.3.7 R3
THEN      
    0A8E: [email protected] = [email protected] + 0x26E898
END

IF [email protected] == 5 // 0.3.7 R4
THEN      
    0A8E: [email protected] = [email protected] + 0x26E9C8
END
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
0A8E: [email protected] = [email protected] + 0x28
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
IF [email protected] == 1
THEN
    0485: dialog_open
ELSE
    059A: dialog_closed
END
0AB2: ret 0

:GetDialogCaption
// 0AB1: @GetDialogCaption 1 SampVersionID [email protected] _Returned: caption [email protected]
0AA2: [email protected] = "samp.dll"
IF [email protected] == 1 // 0.3.7 R1
THEN      
    0A8E: [email protected] = [email protected] + 0x21A0B8
END
IF [email protected] == 2 // 0.3.7 R2
THEN      
    0A8E: [email protected] = [email protected] + 0x21A0C0
END

IF [email protected] == 3 // 0.3.DL
THEN      
    0A8E: [email protected] = [email protected] + 0x2AC9E0
END

IF [email protected] == 4 // 0.3.7 R3
THEN      
    0A8E: [email protected] = [email protected] + 0x26E898
END

IF [email protected] == 5 // 0.3.7 R4
THEN      
    0A8E: [email protected] = [email protected] + 0x26E9C8
END
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
0A8E: [email protected] = [email protected] + 0x28 //DialogOpenOffset
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
IF [email protected] == 1 // Dialog open
THEN
    0A8E: [email protected] = [email protected] + 0x40 //DialogCaptionOffset
    0485: dialog_open
    0AB2: ret 1 [email protected]
ELSE
    059A:  dialog closed
END
0AB2: ret 0

:GetDialogText
// 0AB1: @GetDialogText 1 SampVersionID [email protected] _Returned: text [email protected]
0AA2: [email protected] = "samp.dll"
IF [email protected] == 1 // 0.3.7 R1
THEN      
    0A8E: [email protected] = [email protected] + 0x21A0B8
END
IF [email protected] == 2 // 0.3.7 R2
THEN      
    0A8E: [email protected] = [email protected] + 0x21A0C0
END

IF [email protected] == 3 // 0.3.DL
THEN      
    0A8E: [email protected] = [email protected] + 0x2AC9E0
END

IF [email protected] == 4 // 0.3.7 R3
THEN      
    0A8E: [email protected] = [email protected] + 0x26E898
END

IF [email protected] == 5 // 0.3.7 R4
THEN      
    0A8E: [email protected] = [email protected] + 0x26E9C8
END
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
0A8E: [email protected] = [email protected] + 0x28 //DialogOpenOffset
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
if [email protected] == 1 // Dialog active
then
    0A8E: [email protected] = [email protected] + 0x2C //DialogTypeOffset
    0A8D: [email protected] = readMem [email protected] sz 4 vp 0
    if or
    [email protected] == 0 // DIALOG_STYLE_MSGBOX
    [email protected] == 1 // DIALOG_STYLE_INPUT
    [email protected] == 3 // DIALOG_STYLE_PASSWORD
    then
        0A8E: [email protected] = [email protected] + 0x34 // DialogTextOffset
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0485: dialog_open
        0AB2: ret 1 [email protected]
    else 059A:  dialog closed
    end
end
0AB2: ret 0

:CloseCurrentDialogWithButton
// 0AB1: @CloseCurrentDialogWithButton 2 SampVersionID [email protected] Button 1 // 1 = Left , 0 = Right
IF 0AA2: [email protected] = "samp.dll"
THEN
    IF [email protected] == 1 // 0.3.7 R1
    THEN
        0A8E: [email protected] = [email protected] + 0x21A0B8 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x6C040 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 2 // 0.3.7 R2
    THEN
        0A8E: [email protected] = [email protected] + 0x21A0C0 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x6C0F0 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 3 // 0.3.DL
    THEN
        0A8E: [email protected] = [email protected] + 0x2AC9E0 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x700D0 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 4 // 0.3.7 R3
    THEN
        0A8E: [email protected] = [email protected] + 0x26E898 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x6FF40 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 5 // 0.3.7 R4
    THEN
        0A8E: [email protected] = [email protected] + 0x26E9C8 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x70660 //SAMP_DIALOG_CLOSE
    END

    0AA8: call_function_method [email protected] struct [email protected] num_params 1 pop 0 Button [email protected] _retVal [email protected]
END
0AB2: 0

:IfTextContains
//0AB1: @IfTextContains 2 String1 [email protected] String2 [email protected]
0AB1: @strlen 1 string [email protected] _length [email protected]
0AB1: @strlen 1 string [email protected] _length [email protected]

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

[email protected] -= 1
[email protected] = 0 // counter of the same chars in a row
for [email protected] = 0 to [email protected] // for each char of the main text  ([email protected] = index)
    0085: [email protected] = [email protected] // (int)
    005A: [email protected] += [email protected]  // (int)
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

    0085: [email protected] = [email protected] // (int)
    005A: [email protected] += [email protected]  // (int)
    0A8D: [email protected] = read_memory 23@ size 1 virtual_protect 0

    if 003B:   [email protected] == [email protected]  // (int)
    then
    [email protected]++
        if 002D:   [email protected] >= [email protected]  // (int)
        then
        0485:  return_true
        0062: [email protected] -= [email protected]  // (int)
        [email protected] += 1
        0AB2: ret 1 [email protected]
        end
    else
        if [email protected] > 0
        then
        [email protected] //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
    [email protected] = 0
    end
end

059A:  return_false
0AB2: ret 1 0

:DeleteColorCodeFromText
{
    0AB1: @DeleteColorCodeFromText 4 text [email protected] FirstCharacter 91 SecondCharacter 93  memory_to_store_characters_as_text [email protected]
    In: [email protected] = text , FirstCharacter , SecondCharacter
    Out: [email protected] = pointer to memory where characters will be stored as text
}
[email protected] = FALSE // inbracket
0AB1: @strlen 1 string [email protected] _length [email protected]
    for [email protected] = 0 to [email protected]
        0085: [email protected] = [email protected] // copy pointer
        005A: [email protected] += [email protected]  // add offset make loop
        0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 1 // [email protected] is the ascii number representing character
        if
        003B:   [email protected] == [email protected]  // (int)
        then
            [email protected] = TRUE // inbracket
        end

        if
        [email protected] == FALSE // inbracket
        THEN
            0A8C: write_memory [email protected] size 1 value [email protected] virtual_protect 1
            [email protected] += 1 // move to next address
        END

        if
        003B:   [email protected] == [email protected]  // (int)
        then
            [email protected] = FALSE // inbracket
        end
    end
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0

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

bye

Well-Known Member
Joined
Sep 15, 2013
Messages
57
Likes
0
Points
111
#25
PHP:
{$CLEO .cs}

0000:

repeat
wait 0
until 0AA2: [email protected] = "samp.dll"

0AC8: [email protected] = allocate_memory_size 260
0AD3: [email protected] = format "Sign check"

0AB1: @get_samp_version_id 0 _Returned: ID [email protected]

WHILE TRUE
WAIT 0

IF
0256:   player $PLAYER_CHAR defined
THEN
    IF
    0AB1: @isDialogOpen 1 SampVersionID [email protected]
    THEN
        IF
        0AB1: @GetDialogCaption 1 SampVersionID [email protected] _Return: caption [email protected]
        THEN
            0AC8: [email protected] = allocate_memory_size 260
            0AB1: @DeleteColorCodeFromText 4 text [email protected] FirstCharacter 123 SecondCharacter 125  memory_to_store_characters_as_text [email protected]
            IF
            0AB1: @IfTextContains 2 String1 [email protected] String2 [email protected] _returned: Text [email protected]
            THEN
                0AB1: @CloseCurrentDialogWithButton 2 SampVersionID [email protected] Button 1 // 1 = Left , 0 = Right
            END
        END
    END
END

END

:get_samp_version_id
// 0AB1: @get_samp_version_id 0 _returned: id [email protected]
[email protected] = 0
IF 0AA2: [email protected] = load_library "samp.dll" // IF and SET
THEN
    [email protected] += 0x128
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1
    IF [email protected] == 0x5542F47A
    THEN // 0.3.7 R1
        [email protected] = 1
    END

    IF [email protected] == 0x59C30C94
    THEN // 0.3.7 R2
        [email protected] = 2
    END

    IF [email protected] == 0x5A6A3130
    THEN // 0.3.DL
        [email protected] = 3
    END

    [email protected] -= 8 // reading samp.dll + 0x120
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1

    IF [email protected] == 0x5C0B4243
    THEN // 0.3.7 R3
        [email protected] = 4
    END

    IF [email protected] == 0x5DD606CD
    THEN // 0.3.7 R4
        [email protected] = 5
    END
END
0AB2: ret 1 [email protected]

:isDialogOpen
// 0AB1: @isDialogOpen 1 SampVersionID [email protected]
0AA2: [email protected] = "samp.dll"
IF [email protected] == 1 // 0.3.7 R1
THEN
    0A8E: [email protected] = [email protected] + 0x21A0B8
END
IF [email protected] == 2 // 0.3.7 R2
THEN
    0A8E: [email protected] = [email protected] + 0x21A0C0
END

IF [email protected] == 3 // 0.3.DL
THEN
    0A8E: [email protected] = [email protected] + 0x2AC9E0
END

IF [email protected] == 4 // 0.3.7 R3
THEN
    0A8E: [email protected] = [email protected] + 0x26E898
END

IF [email protected] == 5 // 0.3.7 R4
THEN
    0A8E: [email protected] = [email protected] + 0x26E9C8
END
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
0A8E: [email protected] = [email protected] + 0x28
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
IF [email protected] == 1
THEN
    0485: dialog_open
ELSE
    059A: dialog_closed
END
0AB2: ret 0

:GetDialogCaption
// 0AB1: @GetDialogCaption 1 SampVersionID [email protected] _Returned: caption [email protected]
0AA2: [email protected] = "samp.dll"
IF [email protected] == 1 // 0.3.7 R1
THEN
    0A8E: [email protected] = [email protected] + 0x21A0B8
END
IF [email protected] == 2 // 0.3.7 R2
THEN
    0A8E: [email protected] = [email protected] + 0x21A0C0
END

IF [email protected] == 3 // 0.3.DL
THEN
    0A8E: [email protected] = [email protected] + 0x2AC9E0
END

IF [email protected] == 4 // 0.3.7 R3
THEN
    0A8E: [email protected] = [email protected] + 0x26E898
END

IF [email protected] == 5 // 0.3.7 R4
THEN
    0A8E: [email protected] = [email protected] + 0x26E9C8
END
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
0A8E: [email protected] = [email protected] + 0x28 //DialogOpenOffset
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
IF [email protected] == 1 // Dialog open
THEN
    0A8E: [email protected] = [email protected] + 0x40 //DialogCaptionOffset
    0485: dialog_open
    0AB2: ret 1 [email protected]
ELSE
    059A:  dialog closed
END
0AB2: ret 0

:GetDialogText
// 0AB1: @GetDialogText 1 SampVersionID [email protected] _Returned: text [email protected]
0AA2: [email protected] = "samp.dll"
IF [email protected] == 1 // 0.3.7 R1
THEN
    0A8E: [email protected] = [email protected] + 0x21A0B8
END
IF [email protected] == 2 // 0.3.7 R2
THEN
    0A8E: [email protected] = [email protected] + 0x21A0C0
END

IF [email protected] == 3 // 0.3.DL
THEN
    0A8E: [email protected] = [email protected] + 0x2AC9E0
END

IF [email protected] == 4 // 0.3.7 R3
THEN
    0A8E: [email protected] = [email protected] + 0x26E898
END

IF [email protected] == 5 // 0.3.7 R4
THEN
    0A8E: [email protected] = [email protected] + 0x26E9C8
END
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
0A8E: [email protected] = [email protected] + 0x28 //DialogOpenOffset
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
if [email protected] == 1 // Dialog active
then
    0A8E: [email protected] = [email protected] + 0x2C //DialogTypeOffset
    0A8D: [email protected] = readMem [email protected] sz 4 vp 0
    if or
    [email protected] == 0 // DIALOG_STYLE_MSGBOX
    [email protected] == 1 // DIALOG_STYLE_INPUT
    [email protected] == 3 // DIALOG_STYLE_PASSWORD
    then
        0A8E: [email protected] = [email protected] + 0x34 // DialogTextOffset
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0485: dialog_open
        0AB2: ret 1 [email protected]
    else 059A:  dialog closed
    end
end
0AB2: ret 0

:CloseCurrentDialogWithButton
// 0AB1: @CloseCurrentDialogWithButton 2 SampVersionID [email protected] Button 1 // 1 = Left , 0 = Right
IF 0AA2: [email protected] = "samp.dll"
THEN
    IF [email protected] == 1 // 0.3.7 R1
    THEN
        0A8E: [email protected] = [email protected] + 0x21A0B8 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x6C040 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 2 // 0.3.7 R2
    THEN
        0A8E: [email protected] = [email protected] + 0x21A0C0 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x6C0F0 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 3 // 0.3.DL
    THEN
        0A8E: [email protected] = [email protected] + 0x2AC9E0 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x700D0 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 4 // 0.3.7 R3
    THEN
        0A8E: [email protected] = [email protected] + 0x26E898 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x6FF40 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 5 // 0.3.7 R4
    THEN
        0A8E: [email protected] = [email protected] + 0x26E9C8 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x70660 //SAMP_DIALOG_CLOSE
    END

    0AA8: call_function_method [email protected] struct [email protected] num_params 1 pop 0 Button [email protected] _retVal [email protected]
END
0AB2: 0

:IfTextContains
//0AB1: @IfTextContains 2 String1 [email protected] String2 [email protected]
0AB1: @strlen 1 string [email protected] _length [email protected]
0AB1: @strlen 1 string [email protected] _length [email protected]

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

[email protected] -= 1
[email protected] = 0 // counter of the same chars in a row
for [email protected] = 0 to [email protected] // for each char of the main text  ([email protected] = index)
    0085: [email protected] = [email protected] // (int)
    005A: [email protected] += [email protected]  // (int)
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

    0085: [email protected] = [email protected] // (int)
    005A: [email protected] += [email protected]  // (int)
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

    if 003B:   [email protected] == [email protected]  // (int)
    then
    [email protected]++
        if 002D:   [email protected] >= [email protected]  // (int)
        then
        0485:  return_true
        0062: [email protected] -= [email protected]  // (int)
        [email protected] += 1
        0AB2: ret 1 [email protected]
        end
    else
        if [email protected] > 0
        then
        [email protected] //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
    [email protected] = 0
    end
end

059A:  return_false
0AB2: ret 1 0

:DeleteColorCodeFromText
{
    0AB1: @DeleteColorCodeFromText 4 text [email protected] FirstCharacter 91 SecondCharacter 93  memory_to_store_characters_as_text [email protected]
    In: [email protected] = text , FirstCharacter , SecondCharacter
    Out: [email protected] = pointer to memory where characters will be stored as text
}
[email protected] = FALSE // inbracket
0AB1: @strlen 1 string [email protected] _length [email protected]
    for [email protected] = 0 to [email protected]
        0085: [email protected] = [email protected] // copy pointer
        005A: [email protected] += [email protected]  // add offset make loop
        0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 1 // [email protected] is the ascii number representing character
        if
        003B:   [email protected] == [email protected]  // (int)
        then
            [email protected] = TRUE // inbracket
        end

        if
        [email protected] == FALSE // inbracket
        THEN
            0A8C: write_memory [email protected] size 1 value [email protected] virtual_protect 1
            [email protected] += 1 // move to next address
        END

        if
        003B:   [email protected] == [email protected]  // (int)
        then
            [email protected] = FALSE // inbracket
        end
    end
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0

:strlen
// 0AB1: @strlen 1 string [email protected] _return: size [email protected]
for [email protected] = 0 to 1024
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0
    if not [email protected] == 0
    jf break
    [email protected] += 1
end
0AB2: ret 1 [email protected]
Thanks for helping me.
Some problems here, I can't login. remember i need this cleo to only works when the dialog box i told you is displayed.

I am using sampfuncsV 5.3.1
Cleo V 4.3

Samp V 0.3.7
 
Last edited:
OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
2,143
Likes
385
Points
113
Location
Lithuania
Website
ugbase.eu
20
#26
Thanks for helping me.
Some problems here, I can't login. remember i need this cleo to only works when the dialog box i told you is displayed.

I am using sampfuncsV 5.3.1
Cleo V 4.3

Samp V 0.3.7

PHP:
{$CLEO .cs}

0000:

Wait 8500

0AC8: [email protected] = allocate_memory_size 260
0AD3: [email protected] = format "My dialog caption"

WHILE TRUE
WAIT 0

IF
0256:   player $PLAYER_CHAR defined
THEN
0AB1: @get_samp_version_id 0 _Returned: ID [email protected]
    IF
    0AB1: @isDialogOpen 1 SampVersionID [email protected]
    THEN
        IF
        0AB1: @GetDialogCaption 1 SampVersionID [email protected] _Return: caption [email protected]
        THEN
            0AC8: [email protected] = allocate_memory_size 260
            0AB1: @DeleteColorCodeFromText 4 text [email protected] FirstCharacter 123 SecondCharacter 125  memory_to_store_characters_as_text [email protected]
            IF
            0AB1: @IfTextContains 2 String1 [email protected] String2 [email protected] _returned: Text [email protected]
            THEN
                0AB1: @CloseCurrentDialogWithButton 2 SampVersionID [email protected] Button 1 // 1 = Left , 0 = Right
            END
        END
    END
END

END

:get_samp_version_id
// 0AB1: @get_samp_version_id 0 _returned: id [email protected]
[email protected] = 0
IF 0AA2: [email protected] = load_library "samp.dll" // IF and SET
THEN
    [email protected] += 0x128
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1
    IF [email protected] == 0x5542F47A
    THEN // 0.3.7 R1
        [email protected] = 1
    END

    IF [email protected] == 0x59C30C94
    THEN // 0.3.7 R2
        [email protected] = 2
    END

    IF [email protected] == 0x5A6A3130
    THEN // 0.3.DL
        [email protected] = 3
    END

    [email protected] -= 8 // reading samp.dll + 0x120
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1

    IF [email protected] == 0x5C0B4243
    THEN // 0.3.7 R3
        [email protected] = 4
    END

    IF [email protected] == 0x5DD606CD
    THEN // 0.3.7 R4
        [email protected] = 5
    END
END
0AB2: ret 1 [email protected]

:isDialogOpen
// 0AB1: @isDialogOpen 1 SampVersionID [email protected]
0AA2: [email protected] = "samp.dll"
IF [email protected] == 1 // 0.3.7 R1
THEN    
    0A8E: [email protected] = [email protected] + 0x21A0B8
END
IF [email protected] == 2 // 0.3.7 R2
THEN    
    0A8E: [email protected] = [email protected] + 0x21A0C0
END

IF [email protected] == 3 // 0.3.DL
THEN    
    0A8E: [email protected] = [email protected] + 0x2AC9E0
END

IF [email protected] == 4 // 0.3.7 R3
THEN    
    0A8E: [email protected] = [email protected] + 0x26E898
END

IF [email protected] == 5 // 0.3.7 R4
THEN    
    0A8E: [email protected] = [email protected] + 0x26E9C8
END
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
0A8E: [email protected] = [email protected] + 0x28
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
IF [email protected] == 1
THEN
    0485: dialog_open
ELSE
    059A: dialog_closed
END
0AB2: ret 0

:GetDialogCaption
// 0AB1: @GetDialogCaption 1 SampVersionID [email protected] _Returned: caption [email protected]
0AA2: [email protected] = "samp.dll"
IF [email protected] == 1 // 0.3.7 R1
THEN    
    0A8E: [email protected] = [email protected] + 0x21A0B8
END
IF [email protected] == 2 // 0.3.7 R2
THEN    
    0A8E: [email protected] = [email protected] + 0x21A0C0
END

IF [email protected] == 3 // 0.3.DL
THEN    
    0A8E: [email protected] = [email protected] + 0x2AC9E0
END

IF [email protected] == 4 // 0.3.7 R3
THEN    
    0A8E: [email protected] = [email protected] + 0x26E898
END

IF [email protected] == 5 // 0.3.7 R4
THEN    
    0A8E: [email protected] = [email protected] + 0x26E9C8
END
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
0A8E: [email protected] = [email protected] + 0x28 //DialogOpenOffset
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
IF [email protected] == 1 // Dialog open
THEN
    0A8E: [email protected] = [email protected] + 0x40 //DialogCaptionOffset
    0485: dialog_open
    0AB2: ret 1 [email protected]
ELSE
    059A:  dialog closed
END
0AB2: ret 0

:GetDialogText
// 0AB1: @GetDialogText 1 SampVersionID [email protected] _Returned: text [email protected]
0AA2: [email protected] = "samp.dll"
IF [email protected] == 1 // 0.3.7 R1
THEN    
    0A8E: [email protected] = [email protected] + 0x21A0B8
END
IF [email protected] == 2 // 0.3.7 R2
THEN    
    0A8E: [email protected] = [email protected] + 0x21A0C0
END

IF [email protected] == 3 // 0.3.DL
THEN    
    0A8E: [email protected] = [email protected] + 0x2AC9E0
END

IF [email protected] == 4 // 0.3.7 R3
THEN    
    0A8E: [email protected] = [email protected] + 0x26E898
END

IF [email protected] == 5 // 0.3.7 R4
THEN    
    0A8E: [email protected] = [email protected] + 0x26E9C8
END
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
0A8E: [email protected] = [email protected] + 0x28 //DialogOpenOffset
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
if [email protected] == 1 // Dialog active
then
    0A8E: [email protected] = [email protected] + 0x2C //DialogTypeOffset
    0A8D: [email protected] = readMem [email protected] sz 4 vp 0
    if or
    [email protected] == 0 // DIALOG_STYLE_MSGBOX
    [email protected] == 1 // DIALOG_STYLE_INPUT
    [email protected] == 3 // DIALOG_STYLE_PASSWORD
    then
        0A8E: [email protected] = [email protected] + 0x34 // DialogTextOffset
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0485: dialog_open
        0AB2: ret 1 [email protected]
    else 059A:  dialog closed
    end
end
0AB2: ret 0

:CloseCurrentDialogWithButton
// 0AB1: @CloseCurrentDialogWithButton 2 SampVersionID [email protected] Button 1 // 1 = Left , 0 = Right
IF 0AA2: [email protected] = "samp.dll"
THEN
    IF [email protected] == 1 // 0.3.7 R1
    THEN
        0A8E: [email protected] = [email protected] + 0x21A0B8 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x6C040 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 2 // 0.3.7 R2
    THEN
        0A8E: [email protected] = [email protected] + 0x21A0C0 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x6C0F0 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 3 // 0.3.DL
    THEN
        0A8E: [email protected] = [email protected] + 0x2AC9E0 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x700D0 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 4 // 0.3.7 R3
    THEN
        0A8E: [email protected] = [email protected] + 0x26E898 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x6FF40 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 5 // 0.3.7 R4
    THEN
        0A8E: [email protected] = [email protected] + 0x26E9C8 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x70660 //SAMP_DIALOG_CLOSE
    END

    0AA8: call_function_method [email protected] struct [email protected] num_params 1 pop 0 Button [email protected] _retVal [email protected]
END
0AB2: 0

:IfTextContains
//0AB1: @IfTextContains 2 String1 [email protected] String2 [email protected]
0AB1: @strlen 1 string [email protected] _length [email protected]
0AB1: @strlen 1 string [email protected] _length [email protected]

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

[email protected] -= 1
[email protected] = 0 // counter of the same chars in a row
for [email protected] = 0 to [email protected] // for each char of the main text  ([email protected] = index)
    0085: [email protected] = [email protected] // (int)
    005A: [email protected] += [email protected]  // (int)
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

    0085: [email protected] = [email protected] // (int)
    005A: [email protected] += [email protected]  // (int)
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

    if 003B:   [email protected] == [email protected]  // (int)
    then
    [email protected]++
        if 002D:   [email protected] >= [email protected]  // (int)
        then
        0485:  return_true
        0062: [email protected] -= [email protected]  // (int)
        [email protected] += 1
        0AB2: ret 1 [email protected]
        end
    else
        if [email protected] > 0
        then
        [email protected] //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
    [email protected] = 0
    end
end

059A:  return_false
0AB2: ret 1 0

:DeleteColorCodeFromText
{
    0AB1: @DeleteColorCodeFromText 4 text [email protected] FirstCharacter 91 SecondCharacter 93  memory_to_store_characters_as_text [email protected]
    In: [email protected] = text , FirstCharacter , SecondCharacter
    Out: [email protected] = pointer to memory where characters will be stored as text
}
[email protected] = FALSE // inbracket
0AB1: @strlen 1 string [email protected] _length [email protected]
    for [email protected] = 0 to [email protected]
        0085: [email protected] = [email protected] // copy pointer
        005A: [email protected] += [email protected]  // add offset make loop
        0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 1 // [email protected] is the ascii number representing character
        if
        003B:   [email protected] == [email protected]  // (int)
        then
            [email protected] = TRUE // inbracket
        end

        if
        [email protected] == FALSE // inbracket
        THEN
            0A8C: write_memory [email protected] size 1 value [email protected] virtual_protect 1
            [email protected] += 1 // move to next address
        END

        if
        003B:   [email protected] == [email protected]  // (int)
        then
            [email protected] = FALSE // inbracket
        end
    end
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0

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

bye

Well-Known Member
Joined
Sep 15, 2013
Messages
57
Likes
0
Points
111
#27
PHP:
{$CLEO .cs}

0000:

Wait 8500

0AC8: [email protected] = allocate_memory_size 260
0AD3: [email protected] = format "My dialog caption"

WHILE TRUE
WAIT 0

IF
0256:   player $PLAYER_CHAR defined
THEN
0AB1: @get_samp_version_id 0 _Returned: ID [email protected]
    IF
    0AB1: @isDialogOpen 1 SampVersionID [email protected]
    THEN
        IF
        0AB1: @GetDialogCaption 1 SampVersionID [email protected] _Return: caption [email protected]
        THEN
            0AC8: [email protected] = allocate_memory_size 260
            0AB1: @DeleteColorCodeFromText 4 text [email protected] FirstCharacter 123 SecondCharacter 125  memory_to_store_characters_as_text [email protected]
            IF
            0AB1: @IfTextContains 2 String1 [email protected] String2 [email protected] _returned: Text [email protected]
            THEN
                0AB1: @CloseCurrentDialogWithButton 2 SampVersionID [email protected] Button 1 // 1 = Left , 0 = Right
            END
        END
    END
END

END

:get_samp_version_id
// 0AB1: @get_samp_version_id 0 _returned: id [email protected]
[email protected] = 0
IF 0AA2: [email protected] = load_library "samp.dll" // IF and SET
THEN
    [email protected] += 0x128
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1
    IF [email protected] == 0x5542F47A
    THEN // 0.3.7 R1
        [email protected] = 1
    END

    IF [email protected] == 0x59C30C94
    THEN // 0.3.7 R2
        [email protected] = 2
    END

    IF [email protected] == 0x5A6A3130
    THEN // 0.3.DL
        [email protected] = 3
    END

    [email protected] -= 8 // reading samp.dll + 0x120
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1

    IF [email protected] == 0x5C0B4243
    THEN // 0.3.7 R3
        [email protected] = 4
    END

    IF [email protected] == 0x5DD606CD
    THEN // 0.3.7 R4
        [email protected] = 5
    END
END
0AB2: ret 1 [email protected]

:isDialogOpen
// 0AB1: @isDialogOpen 1 SampVersionID [email protected]
0AA2: [email protected] = "samp.dll"
IF [email protected] == 1 // 0.3.7 R1
THEN
    0A8E: [email protected] = [email protected] + 0x21A0B8
END
IF [email protected] == 2 // 0.3.7 R2
THEN
    0A8E: [email protected] = [email protected] + 0x21A0C0
END

IF [email protected] == 3 // 0.3.DL
THEN
    0A8E: [email protected] = [email protected] + 0x2AC9E0
END

IF [email protected] == 4 // 0.3.7 R3
THEN
    0A8E: [email protected] = [email protected] + 0x26E898
END

IF [email protected] == 5 // 0.3.7 R4
THEN
    0A8E: [email protected] = [email protected] + 0x26E9C8
END
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
0A8E: [email protected] = [email protected] + 0x28
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
IF [email protected] == 1
THEN
    0485: dialog_open
ELSE
    059A: dialog_closed
END
0AB2: ret 0

:GetDialogCaption
// 0AB1: @GetDialogCaption 1 SampVersionID [email protected] _Returned: caption [email protected]
0AA2: [email protected] = "samp.dll"
IF [email protected] == 1 // 0.3.7 R1
THEN
    0A8E: [email protected] = [email protected] + 0x21A0B8
END
IF [email protected] == 2 // 0.3.7 R2
THEN
    0A8E: [email protected] = [email protected] + 0x21A0C0
END

IF [email protected] == 3 // 0.3.DL
THEN
    0A8E: [email protected] = [email protected] + 0x2AC9E0
END

IF [email protected] == 4 // 0.3.7 R3
THEN
    0A8E: [email protected] = [email protected] + 0x26E898
END

IF [email protected] == 5 // 0.3.7 R4
THEN
    0A8E: [email protected] = [email protected] + 0x26E9C8
END
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
0A8E: [email protected] = [email protected] + 0x28 //DialogOpenOffset
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
IF [email protected] == 1 // Dialog open
THEN
    0A8E: [email protected] = [email protected] + 0x40 //DialogCaptionOffset
    0485: dialog_open
    0AB2: ret 1 [email protected]
ELSE
    059A:  dialog closed
END
0AB2: ret 0

:GetDialogText
// 0AB1: @GetDialogText 1 SampVersionID [email protected] _Returned: text [email protected]
0AA2: [email protected] = "samp.dll"
IF [email protected] == 1 // 0.3.7 R1
THEN
    0A8E: [email protected] = [email protected] + 0x21A0B8
END
IF [email protected] == 2 // 0.3.7 R2
THEN
    0A8E: [email protected] = [email protected] + 0x21A0C0
END

IF [email protected] == 3 // 0.3.DL
THEN
    0A8E: [email protected] = [email protected] + 0x2AC9E0
END

IF [email protected] == 4 // 0.3.7 R3
THEN
    0A8E: [email protected] = [email protected] + 0x26E898
END

IF [email protected] == 5 // 0.3.7 R4
THEN
    0A8E: [email protected] = [email protected] + 0x26E9C8
END
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
0A8E: [email protected] = [email protected] + 0x28 //DialogOpenOffset
0A8D: [email protected] = readMem [email protected] sz 4 vp 0
if [email protected] == 1 // Dialog active
then
    0A8E: [email protected] = [email protected] + 0x2C //DialogTypeOffset
    0A8D: [email protected] = readMem [email protected] sz 4 vp 0
    if or
    [email protected] == 0 // DIALOG_STYLE_MSGBOX
    [email protected] == 1 // DIALOG_STYLE_INPUT
    [email protected] == 3 // DIALOG_STYLE_PASSWORD
    then
        0A8E: [email protected] = [email protected] + 0x34 // DialogTextOffset
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0485: dialog_open
        0AB2: ret 1 [email protected]
    else 059A:  dialog closed
    end
end
0AB2: ret 0

:CloseCurrentDialogWithButton
// 0AB1: @CloseCurrentDialogWithButton 2 SampVersionID [email protected] Button 1 // 1 = Left , 0 = Right
IF 0AA2: [email protected] = "samp.dll"
THEN
    IF [email protected] == 1 // 0.3.7 R1
    THEN
        0A8E: [email protected] = [email protected] + 0x21A0B8 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x6C040 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 2 // 0.3.7 R2
    THEN
        0A8E: [email protected] = [email protected] + 0x21A0C0 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x6C0F0 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 3 // 0.3.DL
    THEN
        0A8E: [email protected] = [email protected] + 0x2AC9E0 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x700D0 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 4 // 0.3.7 R3
    THEN
        0A8E: [email protected] = [email protected] + 0x26E898 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x6FF40 //SAMP_DIALOG_CLOSE
    END

    IF [email protected] == 5 // 0.3.7 R4
    THEN
        0A8E: [email protected] = [email protected] + 0x26E9C8 // SAMP_DIALOG_INFO_OFFSET
        0A8D: [email protected] = readMem [email protected] sz 4 vp 0
        0A8E: [email protected] = [email protected] + 0x70660 //SAMP_DIALOG_CLOSE
    END

    0AA8: call_function_method [email protected] struct [email protected] num_params 1 pop 0 Button [email protected] _retVal [email protected]
END
0AB2: 0

:IfTextContains
//0AB1: @IfTextContains 2 String1 [email protected] String2 [email protected]
0AB1: @strlen 1 string [email protected] _length [email protected]
0AB1: @strlen 1 string [email protected] _length [email protected]

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

[email protected] -= 1
[email protected] = 0 // counter of the same chars in a row
for [email protected] = 0 to [email protected] // for each char of the main text  ([email protected] = index)
    0085: [email protected] = [email protected] // (int)
    005A: [email protected] += [email protected]  // (int)
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

    0085: [email protected] = [email protected] // (int)
    005A: [email protected] += [email protected]  // (int)
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

    if 003B:   [email protected] == [email protected]  // (int)
    then
    [email protected]++
        if 002D:   [email protected] >= [email protected]  // (int)
        then
        0485:  return_true
        0062: [email protected] -= [email protected]  // (int)
        [email protected] += 1
        0AB2: ret 1 [email protected]
        end
    else
        if [email protected] > 0
        then
        [email protected] //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
    [email protected] = 0
    end
end

059A:  return_false
0AB2: ret 1 0

:DeleteColorCodeFromText
{
    0AB1: @DeleteColorCodeFromText 4 text [email protected] FirstCharacter 91 SecondCharacter 93  memory_to_store_characters_as_text [email protected]
    In: [email protected] = text , FirstCharacter , SecondCharacter
    Out: [email protected] = pointer to memory where characters will be stored as text
}
[email protected] = FALSE // inbracket
0AB1: @strlen 1 string [email protected] _length [email protected]
    for [email protected] = 0 to [email protected]
        0085: [email protected] = [email protected] // copy pointer
        005A: [email protected] += [email protected]  // add offset make loop
        0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 1 // [email protected] is the ascii number representing character
        if
        003B:   [email protected] == [email protected]  // (int)
        then
            [email protected] = TRUE // inbracket
        end

        if
        [email protected] == FALSE // inbracket
        THEN
            0A8C: write_memory [email protected] size 1 value [email protected] virtual_protect 1
            [email protected] += 1 // move to next address
        END

        if
        003B:   [email protected] == [email protected]  // (int)
        then
            [email protected] = FALSE // inbracket
        end
    end
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0

:strlen
// 0AB1: @strlen 1 string [email protected] _return: size [email protected]
for [email protected] = 0 to 1024
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0
    if not [email protected] == 0
    jf break
    [email protected] += 1
end
0AB2: ret 1 [email protected]
Thank you very much for your support.

H O N O R S.

P E R F E C T.

T H A N K S.
 
Last edited:
Joined
Jun 12, 2020
Messages
9
Likes
0
Points
1
Location
Turkey
1
#28
...
Sign Check - Chat 2

Source samp 0.3.7 R*- 0.3.DL:
PHP:
{$CLEO .cs}

0000: NOP

wait 8500

while true
wait 0

if
0256:   player $PLAYER_CHAR defined
then
    0AB1: @get_samp_version_id 0 _Returned: ID [email protected]
    for [email protected] = 95 to 99
        0AC8: [email protected] = allocate_memory_size 260
        0AB1: @getChatEntryText 2 SampVersionID [email protected] ChatLineID [email protected]  _Returned: text [email protected]
        0AC8: [email protected] = allocate_memory_size 260
        0AB1: @DeleteColorCodeFromText 4 text [email protected] FirstCharacter 123 SecondCharacter 125 memory_to_store_characters_as_text [email protected]
        0AC8: [email protected] = allocate_memory_size 260
        0AD3: [email protected] = "/signcheck"   // Check / find text
        if
        0AB1: @IfTextContains 2 String1 [email protected] String2 [email protected] _returned: text [email protected]
        then
            0AC8: [email protected] = allocate_memory_size 260
            0AB1: @get_digits_to_print param_count 2 text [email protected] memory_to_store_digits_as_text [email protected]
            0AC8: [email protected] = allocate_memory_size 260
            0AD3: [email protected] "/signcheck %s" [email protected]   // CMD
            0AB1: @SEND_CMD 2 SampVersionID [email protected] text [email protected]
            wait 10000 // anti spam
        end
    end
end

end

:get_samp_version_id
// 0AB1: @get_samp_version_id 0 _returned: id [email protected]
[email protected] = 0
IF 0AA2: [email protected] = load_library "samp.dll" // IF and SET
THEN
    [email protected] += 0x128
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1
    IF [email protected] == 0x5542F47A
    THEN // 0.3.7 R1
        [email protected] = 1
    END

    IF [email protected] == 0x59C30C94
    THEN // 0.3.7 R2
        [email protected] = 2
    END

    IF [email protected] == 0x5A6A3130
    THEN // 0.3.DL
        [email protected] = 3
    END

    [email protected] -= 8 // reading samp.dll + 0x120
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1

    IF [email protected] == 0x5C0B4243
    THEN // 0.3.7 R3
        [email protected] = 4
    END

    IF [email protected] == 0x5DD606CD
    THEN // 0.3.7 R4
        [email protected] = 5
    END
END
0AB2: ret 1 [email protected]

:GetChatEntryText
{
    0AC8: [email protected] = allocate_memory_size 260
    0AB1: @getChatEntryText 2 SampVersionID [email protected] ChatLineID 99  _Returned: text [email protected]
}
IF 0AA2: [email protected] = "samp.dll"
THEN
    IF [email protected] == 1 // 0.3.7 R1
    THEN 
        0A8E: [email protected] = [email protected] + 0x21A0E4
    END
    IF [email protected] == 2 // 0.3.7 R2
    THEN 
        0A8E: [email protected] = [email protected] + 0x21A0EC
    END

    IF [email protected] == 3 // 0.3.DL
    THEN 
        0A8E: [email protected] = [email protected] + 0x2ACA10
    END

    IF [email protected] == 4 // 0.3.7 R3
    THEN  
        0A8E: [email protected] = [email protected] + 0x26E8C8
    END

    IF [email protected] == 5 // 0.3.7 R4
    THEN 
        0A8E: [email protected] = [email protected] + 0x26E9F8
    END
    0A8D: [email protected] readMem [email protected] sz 4 vp 0
    [email protected] += 0x132
    [email protected] *= 0xFC
    005A: [email protected] += [email protected]
    [email protected] += 0x20
    0AA3: [email protected]
END
0AB2: ret 1 [email protected]

:IfTextContains
{
    [email protected] - the main text
    [email protected] - piece of text to be found within the main text
}
0AB1: @strlen 1 strPtr [email protected] _length [email protected]
0AB1: @strlen 1 strPtr [email protected] _length [email protected]

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

[email protected] -= 1
[email protected] = 0 // counter of the same chars in a row
for [email protected] = 0 to [email protected] // for each char of the main text  ([email protected] = index)
    0085: [email protected] = [email protected] // (int)
    005A: [email protected] += [email protected]  // (int)
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

    0085: [email protected] = [email protected] // (int)
    005A: [email protected] += [email protected]  // (int)
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

    if 003B:   [email protected] == [email protected]  // (int)
    then
    [email protected]++
        if 002D:   [email protected] >= [email protected]  // (int)
        then
        0485:  return_true
        0062: [email protected] -= [email protected]  // (int)
        [email protected] += 1
        0AB2: ret 1 [email protected]
        end
    else
        if [email protected] > 0
        then
        [email protected] //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
    [email protected] = 0
    end
end

059A:  return_false
0AB2: ret 1 0

:DeleteColorCodeFromText
{
    0AB1: @DeleteColorCodeFromText 4 text [email protected] FirstCharacter 91 SecondCharacter 93  memory_to_store_characters_as_text [email protected]
    In: [email protected] = text , FirstCharacter , SecondCharacter
    Out: [email protected] = pointer to memory where characters will be stored as text

}
[email protected] = FALSE // inbracket
0AB1: @strlen 1 string [email protected] _return: [email protected]
    for [email protected] = 0 to [email protected]
        0085: [email protected] = [email protected] // copy pointer
        005A: [email protected] += [email protected]  // add offset make loop
        0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 1 // [email protected] is the ascii number representing character
        if
        003B:   [email protected] == [email protected]  // (int)
        then
            [email protected] = TRUE // inbracket
        end

        if
        [email protected] == FALSE // inbracket
        THEN
            0A8C: write_memory [email protected] size 1 value [email protected] virtual_protect 1
            [email protected] += 1 // move to next address
        END

        if
        003B:   [email protected] == [email protected]  // (int)
        then
            [email protected] = FALSE // inbracket
        end
    end
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0

:get_digits_to_print
{
    [email protected] = text
    [email protected] = pointer to memory where digits will be stored as text
}
0AB1: @strlen 1 string [email protected] _return: [email protected]
    for [email protected] = 0 to [email protected]
        0085: [email protected] = [email protected] // copy pointer
        005A: [email protected] += [email protected]  // add offset (as the loop progresses it becomes pointers to first-last character)
        0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 1 // [email protected] is the ascii number representing character
        if and
        [email protected] >= 0x30 // '0'
        [email protected] <= 0x39 // '9'
        then
        0A8C: write_memory [email protected] size 1 value [email protected] virtual_protect 1
        [email protected] += 1 // move to next address
        end
    end
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0

:strlen
{
    Example: 0AB1: @strlen 1 string [email protected] _return: [email protected]
    In: [email protected] - text;
    Out: [email protected] - size;
}
for [email protected] = 0 to 1024
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0
    if not [email protected] == 0
    jf break
    [email protected] += 1
end
0AB2: ret 1 [email protected]

:SEND_CMD
// 0AB1: @SEND_CMD 2 SampVersionID [email protected] text [email protected]
IF 0AA2: [email protected] = "samp.dll"
THEN
    IF [email protected] == 1 // 0.3.7 R1
    THEN 
        0A8E: [email protected] = [email protected] + 0x65C60
    END
    IF [email protected] == 2 // 0.3.7 R2
    THEN 
        0A8E: [email protected] = [email protected] + 0x65D30
    END

    IF [email protected] == 3 // 0.3.DL
    THEN 
        0A8E: [email protected] = [email protected] + 0x69340
    END

    IF [email protected] == 4 // 0.3.7 R3
    THEN  
        0A8E: [email protected] = [email protected] + 0x69190
    END

    IF [email protected] == 5 // 0.3.7 R4
    THEN 
        0A8E: [email protected] = [email protected] + 0x698C0
    END
    0AA5: call [email protected] num_param 1 pop 0 [email protected]
END
0AB2: 0
...
This only getting digits (@get_digits_to_print param_count). Is there anyway to get with chars?(Example: UGB84) I need for version 0.3DL
 
Last edited:
OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
2,143
Likes
385
Points
113
Location
Lithuania
Website
ugbase.eu
20
#34
0.3.DL
Maybe works idk xD

PHP:
{$CLEO .cs}

0000: NOP

wait 8500

0AC8: [email protected] = allocate_memory_size 260
0AD3: [email protected] = "AFK Control!" // Check / find text

0AC8: [email protected] = allocate_memory_size 260
0AD3: [email protected] = "'/afk" // Check / find text

0AC8: [email protected] = allocate_memory_size 260
0AD3: [email protected] = "' before" // Check / find text

while true
wait 0

if
0256:   player $PLAYER_CHAR defined
then
    0AC8: [email protected] = allocate_memory_size 260
    0AB1: @getChatEntryText 1 ChatLineID 99 _Returned: text [email protected] // 99 last chat line
    0AC8: [email protected] = allocate_memory_size 260
    0AB1: @DeleteColorCodeFromText 4 text [email protected] FirstCharacter 123 SecondCharacter 125 memory_to_store_characters_as_text [email protected] // remove color codes and return clean string
    if
    0AB1: @IfTextContains 2 String1 [email protected] String2 [email protected] _returned: text [email protected]  // find text and compare to make sure is that what we need
    then
        if
        0AB1: @IfTextContains 2 String1 [email protected] String2 [email protected] _returned: text [email protected]  // find text " '/afk code"
        then
            0AB1: @strlen 1 strPtr [email protected] _length [email protected] // GET RETURNED TEXT SIZE
            if
            0AB1: @IfTextContains 2 String1 [email protected] String2 [email protected] _returned: text [email protected]  // find end of text " '/afk code"
            then
                0AB1: @strlen 1 strPtr [email protected] _length [email protected] // GET RETURNED TEXT SIZE
                0062: [email protected] -= [email protected] // DELETE FROM [email protected] SIZE, [email protected] - RETURNED TEXT SIZE , NOW YOU KNOW THE SIZE OF TEXT WHICH YOU NEED DELETE FROM [email protected] RETURNED STRING
                0AB1: @strncpy 3 destination [email protected] source [email protected] size [email protected] // COPY STRING WITH NEW SIZE OF TEXT
                0AB1: @SkipFirstCharacters 2 String [email protected] Characters 6 rnt [email protected] // '/afk = 5 CHARACTERS + ONE CHARACTER FOR SPACE, WHICH MEANS WE SKIP 6 CHARACTERS AND FINALLY TEXT IS - UG84
                0AC8: [email protected] = allocate_memory_size 260
                0AD3: [email protected] "/afk %s" [email protected]
                0AB1: @SEND_CMD 1 text [email protected]
                wait 10000 // anti spam
            end
        end
    end
end

end

:getChatEntryText
IF 0AA2: [email protected] = "samp.dll"
THEN
    [email protected] += 0x2ACA10
    0A8D: [email protected] readMem [email protected] sz 4 vp 0
    [email protected] += 0x132
    [email protected] *= 0xFC
    005A: [email protected] += [email protected]
    [email protected] += 0x20
    0AA3: [email protected]
END
0AB2: ret 1 [email protected]

:IfTextContains
{
    [email protected] - the main text
    [email protected] - piece of text to be found within the main text
}
0AB1: @strlen 1 strPtr [email protected] _length [email protected]
0AB1: @strlen 1 strPtr [email protected] _length [email protected]

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

[email protected] -= 1
[email protected] = 0 // counter of the same chars in a row
for [email protected] = 0 to [email protected] // for each char of the main text  ([email protected] = index)
    0085: [email protected] = [email protected] // (int)
    005A: [email protected] += [email protected]  // (int)
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

    0085: [email protected] = [email protected] // (int)
    005A: [email protected] += [email protected]  // (int)
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

    if 003B:   [email protected] == [email protected]  // (int)
    then
    [email protected]++
        if 002D:   [email protected] >= [email protected]  // (int)
        then
        0485:  return_true
        0062: [email protected] -= [email protected]  // (int)
        [email protected] += 1
        0AB2: ret 1 [email protected]
        end
    else
        if [email protected] > 0
        then
        [email protected] //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
    [email protected] = 0
    end
end

059A:  return_false
0AB2: ret 1 0

:DeleteColorCodeFromText
{
    0AB1: @DeleteColorCodeFromText 4 text [email protected] FirstCharacter 91 SecondCharacter 93  memory_to_store_characters_as_text [email protected]
    In: [email protected] = text , FirstCharacter , SecondCharacter
    Out: [email protected] = pointer to memory where characters will be stored as text

}
[email protected] = FALSE // inbracket
0AB1: @strlen 1 string [email protected] _return: [email protected]
    for [email protected] = 0 to [email protected]
        0085: [email protected] = [email protected] // copy pointer
        005A: [email protected] += [email protected]  // add offset make loop
        0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 1 // [email protected] is the ascii number representing character
        if
        003B:   [email protected] == [email protected]  // (int)
        then
            [email protected] = TRUE // inbracket
        end

        if
        [email protected] == FALSE // inbracket
        THEN
            0A8C: write_memory [email protected] size 1 value [email protected] virtual_protect 1
            [email protected] += 1 // move to next address
        END

        if
        003B:   [email protected] == [email protected]  // (int)
        then
            [email protected] = FALSE // inbracket
        end
    end
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0

:strncpy
var
[email protected] : integer
[email protected] : integer
[email protected] : integer
[email protected] : integer
[email protected] : integer
end

// [email protected] - destination, [email protected] - source, [email protected] - size
// Example: 0AB1: @strncpy 3 destination [email protected] source [email protected] size [email protected]

[email protected] = 0
[email protected] = 1
while [email protected] <> 0
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0
    0A8C: write_memory [email protected] size 1 value [email protected] virtual_protect 0
    [email protected]++ // count
    [email protected]++ // dst
    [email protected]++ // src
    if [email protected] == [email protected]
    then BREAK
    end
end
0A8C: write_memory [email protected] size 1 value 0 virtual_protect 0 // null terminate
0AB2: ret 0

:strlen
{
    Example: 0AB1: @strlen 1 string [email protected] _return: [email protected]
    In: [email protected] - text;
    Out: [email protected] - size;
}
for [email protected] = 0 to 1024
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0
    if not [email protected] == 0
    jf break
    [email protected] += 1
end
0AB2: ret 1 [email protected]

:SkipFirstCharacters
005A: [email protected] += [email protected]
0AB2: ret 1 [email protected]

:SEND_CMD
//0AB1: @SEND_CMD 1 $text
IF 0AA2: [email protected] = "samp.dll"
THEN
    [email protected] += 0x69340 // FUNC_SEND_CMD_03DL
    0AA5: call [email protected] num_param 1 pop 0 [email protected]
END
0AB2: 0
 
Last edited:
Top