Dialog Help!?!
#1

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

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.
Reply
#3

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"
Reply
#4

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! ");
                }
          }
     }
Reply
#5

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

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

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! ");
                       }
                       //////
                }
          }
     }
Reply
#8

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


Forum Jump:


Users browsing this thread: 2 Guest(s)