SA-MP Forums Archive
OnDialogResponse question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnDialogResponse question (/showthread.php?tid=517085)



OnDialogResponse question - kamiliuxliuxliux - 03.06.2014

Hello,
I've a question about dialogs, which style is DIALOG_STYLE_LIST. If I have a dialog with unknown count of items, what should I do under OnDialogResponse (listitems?).

For an example: I looped through online players and created a dialog where list items depends on online players count.
What numbers should I use there:
pawn Код:
OnDialogResponse(...)
{
   if(dialogid == lalala)
   {
      if(listitem == /*?????*/) {}
      if(listitem == /*?????*/) {}
   }
   return 1;
}
I want to press on player name and see the latest info.
+rep for helper



Re: OnDialogResponse question - Konstantinos - 03.06.2014

"inputtext" holds the text of the item a player selected. You can retrieve the player's ID by the name.


Re: OnDialogResponse question - kamiliuxliuxliux - 03.06.2014

Thanks, but could you give an example for this? :P


Re: OnDialogResponse question - Konstantinos - 03.06.2014

You can loop through the players and compare their names but I find sscanf easier:
pawn Код:
// In OnDialogResponse:
new
    ID;

sscanf(inputtext, "r", ID);
if (IsPlayerConnected(ID))
{
    // code..
}



Re: OnDialogResponse question - kamiliuxliuxliux - 03.06.2014

Thank you.