[HELP] Dialog
#1

Help me, when I do this command nothing happens ... But I seem to have done everything right! Here is the code, it is in Italian.
Код:
if(strcmp(cmd, "/siediti", true) == 0)
	{
			ShowPlayerDialog(playerid, 123456, DIALOG_STYLE_LIST, "Seleziona una sedia", "Sedia in pelle\nSedia da Ristorante\nSedia in ferro\nSedia da ufficio in legno\nSedia pieghevole\nSedia con rotelle\nSedia in legno\nSedia pieghevole rossa\nSedia da ufficio in pelle\nSedia bianca", "Siediti", "Annulla");
			return 1;
	}
Thanks!
Reply
#2

Alan, have you defined the dialog at the top of the script?
pawn Код:
#define 123456 1
Have you did anything in the public function OnDialogResponse?
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 123456:
        {
            if (!response) return 0;
            if(response)
            {
                //Do something here, by send the player a message or maybe put a marker on their radar, anything here.
            }
        }
    }
    return 1;
}
EDIT: Your code is fine, it's just you need to do what I've said.
Reply
#3

In Response Dialog I put everything, but I forgot to put # define 123456 1
But still gives me an error: 074 SVRP 39 "# define patterns must start with an alphabetic character"
Reply
#4

I wrote # define DIALOG 123456, and I made ​​it out, but it gives me the same result.
In ondialogresponse I write this. I do not know if it's okay
Код:
else if(dialogid == 123456 && response)
	    {
		 switch(listitem)
	     {
			 case 0:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1671, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		         animation[playerid] = 1;
			 }
			 case 1:
		     {
				 SetPlayerAttachedObject(playerid, 1, 1720, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 2:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1721, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 3:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1811, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 4:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1810, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 5:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1806, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 6:
			 {
				 SetPlayerAttachedObject(playerid, 1, 2120, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 7:
			 {
				 SetPlayerAttachedObject(playerid, 2121, 1765, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 8:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1765, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 9:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1714, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 10:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1765, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
              }
       } 
        else if(dialogid == 8 && response)
	    {
		 switch(listitem)
	     {
		      		case 0:
			        {
			          ShowPlayerDialog(playerid,9,DIALOG_STYLE_LIST,"Lavori Disponibili","Meccanico\nSpazzino\nCamionista\nPizzaBoy\nGelataio\nAgricoltore\nPostino\nOperaio\nTaxista","Ok","Indietro");
                    }
                    case 1:
                    {
			          ShowPlayerDialog(playerid,91,DIALOG_STYLE_LIST,"Concessionari","Concessionaria Auto Sportive\nConcessionaria Auto Normali\nConcessionaria Moto\nConcessionaria Barche\nConcessionaria Aerei","Ok","Indietro");
                    }
                    case 2:
                    {
			          ShowPlayerDialog(playerid,92,DIALOG_STYLE_LIST,"Posti Comuni","Distretto di Polizia\nOspedale\nSupermercato\nBanca\nNegozio Vestiti\nStazione\nScuola Guida\nComune\nCentro Assicurazioni\nCentro Targhe","Ok","Indietro");
                    }
              }
       }
Reply
#5

Quote:
Originally Posted by alanhutch
Посмотреть сообщение
I wrote # define DIALOG 123456, and I made ​​it out, but it gives me the same result.
In ondialogresponse I write this. I do not know if it's okay
Код:
else if(dialogid == 123456 && response)
	    {
		 switch(listitem)
	     {
			 case 0:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1671, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		         animation[playerid] = 1;
			 }
			 case 1:
		     {
				 SetPlayerAttachedObject(playerid, 1, 1720, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 2:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1721, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 3:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1811, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 4:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1810, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 5:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1806, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 6:
			 {
				 SetPlayerAttachedObject(playerid, 1, 2120, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 7:
			 {
				 SetPlayerAttachedObject(playerid, 2121, 1765, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 8:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1765, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 9:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1714, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
			 case 10:
			 {
				 SetPlayerAttachedObject(playerid, 1, 1765, 1, -0.800000, 0.000000, -0.500000, 180.000000, 90.000000, 0.000000);
				 ApplyAnimation(playerid,"PED","SEAT_down",4.1,0,1,1,1,0);
		 animation[playerid] = 1;
			 }
              }
       } 
        else if(dialogid == 8 && response)
	    {
		 switch(listitem)
	     {
		      		case 0:
			        {
			          ShowPlayerDialog(playerid,9,DIALOG_STYLE_LIST,"Lavori Disponibili","Meccanico\nSpazzino\nCamionista\nPizzaBoy\nGelataio\nAgricoltore\nPostino\nOperaio\nTaxista","Ok","Indietro");
                    }
                    case 1:
                    {
			          ShowPlayerDialog(playerid,91,DIALOG_STYLE_LIST,"Concessionari","Concessionaria Auto Sportive\nConcessionaria Auto Normali\nConcessionaria Moto\nConcessionaria Barche\nConcessionaria Aerei","Ok","Indietro");
                    }
                    case 2:
                    {
			          ShowPlayerDialog(playerid,92,DIALOG_STYLE_LIST,"Posti Comuni","Distretto di Polizia\nOspedale\nSupermercato\nBanca\nNegozio Vestiti\nStazione\nScuola Guida\nComune\nCentro Assicurazioni\nCentro Targhe","Ok","Indietro");
                    }
              }
       }
You're not supposed to put
pawn Код:
#define DIALOG 123456

For what you're doing is your supposed to put this
#define 123456 1
EDIT: My mistake, you have to use #define DIALOG_A 1
Then you have to change your command to this

pawn Код:
if(strcmp(cmd, "/siediti", true) == 0)
    {
            ShowPlayerDialog(playerid, DIALOG_A, DIALOG_STYLE_LIST, "Seleziona una sedia", "Sedia in pelle\nSedia da Ristorante\nSedia in ferro\nSedia da ufficio in legno\nSedia pieghevole\nSedia con rotelle\nSedia in legno\nSedia pieghevole rossa\nSedia da ufficio in pelle\nSedia bianca", "Siediti", "Annulla");
            return 1;
    }
Also show me your whole OnDialogResponse public function, also remember define the dialog at the top of your script, maybe at the bottom of your includes.
Reply
#6

Well, the problem is that you exceeded the limits of dialogs, you can only have 32767 dialogs.

pawn Код:
ShowPlayerDialog(playerid, 123456, DIALOG_STYLE_LIST, "Seleziona una sedia", "Sedia in pelle\nSedia da Ristorante\nSedia in ferro\nSedia da ufficio in legno\nSedia pieghevole\nSedia con rotelle\nSedia in legno\nSedia pieghevole rossa\nSedia da ufficio in pelle\nSedia bianca", "Siediti", "Annulla");
123456 is the id of your dialog which is greater than 32767 hence your dialog won't be shown. To fix this just put a id that is not below 0 and not greater than 32767.
Reply
#7

If #define 123456 1 does not work, gives me the error I mentioned before, here is the code on Pastebin, is too long otherwise.
http://pastebin.com/v0dt5FPp
Reply
#8

is not completely what I wrote, however everything else that's in ondialgoresponse does not know what to do.
Reply
#9

It gives you an error because you can't define a numeric. Just check my last post for a solution for your problem.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)