SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 30/05/2019, 12:32 PM   #1
binnyl
Huge Clucker
 
Join Date: Aug 2017
Posts: 252
Reputation: 6
Default How to deal with this dialoglist and get player ID

PHP Code:
PrisionersList(playerid) {
    new 
str[100], final[512], contador 0;
    foreach(new 
Player) {
        if(
preso[i] == && GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid)) {
            if(
GetSecondsInMin(presotime[i]) > 0) {
                
format(strsizeof(str), "%s (%i min)\n"PlayerName(i), GetSecondsInMin(presotime[i]) );
                
strcat(final, str);
                
contador++;
            }
        }
    }
    if(
contador 0ShowPlayerDialog(playerid406DIALOG_STYLE_LIST"Prisoners", final, "Select""Cancel");
    else 
SendClientMessage(playerid, -1"There is no prisioners in this prision!");
    return 
1;

How to get the prisioner selected and do something on dialogid 406?

Last edited by binnyl; 30/05/2019 at 11:32 PM.
binnyl is offline   Reply With Quote
Old 30/05/2019, 12:47 PM   #2
Deflect
Little Clucker
 
Deflect's Avatar
 
Join Date: May 2019
Posts: 18
Reputation: 8
Default Re: How to deal with this dialoglist and get player ID

CLICK ME
Use this to get the player ID.

CLICK ME
This for the dialog.
Deflect is offline   Reply With Quote
Old 30/05/2019, 11:32 PM   #3
binnyl
Huge Clucker
 
Join Date: Aug 2017
Posts: 252
Reputation: 6
Default Re: How to deal with this dialoglist and get player ID

Quote:
Originally Posted by Deflect View Post
CLICK ME
Use this to get the player ID.

CLICK ME
This for the dialog.
Really? Did u read the code on topic?
It's not a normal simple dialog
binnyl is offline   Reply With Quote
Old 31/05/2019, 05:40 PM   #4
Calisthenics
Gangsta
 
Join Date: May 2018
Posts: 875
Reputation: 156
Default Re: How to deal with this dialoglist and get player ID

`inputtext` has the text you selected from list. You need to retrieve the name and ignore anything after the first space character. Once you have the name, you can use sscanf to retrieve ID of player.

pawn Code:
// OnDialogResponse, dialogid: 406
new prisioner_name[50], prisioner_id;

sscanf(inputtext, "s[24]{s[26]}", prisioner_name); // anything inside { } is called quiet specifier and is ignored (not stored in variable)
sscanf(prisioner_name, "r", prisioner_id);

printf("prisioner_name: %s & prisioner_id: %d", prisioner_name, prisioner_id);
Calisthenics is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to deal with this? ahmad95 Server Support 10 11/09/2014 02:38 AM
2 problems to deal with Dziugsas Scripting Help 6 25/06/2014 04:29 PM
[PEDIDO]DialogList para escolher torcidas Nake01 Português/Portuguese 0 28/06/2011 06:18 PM
I will deal with this later.. notec100 Help Archive 18 18/05/2009 08:48 PM
Ok here's the deal SLaY3R Help Archive 3 04/04/2009 05:41 PM


All times are GMT. The time now is 11:05 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.