OnDialogResponse question
#1

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
Reply
#2

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

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

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..
}
Reply
#5

Thank you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)