CLEO Help Get player ID from dialog and send command

CLEO related

Halfastrc24

Active member
Joined
Jun 4, 2021
Messages
33
Reaction score
6
Location
Greenland
Hello guys, I come here to ask the help from you!

I want do this:
Click in a player name from a dialog, and get he's ID, to send a command, in case, /locate [ID]!

I appreciate any help, thank's!

Example:
 

Attachments

  • 1628463410837.png
    1628463410837.png
    60.7 KB · Views: 71

Halfastrc24

Active member
Joined
Jun 4, 2021
Messages
33
Reaction score
6
Location
Greenland
I try something like this, but I didn't get what I wanted



{$CLEO .cs}

0000:

REPEAT
WAIT 0
UNTIL 0AFA: SAMP_IS_READY


WHILE TRUE
WAIT 0
IF
0B4C: samp is_dialog_active 250
THEN
alloc 1@ 512 //alloc
0BD8: samp get_dialog_caption 3@
IF
0AD4: $NOT_NEEDED = scan_string 0@ format "Enter %d" 5@
THEN
alloc 2@ 8
format 2@ "%d" 5@
0AF9: samp say_msg "/locate %d" 0@
wait 2000
free 2@
free 5@
0B47: samp close_current_dialog_with_button 0
ELSE
0AF8: samp add_message_to_chat "Erro" color 0xFFFFFF 0@

END
END
END

SAMP.CmdRet()
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,115
Solutions
5
Reaction score
879
Location
Lithuania
I try something like this, but I didn't get what I wanted



{$CLEO .cs}

0000:

REPEAT
WAIT 0
UNTIL 0AFA: SAMP_IS_READY


WHILE TRUE
WAIT 0
IF
0B4C: samp is_dialog_active 250
THEN
alloc 1@ 512 //alloc
0BD8: samp get_dialog_caption 3@
IF
0AD4: $NOT_NEEDED = scan_string 0@ format "Enter %d" 5@
THEN
alloc 2@ 8
format 2@ "%d" 5@
0AF9: samp say_msg "/locate %d" 0@
wait 2000
free 2@
free 5@
0B47: samp close_current_dialog_with_button 0
ELSE
0AF8: samp add_message_to_chat "Erro" color 0xFFFFFF 0@

END
END
END

SAMP.CmdRet()

PHP:
//get number of dialog elements
0B54: samp 1@ = listbox_items_count

//substract one from total cout
1@ -= 1 //last item is actually the null terminator

chatmsg "num of elements %d" -1 1@

for 0@ = 0 to 1@
alloc 2@ = 1024
0B5B: samp get_listbox_item 0@ text_to 2@     
chatmsg "element %d - text: %s" -1 0@ 2@
free 2@
end
 

Halfastrc24

Active member
Joined
Jun 4, 2021
Messages
33
Reaction score
6
Location
Greenland
PHP:
//get number of dialog elements
0B54: samp 1@ = listbox_items_count

//substract one from total cout
1@ -= 1 //last item is actually the null terminator

chatmsg "num of elements %d" -1 1@

for 0@ = 0 to 1@
alloc 2@ = 1024
0B5B: samp get_listbox_item 0@ text_to 2@    
chatmsg "element %d - text: %s" -1 0@ 2@
free 2@
end
Thanks
 

Halfastrc24

Active member
Joined
Jun 4, 2021
Messages
33
Reaction score
6
Location
Greenland
Thanks for the all, but can u help me with a little problem again?

I tested and this only show the ID of the players in the chat. But I want something a little bit different, like click in the player name from Dialog and automattically send the command /locate [ID] to a determined ID, that's possible?

Here have a demonstration:
 

Attachments

  • w004Eg.gif
    w004Eg.gif
    791.9 KB · Views: 28

Halfastrc24

Active member
Joined
Jun 4, 2021
Messages
33
Reaction score
6
Location
Greenland
Show what you made..

I'm a beginner, but I made this:

Code:
{$CLEO .cs}

0000:

REPEAT
    WAIT 0
UNTIL 0AFA:

WHILE TRUE
    WAIT 0

IF 0AB0: 123 // F12
    THEN
        REPEAT
        WAIT 0
        UNTIL 8AB0: 123 
        IF
        6@ == false
    THEN
        6@ = 1
        0AD1: "ON" 1337
    ELSE
        6@ = 0
        0AD1: "OFF" 1337
    END   
END

    IF
    6@ == 1
    THEN
        0B54: samp 1@ = listbox_items_count
        
        1@ -= 1
        
        FOR 0@ = 0 to 1@
            alloc 2@ = 256
            0B5B: samp get_listbox_item 0@ text_to 2@     
            chatmsg "Elementos %d - Jogador(a): %s" -1 0@ 2@
            0AF9: samp say_msg "/localizar %d" 0@
            wait 5000
            free 2@
            END
        END

    END

But unfortunately, that's not what I wanted. This just locate a player every 5 seconds.
 
Top