CLEO Help Help with read samp dialog and reply [Samp 0.3DL]

CLEO related
Status
Not open for further replies.

minhduc0904

Member
Joined
Mar 6, 2020
Messages
5
Reaction score
0
Location
Viet Nam
Hi everyone, I am trying to get the text "Vui long nhap so 283254 de tiep tuc cau ca" and get captcha "283254". Could you please help me?
SThWzwX.png
 

Attachments

  • Capre.PNG
    Capre.PNG
    34.8 KB · Views: 2

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
1. Get dialog ID
PHP:
{$CLEO .cs}

0000:

wait 8500

while true
wait 0

if
0AB1:  @isDialogOpen 0 _return: dId 0@
then
    0AD1: "Dialog id: %d" 1337 0@
end

end
:isDialogOpen
0AA2: 1@ = "samp.dll"
1@ += 0x2AC9E0
0A8D: 1@ = readMem 1@ sz 4 vp 0
0A8E: 2@ = 1@ + 0x28
0A8D: 2@ = readMem 2@ sz 4 vp 0
if 2@ == 1
then
    0A8E: 4@ = 1@ + 0x30 //dialogId
    0A8D: 4@ = readMem 4@ sz 4 vp 0
    0485: dialog_open
    0AB2: ret 1 4@
else 059A: dialog_closed
end
0AB2: ret 1 -1
 
Last edited:

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
2. Change Dialog id to yours
PHP:
{$CLEO .cs}

0000: "By Parazitas" 

wait 8500 // wait until samp is ready

while true
wait 0

if
0AB1:  @isDialogOpen 0 _return: dId 0@
then
    if
    0@ == 2544 // 2544 - Dialog ID
    then
        if
        0AB1: @GetDialogText 0 _return: dText 1@
        then
            // Remove color codes
            0AC8: 2@ = allocate_memory_size 260
            0AB1: @changeString param_count 4 text 1@ FirstCharacter 123 SecondCharacter 125  memory_to_store_characters_as_text 2@
            // Get all digits from string
            0AC8: 3@ = allocate_memory_size 260
            0AB1: @get_digits_to_print param_count 2 text 2@ memory_to_store_digits_as_text 3@
            // Input digits to dialog edit box
            0AB1: @SetChatInputEditBoxText 1 => text 3@ 
            // Send press dialog button
            0AB1: @CloseCurrentDialogWithButton 1 Button 0 // 1 = Left , 0 = Right
            0AC9: free_allocated_memory 2@
            0AC9: free_allocated_memory 3@
        end
    end
end

end

:isDialogOpen
0AA2: 1@ = "samp.dll"
1@ += 0x2AC9E0
0A8D: 1@ = readMem 1@ sz 4 vp 0
0A8E: 2@ = 1@ + 0x28
0A8D: 2@ = readMem 2@ sz 4 vp 0
if 2@ == 1
then
    0A8E: 4@ = 1@ + 0x30 //dialogId
    0A8D: 4@ = readMem 4@ sz 4 vp 0
    0485: dialog_open
    0AB2: ret 1 4@
else 059A: dialog_closed
end
0AB2: ret 1 -1

:GetDialogText
{
    0.3.7 - R3
}
0AA2: 1@ = "samp.dll"
1@ += 0x2AC9E0
0A8D: 1@ = readMem 1@ sz 4 vp 0
0A8E: 2@ = 1@ + 0x28 //DialogOpenOffset
0A8D: 2@ = readMem 2@ sz 4 vp 0
if 2@ == 1 // Dialog active
then
    0A8E: 3@ = 1@ + 0x2C //DialogTypeOffset
    0A8D: 3@ = readMem 3@ sz 4 vp 0
    if or
    3@ == 0 // DIALOG_STYLE_MSGBOX 
    3@ == 1 // DIALOG_STYLE_INPUT
    3@ == 3 // DIALOG_STYLE_PASSWORD
    then 
        0A8E: 4@ = 1@ + 0x34 // DialogTextOffset
        0A8D: 4@ = readMem 4@ sz 4 vp 0 
        0485: dialog_open
        0AB2: ret 1 4@
    else 059A:  dialog closed
    end
end
0AB2: ret 0

:changeString
{
    0AB1: @changeString param_count 4 text 0@ FirstCharacter 91 SecondCharacter 93  memory_to_store_characters_as_text 1@
    In: 0@ = text , FirstCharacter , SecondCharacter
    Out: 1@ = pointer to memory where characters will be stored as text

}
5@ = FALSE // inbracket
0C17: 31@ = strlen 0@
    for 30@ = 0 to 31@
        0085: 29@ = 0@ // copy pointer
        005A: 29@ += 30@  // add offset make loop
        0A8D: 28@ = read_memory 29@ size 1 virtual_protect 1 // 28@ is the ascii number representing character
        if
        003B:   28@ == 1@  // (int)
        then
            5@ = TRUE // inbracket
        end
    
        if
        5@ == FALSE // inbracket
        THEN
            0A8C: write_memory 3@ size 1 value 28@ virtual_protect 1
            3@ += 1 // move to next address
        END
    
        if
        003B:   28@ == 2@  // (int)
        then
            5@ = FALSE // inbracket
        end
    end
0A8C: write_memory 3@ size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0

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

:SetDialogInputEditBoxText
{
    0.3.DL
    0AB1: @SetChatInputEditBoxText 1 => text 0@ 
}
if 0AA2: 2@ = "samp.dll"
then
    0A8E: 3@ = 2@ + 0x2AC9E0            // SAMP_DIALOG_INFO_OFFSET (R1)
    0A8D: 3@ = readMem 3@ sz 4 vp 0     // pDialog;
    0A8E: 4@ = 3@ + 0x24                // pDialog->pEditBox;
    0A8D: 4@ = readMem 4@ sz 4 vp 0     // pEditBox;
   
    0A8E: 5@ = 2@ + 0x85000 // CDXUTEditBox::GetText (offset for 0.3.7 R1)
   
    // CDXUTEditBox::SetText takes 2 params
    // 1 - pointer to zero terminated string
    // 2 - bool, if text is to be selected or not
   
    0AA8: call_function_method 5@ struct 4@ num_params 2 pop 0 _bSelected 0 _pszText 0@ _retVal 6@
end
0AB2: 0

:CloseCurrentDialogWithButton
{
    0.3.DL
    0AB1: @CloseCurrentDialogWithButton 1 Button 0 // 1 = Left , 0 = Right
}
IF 0AA2: 10@ = "samp.dll"
THEN  
    0A8E: 11@ = 10@ + 0x2AC9E0 // SAMP_DIALOG_INFO_OFFSET
    0A8D: 12@ = readMem 11@ sz 4 vp 0
    0A8E: 11@ = 10@ + 0x700D0 //SAMP_DIALOG_CLOSE
    0AA8: call_function_method 11@ struct 12@ num_params 1 pop 0 0@ $NOT_USED
END
0AB2: 0
 

minhduc0904

Member
Joined
Mar 6, 2020
Messages
5
Reaction score
0
Location
Viet Nam
1. Get dialog ID
PHP:
{$CLEO .cs}

0000:

wait 8500

while true
wait 0

if
0AB1:  @isDialogOpen 0 _return: dId 0@
then
    0AD1: "Dialog id: %d" 1337 0@
end

end
:isDialogOpen
0AA2: 1@ = "samp.dll"
1@ += 0x2AC9E0
0A8D: 1@ = readMem 1@ sz 4 vp 0
0A8E: 2@ = 1@ + 0x28
0A8D: 2@ = readMem 2@ sz 4 vp 0
if 2@ == 1
then
    0A8E: 4@ = 1@ + 0x30 //dialogId
    0A8D: 4@ = readMem 4@ sz 4 vp 0
    0485: dialog_open
    0AB2: ret 1 4@
else 059A: dialog_closed
end
0AB2: ret 1 -1
Thank you for your help, but when the dialog pops up, it will only display like this. I do not see the id of the dialog
kISvguI.png
 

minhduc0904

Member
Joined
Mar 6, 2020
Messages
5
Reaction score
0
Location
Viet Nam
1. Get dialog ID
PHP:
{$CLEO .cs}

0000:

wait 8500

while true
wait 0

if
0AB1:  @isDialogOpen 0 _return: dId 0@
then
    0AD1: "Dialog id: %d" 1337 0@
end

end
:isDialogOpen
0AA2: 1@ = "samp.dll"
1@ += 0x2AC9E0
0A8D: 1@ = readMem 1@ sz 4 vp 0
0A8E: 2@ = 1@ + 0x28
0A8D: 2@ = readMem 2@ sz 4 vp 0
if 2@ == 1
then
    0A8E: 4@ = 1@ + 0x30 //dialogId
    0A8D: 4@ = readMem 4@ sz 4 vp 0
    0485: dialog_open
    0AB2: ret 1 4@
else 059A: dialog_closed
end
0AB2: ret 1 -1
help me pls
 
Status
Not open for further replies.
Top