2 dialogs involve with each other
#1

Hello,

I just inverted a Driving School script into my Gamemode. But now I got the problem that dialogs are confusing with each other. They do not use the same id, the first uses return 2; and the other return 1;. Does anyone know the problem?

Regards, Jochem

PS: I do not upload the script because someone could steal it. I hope you understand.
Reply
#2

Why you used return 2;? :\
Reply
#3

Because I thought they wouldn't involve in each other then. But the same return doesnt work to
Reply
#4

return 2; ?O_o

You have to #define firstdiralog 1
#define seconddialog 2
#define thirddialog 3
....

And in OnDialogResponse


if (dialog == firstdiralog ) or if (dialog == seconddialog) or if (dialog == thirddialog)
Reply
#5

Doesn't work. They ars still involving in each other.
Reply
#6

Show us your code
Reply
#7

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

    if(dialogid == drinks && response) //
  {
    //
    switch(listitem)
    {
      case 1:
      {
        if(GetPlayerMoney(playerid) < 1) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        GivePlayerMoney(playerid, -1);
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
      }
      case 2:
      {
        if(GetPlayerMoney(playerid) < 2) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        GivePlayerMoney(playerid, -2);
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
      }
      case 3:
      {
        if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        GivePlayerMoney(playerid, -3);
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
      }
    }

		return 1;
}
		{
		if(dialogid == license)
	{
	  if(response)
	  {
	    if(listitem == 0)
	    {
				if(GetPlayerMoney(playerid) < DRIVING_LICENSE_PRICE)
				{
				  SendClientMessage(playerid,yellow," You don't have enough money.");
				  new dtests[] = "1\tDriving License - 800$\n2\tFlying License - 2000$\n3\tGun License - 1200$";
	  				ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Licenses, Chose One:",dtests,"Test","Exit");
				}
				else if(GetPlayerMoney(playerid) >= DRIVING_LICENSE_PRICE)
				{
				  GivePlayerMoney(playerid,-DRIVING_LICENSE_PRICE);
				  SendClientMessage(playerid,yellow," Hint: Get a car from the park to start the test.");
					PlayerInfo[playerid][DrivingTest] = 1;
				}
			}
			else if(listitem == 1)
	    {
				if(GetPlayerMoney(playerid) < FLYING_LICENSE_PRICE)
				{
				  SendClientMessage(playerid,yellow," You don't have enough money.");
				  new dtests[] = "1\tDriving License - 800$\n2\tFlying License - 2000$\n3\tGun License - 1200$";
	  				ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Licenses, Chose One:",dtests,"Test","Exit");
				}
				else if(GetPlayerMoney(playerid) >= FLYING_LICENSE_PRICE)
				{
				  GivePlayerMoney(playerid,-FLYING_LICENSE_PRICE);
				  SendClientMessage(playerid,yellow," Hint: Get a shamal from the San Fiero Airport to start the test.");
					PlayerInfo[playerid][FlyingTest] = 1;
				}
			}
			else if(listitem == 2)
	    {
				if(GetPlayerMoney(playerid) < GUN_LICENSE_PRICE)
				{
				  SendClientMessage(playerid,yellow," You don't have enough money.");
				  new dtests[] = "1\tDriving License - 800$\n2\tFlying License - 2000$\n3\tGun License - 1200$";
	  				ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Licenses, Chose One:",dtests,"Test","Exit");
				}
				else if(GetPlayerMoney(playerid) >= GUN_LICENSE_PRICE)
				{
				  GivePlayerMoney(playerid,-FLYING_LICENSE_PRICE);
				  SendClientMessage(playerid,yellow," You have bought the gun license.Type /sl to show it!");
					PlayerInfo[playerid][GunLicense] = 1;
				}
			}
		}
	}
		return 1;
} }
I hope that's enough
Reply
#8

First of all you should replace

Код:
if(dialogid == drinks && response) //
  {
    //
    switch(listitem)
    {
      case 1:
      {
        if(GetPlayerMoney(playerid) < 1) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        GivePlayerMoney(playerid, -1);
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
      }
      case 2:
      {
        if(GetPlayerMoney(playerid) < 2) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        GivePlayerMoney(playerid, -2);
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
      }
      case 3:
      {
        if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        GivePlayerMoney(playerid, -3);
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
      }
    }

		return 1;
}
by

Код:
if(dialogid == drinks) //
  {
    if(response)
    {
    switch(listitem)
    {
      case 1:
      {
        if(GetPlayerMoney(playerid) < 1) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        GivePlayerMoney(playerid, -1);
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
      }
      case 2:
      {
        if(GetPlayerMoney(playerid) < 2) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        GivePlayerMoney(playerid, -2);
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
      }
      case 3:
      {
        if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        GivePlayerMoney(playerid, -3);
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
      }
     }
    }

		return 1;
}
Show me your Showplayerdialog drinks and licence
Reply
#9

Here they are

ShowPlayerDialog(playerid,759,DIALOG_STYLE_LIST,"L icenses, Chose One:",dtests,"Test","Exit"); <-- License

ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What would you like to drink?", "Sprunk ($1)\nBeer ($2)\nWine ($3)", "Purchase", "Cancel"); <-- Drinks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)