DIALOG_STYLE_LIST Help
#4

DIALOG_STYLE_LIST allows you creating a dialog with many options.
Each option is divided by "\n", that is translated by "new line".

Here's an example of a DIALOG_STYLE_LIST's dialog.

Let's define dialog's identifier:
Код:
#define DIALOG_SEX
Let's call the dialog:

Код:
public OnPlayerConnect(playerid) {
  ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_LIST, "Would you like to be a Male or Female?", "Male\nFemale");
}
Then lets see dialog's output:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  switch(dialogid) {
    case DIALOG_SEX:
    {
      switch(listitem) {
         case 0: { // 1st option
          SendClientMessage(playerid, -1, "You chose: MALE!");
         }
         case 1: { // 2nd option
           SendClientMessage(playerid, -1, "You chose: FEMALE!");
         }
      }
    }
  }
  return true;
}
You can see that listitem parameter is the item you chose.
It starts by 0.

Note: I used switch since it's more faster, but you can also do:

Код:
if(dialogid == DIALOG_SEX) {
  if(listitem == 0) {
  }
}
Reply


Messages In This Thread
DIALOG_STYLE_LIST Help - by 123bob123 - 25.07.2014, 07:56
Respuesta: DIALOG_STYLE_LIST Help - by SickAttack - 25.07.2014, 07:57
Re: DIALOG_STYLE_LIST Help - by Stinged - 25.07.2014, 08:00
Re: DIALOG_STYLE_LIST Help - by icra - 25.07.2014, 10:22

Forum Jump:


Users browsing this thread: 3 Guest(s)