SA-MP Forums Archive
2 dialogs involve with each other - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 2 dialogs involve with each other (/showthread.php?tid=139480)



2 dialogs involve with each other - Jochemd - 05.04.2010

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.


Re: 2 dialogs involve with each other - AiVAMAN - 05.04.2010

Why you used return 2;? :\


Re: 2 dialogs involve with each other - Jochemd - 05.04.2010

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


Re: 2 dialogs involve with each other - scott1 - 05.04.2010

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)


Re: 2 dialogs involve with each other - Jochemd - 05.04.2010

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


Re: 2 dialogs involve with each other - scott1 - 05.04.2010

Show us your code


Re: 2 dialogs involve with each other - Jochemd - 05.04.2010

Код:
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


Re: 2 dialogs involve with each other - scott1 - 05.04.2010

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


Re: 2 dialogs involve with each other - Jochemd - 05.04.2010

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