OnDialogResponse help
#1

Код:
 {

	if(dialogid == 20321 && response)
    {
		switch(listitem)
		{
			case 0:
			{
			   ShowPlayerDialog(playerid, 20321, DIALOG_STYLE_LIST, "Take a look at my other 44's", "9mm($1000)\nSilenced 9mm($2000)", "OMGYES", "NNO!");
            }
        }
    }
    if (dialogid == 20321 && response)
    {
	   switch(listitem)
	   {
		  case 0:
		  {
		  if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFF0000, "Bro you broke");
		  GivePlayerWeapon(playerid, 22,100);
		  GivePlayerMoney(playerid, -1000);
		  SendClientMessage(playerid, 0x99FFFF, "Let's kick some ass.");
		  }
		  case 1:
		  {
		  if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, 0xFF0000, "Bro you broke");
		  GivePlayerWeapon(playerid, 23, 100);
		  GivePlayerMoney(playerid, -2000);
		  SendClientMessage(playerid, 0x99FFFF, "Kick some silenced ass");
		  }
      }
   }
    if(dialogid == 20322 && response)
    {
		switch(listitem)
		{
			case 0:
			{

			   ShowPlayerDialog(playerid, 20322, DIALOG_STYLE_LIST, "Banka - Zavalimo te u kredit", "Mali(10,000$\nVeliki($100,000$)", "Uh,Jebote!", "Necu!");
            }
        }
    }
    if (dialogid == 20322 && response)
    {
	   switch(listitem)
	   {
		  case 0:
		  {
		  if(GetPlayerMoney(playerid) < 0) return SendClientMessage(playerid, 0xFF0000, "Ni mi ti nemozemo pomoc");
		  GivePlayerWeapon(playerid, 22,100);
		  GivePlayerMoney(playerid, 10000);
		  SendClientMessage(playerid, 0x99FFFF, "Ima da sutra castis kafanu, UDRI BRIGU NA VESELJE!");
		  }
		  case 1:
		  {
		  if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xFF0000, "Pas mater,uu.");
		  GivePlayerWeapon(playerid, 23, 100);
		  GivePlayerMoney(playerid, 100000);
		  SendClientMessage(playerid, 0x99FFFF, "Vozi misko");
		  }
      }
   }

    return 1;
}
So I have this script ( I'm learning pawno, and I really want to learn it, because I'm interested in it. Now, the problem is;
I got ZCMD CMD1st dialog)oruzije and (2nd dialog) kredit, now when I type /kredit, it does display the right dialog, but the functions of the dialog aren't correct, like it says "Bro you broke" and stuff, it gives me both money and 9mm or silenced, should I change cases or?
Reply
#2

Your kredit dialog uses same id maybe, Try to change.
Reply
#3

Your dialogids are the same.. here's an example of how to do a dialog:

pawn Код:
if(dialogid == 1)
{
    if(response)
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Title", "Black\nWhite", "Select", "Cancel");
    }
}
else if(dialogid == 2)
{
    if(response)
    {
        switch(listitem)
        {
            case 1: //black
            case 2: //white
        }
    }
}
Don't copy and paste that as I didn't test it, but hopefully you understand how you need to change the dialog ids.


Edit:
pawn Код:
if(dialogid == 20321 && response)
    {
        switch(listitem)
        {
            case 0:
            {
               ShowPlayerDialog(playerid, 20321, DIALOG_STYLE_LIST, "Take a look at my other 44's", "9mm($1000)\nSilenced 9mm($2000)", "OMGYES", "NNO!");
            }
        }
    }
    if (dialogid == 20321 && response) // See how you already have 20321 above? it needs to be a different id.
    {
       switch(listitem)
       {
          case 0:
          {
            if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFF0000, "Bro you broke");
            GivePlayerWeapon(playerid, 22,100);
            GivePlayerMoney(playerid, -1000);
            SendClientMessage(playerid, 0x99FFFF, "Let's kick some ass.");
          }
          case 1:
          {
            if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, 0xFF0000, "Bro you broke");
            GivePlayerWeapon(playerid, 23, 100);
            GivePlayerMoney(playerid, -2000);
            SendClientMessage(playerid, 0x99FFFF, "Kick some silenced ass");
          }
      }
   }
Read the comment I inserted, it might help you understand.
Reply
#4

Your dialog ids are all messed up. You have to take different dialog ids for different dialogs, like this -

Код:
 {

	if(dialogid == 20321 && response)
    {
		switch(listitem)
		{
			case 0:
			{
			   ShowPlayerDialog(playerid, 20322, DIALOG_STYLE_LIST, "Take a look at my other 44's", "9mm($1000)\nSilenced 9mm($2000)", "OMGYES", "NNO!");
            }
        }
    }
    if (dialogid == 20322 && response)
    {
	   switch(listitem)
	   {
		  case 0:
		  {
		  if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFF0000, "Bro you broke");
		  GivePlayerWeapon(playerid, 22,100);
		  GivePlayerMoney(playerid, -1000);
		  SendClientMessage(playerid, 0x99FFFF, "Let's kick some ass.");
		  }
		  case 1:
		  {
		  if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, 0xFF0000, "Bro you broke");
		  GivePlayerWeapon(playerid, 23, 100);
		  GivePlayerMoney(playerid, -2000);
		  SendClientMessage(playerid, 0x99FFFF, "Kick some silenced ass");
		  }
      }
   }
    if(dialogid == 20323 && response)
    {
		switch(listitem)
		{
			case 0:
			{

			   ShowPlayerDialog(playerid, 20324, DIALOG_STYLE_LIST, "Banka - Zavalimo te u kredit", "Mali(10,000$\nVeliki($100,000$)", "Uh,Jebote!", "Necu!");
            }
        }
    }
    if (dialogid == 20324 && response)
    {
	   switch(listitem)
	   {
		  case 0:
		  {
		  if(GetPlayerMoney(playerid) < 0) return SendClientMessage(playerid, 0xFF0000, "Ni mi ti nemozemo pomoc");
		  GivePlayerWeapon(playerid, 22,100);
		  GivePlayerMoney(playerid, 10000);
		  SendClientMessage(playerid, 0x99FFFF, "Ima da sutra castis kafanu, UDRI BRIGU NA VESELJE!");
		  }
		  case 1:
		  {
		  if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xFF0000, "Pas mater,uu.");
		  GivePlayerWeapon(playerid, 23, 100);
		  GivePlayerMoney(playerid, 100000);
		  SendClientMessage(playerid, 0x99FFFF, "Vozi misko");
		  }
      }
   }

    return 1;
}
Reply
#5

And now which ID do I put in zcmd for
Bank?
Weapons?
Reply
#6

Quote:
Originally Posted by Bek_Loking
Посмотреть сообщение
Well, I changed all three dialog Id's of the Weapon menu one to 1
And of the credit ones I changed all three to 2
Hope for the best
No, I don't think you did it right. Every dialog needs to have a different ID.

So all three dialog ids of the weapon menu need to be different, and all three credit ones need to be different.

So:
Weapon 1: ID 1
Weapon 2: ID 2
Weapon 3: ID 4
Credit 1: ID 5
Credit 2: ID 6
Credit 3: ID 7
Reply
#7

Quote:
Originally Posted by Jack_Leslie
Посмотреть сообщение
No, I don't think you did it right. Every dialog needs to have a different ID.

So all three dialog ids of the weapon menu need to be different, and all three credit ones need to be different.

So:
Weapon 1: ID 1
Weapon 2: ID 2
Weapon 3: ID 4
Credit 1: ID 5
Credit 2: ID 6
Credit 3: ID 7
Uhh.. I don't see 3 "dialogid"'s I only see 2?
Reply
#8

Quote:
Originally Posted by Bek_Loking
Посмотреть сообщение
Uhh.. I don't see 3 "dialogid"'s I only see 2?
I'm just going by what you said..

"Well, I changed all three dialog Id's of the Weapon menu one to 1
And of the credit ones I changed all three to 2
Hope for the best"
Reply
#9

Quote:
Originally Posted by Jack_Leslie
Посмотреть сообщение
I'm just going by what you said..

"Well, I changed all three dialog Id's of the Weapon menu one to 1
And of the credit ones I changed all three to 2
Hope for the best"
I went for this, not entirely "dialogid" I went for this thing: ShowPlayerDialog(playerid, -> I changed this as well, I didn't know that I needed this to be as the second one..2 <--, DIALOG_STYLE_LIST
Reply
#10

Try what Adityz did, he re-did the Dialog IDs for you. try his entire code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)