SA-MP Forums Archive
DIALOG_STYLE_LIST Help - 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: DIALOG_STYLE_LIST Help (/showthread.php?tid=527915)



DIALOG_STYLE_LIST Help - 123bob123 - 25.07.2014

Can someone give me an example to make this: DIALOG_STYLE_LIST, i'd like to make like a help dialog with a selection.
Can someone give me an example pls



Respuesta: DIALOG_STYLE_LIST Help - SickAttack - 25.07.2014

https://sampwiki.blast.hk/wiki/ShowPlayerDialog
https://sampwiki.blast.hk/wiki/Dialog_Styles
https://sampforum.blast.hk/showthread.php?tid=379247


Re: DIALOG_STYLE_LIST Help - Stinged - 25.07.2014

https://sampwiki.blast.hk/wiki/How_to_Create_a_Dialog


Re: DIALOG_STYLE_LIST Help - icra - 25.07.2014

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) {
  }
}