Automatically select from DIALOG, when DIALOG is opened, and click the first button.

Status
Not open for further replies.

AlaDyn172

Member
Joined
Dec 4, 2019
Messages
6
Reaction score
0
Location
Romania
Hello,

I've did a script a long time ago, but that was only with commands to write custom text message in chat or to get PlayerNames from IDs.. anyway.
Right now I want a script that detects an OPENED DIALOG and automatically selects from DIALOG based on a SET INTEGER.
I wanted to do something, but doesn't works. I don't like this C#. I am kinda more with JavaScript than C#.
If anyone wants to help me... hope you understand what I've wanted to do, my script:

Code:
{$CLEO .cs}

0000: NOP

wait 8500 // until samp is ready

var
   $TASKNUMBER : Int = 1
end

var
    $BUTTON_PRESSED : Int = 0
end

while true
wait 0           

if
0AB0: 90 {Z}
then
    if
    $BUTTON_PRESSED == 1
    then
    $BUTTON_PRESSED = 0
    0AF8: "Script not running!"
    else
    $BUTTON_PRESSED = 1
    0AF8: "Script running!"
    end
end



if
0B4C: samp is_dialog_active -1
then
    repeat
        if
        $BUTTON_PRESSED == 1
        then
            if
            $TASKNUMBER == 1
            then
               0B49: samp set_current_dialog_list_item 3
               wait 1000
               0B49: samp set_current_dialog_list_item 5
               $TASKNUMBER = 2
            else
               0B49: samp set_current_dialog_list_item 3
               wait 1000
               0B49: samp set_current_dialog_list_item 1
               $TASKNUMBER = 1
            end
        end
    until $BUTTON_PRESSED == 0
end

Quick explanation what I request:

1. Press key "Z" to start/stop script to detect opened DIALOGS.
2. Once the script is started, to start detecting opened DIALOGS.
3. When a dialog is OPENED and the task Integer is 1 to select the 3rd item and then the 5th item and to close the dialog by the 1st button and set the task Integer to 2.
4. When a dialog is OPENED and the task Integer is 2 to select the 3rd item and then the 1st item and to close the dialog by the 1st button and set the task Integer back to 1.
 
Last edited:

Zin

Expert
Joined
Aug 1, 2013
Messages
1,690
Reaction score
103
Those opcodes are for client created sampfuncs dialogs. Check parazitas’ snippets on the dialog stuff there’s one for everything you need. Also noticed some loops without using a wait (usually just use wait 0) this crashes the game.
 

Ravenous

Active member
Joined
Jan 21, 2016
Messages
61
Reaction score
4
Use this

Code:
{$CLEO}
{$INCLUDE SF}
0000: NOP
repeat
wait 50
until 0AFA: is_samp_structures_available

5@ = 0 //index for dialog list, 0 is the first item
   
while true
wait 0
    if
    key_down 90
    then
        if
        1@ == 1
        then
        wait 0
        else
        1@ = 1
        say "/buygun" //comand to open the dialog on your server
        0AB1: @closeDialogWithButton 1 5@
        end
    else
    1@ = 0
    end
end
                   


:closeDialogWithButton
{0@ - dialog list index}
0AA2: 2@ = "samp.dll"
2@ += 0x21A0B8
0A8D: 2@ = readMem 2@ sz 4 vp 0
0A8E: 3@ = 2@ + 0x28
while true
wait 0
0A8D: 9@ = readMem 3@ sz 4 vp 0
    if 9@ == 1 // Dialog active
    then
    0B49: samp set_current_dialog_list_item 0@
    0B47: samp close_current_dialog_with_button 1
    break
    end
end
0AB2: ret 0
 

AlaDyn172

Member
Joined
Dec 4, 2019
Messages
6
Reaction score
0
Location
Romania
Use this

Code:
{$CLEO}
{$INCLUDE SF}
0000: NOP
repeat
wait 50
until 0AFA: is_samp_structures_available

5@ = 0 //index for dialog list, 0 is the first item
  
while true
wait 0
    if
    key_down 90
    then
        if
        1@ == 1
        then
        wait 0
        else
        1@ = 1
        say "/buygun" //comand to open the dialog on your server
        0AB1: @closeDialogWithButton 1 5@
        end
    else
    1@ = 0
    end
end
                  


:closeDialogWithButton
{0@ - dialog list index}
0AA2: 2@ = "samp.dll"
2@ += 0x21A0B8
0A8D: 2@ = readMem 2@ sz 4 vp 0
0A8E: 3@ = 2@ + 0x28
while true
wait 0
0A8D: 9@ = readMem 3@ sz 4 vp 0
    if 9@ == 1 // Dialog active
    then
    0B49: samp set_current_dialog_list_item 0@
    0B47: samp close_current_dialog_with_button 1
    break
    end
end
0AB2: ret 0

You helped me a lot man, but the thing is, I want to check, when there is a Dialog active and to press different items from the dialog each time.
Anyway, thanks for your time to reply!!
 

Ravenous

Active member
Joined
Jan 21, 2016
Messages
61
Reaction score
4
use this loop then
Code:
while true
wait 0
    if
    0B4C:  samp is_dialog_active -1
    then
    // do something here
    end
end
or this one with activation key z
Code:
2@ = 0
while true
wait 0
    if
    key_down 90
    then
        if
        not 1@ == 1
        then
        1@ = 1
        0B12: 2@ = 2@ XOR 1  
        end
    else
    1@ = 0
    end
   
    if
    2@ == 1
    then
        if
        0B4C:  samp is_dialog_active -1
        then
        // do something here
        end
    end
end
 
Last edited:

AlaDyn172

Member
Joined
Dec 4, 2019
Messages
6
Reaction score
0
Location
Romania
use this loop then
Code:
while true
wait 0
    if
    0B4C:  samp is_dialog_active -1
    then
    // do something here
    end
end
or this one with activation key z
Code:
2@ = 0
while true
wait 0
    if
    key_down 90
    then
        if
        not 1@ == 1
        then
        1@ = 1
        0B12: 2@ = 2@ XOR 1 
        end
    else
    1@ = 0
    end
  
    if
    2@ == 1
    then
        if
        0B4C:  samp is_dialog_active -1
        then
        // do something here
        end
    end
end


Yes, this helps me <3
But, there is an issue, is there a way to store some variables type int and change them once the dialog list item is selected and check if the var int is 1 to select other item list and if it's 2 to select other item list?
Add me on discord: Echo#1182, I can pay you for this.
 
Status
Not open for further replies.
Top