25.07.2014, 10:22
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:
Let's call the dialog:
Then lets see dialog's output:
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:
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
Код:
public OnPlayerConnect(playerid) { ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_LIST, "Would you like to be a Male or Female?", "Male\nFemale"); }
Код:
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; }
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) { } }