SA-MP Forums Archive
Dialog 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 Help!?! (/showthread.php?tid=560612)



Dialog Help!?! - Mark_Samp - 29.01.2015

So i wonder how i can use "DIALOG_STYLE_MSGBOX" to later on move on to a "DIALOG_STYLE_LIST" with "CASES" or (Listitem)


Re: Dialog Help!?! - Sime30 - 29.01.2015

If I understood you correctly, you want from MSGBOX to have listitems or cases like LIST? I think you have only 2 options, response and !response.


Re: Dialog Help!?! - Mark_Samp - 29.01.2015

Basicly people are gonna choose a car from a DIALOG_STYLE_LIST, It will confirm with a DIALOG_STYLE_MSGBOX and then it will go to something that creates the car depending if they pressed "Buy" Or "Back"


Re: Dialog Help!?! - Sime30 - 29.01.2015

Oh, okay. So, something like this?

pawn Код:
#define DIALOG_1 1
#define DIALOG_VEH1 10
#define DIALOG_VEH2 11
#define DIALOG_VEH3 12
// put this below somewhere
ShowPlayerDialog(playerid, DIALOG_1, DIALOG_STYLE_LIST, "Cars", "Veh1\nVeh2\nVeh3", "Choose", "Cancel");
//...

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch (dialogid)
    {
          case DIALOG_1: // 1
      {
                if( !response ) return 1;
                switch(listitem)
                {
                      case 0:// Veh1
                  {
                            ShowPlayerDialog(playerid, DIALOG_VEH1, DIALOG_STYLE_MSGBOX, "Confirmation", "Are you sure you want to buy this vehicle?", "Hell yeah", "Nope");
                      }
                      case 1:// Veh2
                  {
                            ShowPlayerDialog(playerid, DIALOG_VEH2, DIALOG_STYLE_MSGBOX, "Confirmation", "Are you sure you want to buy this vehicle?", "Hell yeah", "Nope");
                      }
                      case 2:// Veh3
                  {
                            ShowPlayerDialog(playerid, DIALOG_VEH3, DIALOG_STYLE_MSGBOX, "Confirmation", "Are you sure you want to buy this vehicle?", "Hell yeah", "Nope");
                      }
                }
          }
          case DIALOG_VEH1: // 10
      {
                if( response )
            {
                       SendClientMessage(playerid, -1,"You bought a vehicle! ");
                }
          }
     }



Re: Dialog Help!?! - Mark_Samp - 29.01.2015

I will try that, i'll post here if i need anything else, Thanks in advance


Re: Dialog Help!?! - Mark_Samp - 29.01.2015

Is there any other way of doing it as i am doing most of the cars from this list https://sampwiki.blast.hk/wiki/Vehicle_Model_ID_List

Or do i have to define EVERY car with like "#define CAR" "#define CAR1" as there will be a lot of defines for all cars...?? And do all the cars is seperate DIALOGS or can't i just use switch or listitem to make it work?


Re: Dialog Help!?! - Sime30 - 29.01.2015

Hmm...

EDIT: Use switch instead of IF ELSE if you wish.

pawn Код:
new BuyingCarID[MAX_PLAYERS];
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch (dialogid)
    {
          case DIALOG_1: // 1
      {
                if( !response ) return 1;
                switch(listitem)
                {
                      case 0:// Veh1
                  {
                            ShowPlayerDialog(playerid, DIALOG_BUYINGCAR, DIALOG_STYLE_MSGBOX, "Confirmation", "Are you sure you want to buy this vehicle?", "Hell yeah", "Nope");
                            BuyingCarID[playerid] = 411; //infernus
                      }
                      case 1:// Veh2
                  {
                            ShowPlayerDialog(playerid, DIALOG_BUYINGCAR, DIALOG_STYLE_MSGBOX, "Confirmation", "Are you sure you want to buy this vehicle?", "Hell yeah", "Nope");
                            BuyingCarID[playerid] = 451; //turismo
                      }
                      case 2:// Veh3
                  {
                            ShowPlayerDialog(playerid, DIALOG_BUYINGCAR, DIALOG_STYLE_MSGBOX, "Confirmation", "Are you sure you want to buy this vehicle?", "Hell yeah", "Nope");
                            BuyingCarID[playerid] = 521; //FCR
                      }
                }
          }
          case DIALOG_BUYINGCAR: // 10
      {
                if( response )
            {
                       if( BuyingCarID[playerid] == 411)
                       {
                             SendClientMessage(playerid, -1,"You bought Infernus! ");
                       }
                       else if( BuyingCarID[playerid] == 451)
                       {
                             SendClientMessage(playerid, -1,"You bought Turismo! ");
                       }
                       //////
                }
          }
     }



Re: Dialog Help!?! - Mark_Samp - 29.01.2015

Thank you a lot, This was exacly what i was looking for, REP+ for you my friend!