No response after selecting an item from a previous dialog..
#1

Hello,

I'm trying to make a config system using dialogs.

When I use my command to open the main dialog, that works.

When I select an item off the menu, it doesn't show the next dialog.

Any ideas?

My code:

Код:
#define NoDialogs(%0)  ShowPlayerDialog(%0, -1, -1, " ", " ", "", "")

#define DLG_Control 1
#define DLG_Time 2
#define DLG_EditM1 3
#define DLG_EditM2 4
#define DLG_EditM3 5
#define DLG_EditM4 6
#define DLG_EditM5 7
#define limegreen 0x00DD0000
#define lightblue 0x66FFFF00
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == DLG_Control)
 	{
  	    if(!response) return NoDialogs(playerid);
	    if(response)
     	    {
      		if(listitem == 0) //Seconds
		{
	            NoDialogs(playerid);
	            ShowPlayerDialog(playerid,DLG_Time,1,"Update how often messages should appear.","Input the amount of seconds for messages to change:","Update","Cancel");
	        }
	        if(listitem == 1) //Msg1
	        {
	            NoDialogs(playerid);
	            ShowPlayerDialog(playerid,DLG_EditM1,1,"Change Message 1.","Please type the new message to display for option 1:","Change","Cancel");
			return 1;
		}
	        if(listitem == 2) //Msg2
	        {
	            NoDialogs(playerid);
	            ShowPlayerDialog(playerid,DLG_EditM2,1,"Change Message 2.","Please type the new message to display for option 2:","Change","Cancel");
			return 1;
		}
	        if(listitem == 3) //Msg3
	        {
	            NoDialogs(playerid);
	            ShowPlayerDialog(playerid,DLG_EditM3,1,"Change Message 3.","Please type the new message to display for option 3:","Change","Cancel");
                    return 1;
		}
	        if(listitem == 4) //Msg4
	        {
	            NoDialogs(playerid);
	            ShowPlayerDialog(playerid,DLG_EditM4,1,"Change Message 4.","Please type the new message to display for option 4:","Change","Cancel");
                    return 1;
		}
	        if(listitem == 5) //Msg5
	        {
	            NoDialogs(playerid);
	            ShowPlayerDialog(playerid,DLG_EditM5,1,"Change Message 5.","Please type the new message to display for option 5:","Change","Cancel");
                     return 1;
		}
	    }
	    if(dialogid == DLG_Time)
	    {
	        if(!response) return NoDialogs(playerid);
	        if(response)
	        {
	            new updatedtimer,text[128],printupdate[128];
	            updatedtimer = strval(inputtext);
	            GetPlayerName(playerid,pName,sizeof(pName));
	            if(updatedtimer < 60 || updatedtimer > 900 || strlen(inputtext) == 0) return ShowPlayerDialog(playerid,DLG_Time,1,"Update how often the messages should appear.","Input the amount of seconds for messages to change:","Update","Cancel");
	            DOF2_SetInt(settings(),"Timer",updatedtimer);
	            format(text,sizeof(text),"The duration of messages rotating has been updated to %d seconds!",updatedtimer);
	            SendClientMessage(playerid,limegreen,text);
	            format(printupdate,sizeof(printupdate),"[AutoMessage] : %s changed the rotation time to %d seconds.",pName,updatedtimer);
				print(printupdate);
				return 1;
			}
	    }
	    if(dialogid == DLG_EditM1)
	    {
	        if(!response) return NoDialogs(playerid);
	        if(response)
	        {
	            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM1,1,"Change Message 1.","Please type the new message to display for option 1:","Change","Cancel");
	            new text[200],rcondis[200];
	            GetPlayerName(playerid,pName,sizeof(pName));
	            DOF2_SetString(settings(),"m1",inputtext);
	            format(text,sizeof(text),"You changed message 1 to display: \n%s",inputtext);
	            SendClientMessage(playerid,limegreen,text);
	            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 1.",pName);
	            print(rcondis);
	            return 1;
	        }
	    }
	    if(dialogid == DLG_EditM2)
	    {
	        if(!response) return NoDialogs(playerid);
	        if(response)
	        {
	            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM2,1,"Change Message 2.","Please type the new message to display for option 2:","Change","Cancel");
	            new text[200],rcondis[200];
	            GetPlayerName(playerid,pName,sizeof(pName));
	            DOF2_SetString(settings(),"m2",inputtext);
	            format(text,sizeof(text),"You changed message 2 to display: \n%s",inputtext);
	            SendClientMessage(playerid,limegreen,text);
	            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 2.",pName);
	            print(rcondis);
	            return 1;
	        }
	    }
	    if(dialogid == DLG_EditM3)
	    {
	        if(!response) return NoDialogs(playerid);
	        if(response)
	        {
	            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM3,1,"Change Message 3.","Please type the new message to display for option 3:","Change","Cancel");
	            new text[200],rcondis[200];
	            GetPlayerName(playerid,pName,sizeof(pName));
	            DOF2_SetString(settings(),"m3",inputtext);
	            format(text,sizeof(text),"You changed message 3 to display: \n%s",inputtext);
	            SendClientMessage(playerid,limegreen,text);
	            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 3.",pName);
	            print(rcondis);
	            return 1;
	        }
	    }
	    if(dialogid == DLG_EditM4)
	    {
	        if(!response) return NoDialogs(playerid);
	        if(response)
	        {
	            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM4,1,"Change Message 4.","Please type the new message to display for option 4:","Change","Cancel");
	            new text[200],rcondis[200];
	            GetPlayerName(playerid,pName,sizeof(pName));
	            DOF2_SetString(settings(),"m4",inputtext);
	            format(text,sizeof(text),"You changed message 4 to display: \n%s",inputtext);
	            SendClientMessage(playerid,limegreen,text);
	            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 4.",pName);
	            print(rcondis);
	            return 1;
	        }
	    }
	    if(dialogid == DLG_EditM5)
	    {
	        if(!response) return NoDialogs(playerid);
	        if(response)
	        {
	            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM5,1,"Change Message 5.","Please type the new message to display for option 5:","Change","Cancel");
	            new text[200],rcondis[200];
	            GetPlayerName(playerid,pName,sizeof(pName));
	            DOF2_SetString(settings(),"m5",inputtext);
	            format(text,sizeof(text),"You changed message 5 to display: \n%s",inputtext);
	            SendClientMessage(playerid,limegreen,text);
	            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 5.",pName);
	            print(rcondis);
	            return 1;
	        }
	    }
	}
	return 0;
}
Thanks in advanced.
Reply
#2

Did you try adding a SendClientMessage to the main dialog response code to see if it gets called?
I think the problem has something to do with the dialog Id because everything seems correct
Reply
#3

Yeah, I tried that previously.

No response at all :/
Reply
#4

Could you show me the line where you create the control dialog? I think it might be how you set your buttons.. Otherwise I'll have to keep looking
Reply
#5

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DLG_Control)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            if(listitem == 0) //Seconds
            {
                NoDialogs(playerid);
                ShowPlayerDialog(playerid,DLG_Time,1,"Update how often messages should appear.","Input the amount of seconds for messages to change:","Update","Cancel");
                return 1;
            }
            if(listitem == 1) //Msg1
            {
                NoDialogs(playerid);
                ShowPlayerDialog(playerid,DLG_EditM1,1,"Change Message 1.","Please type the new message to display for option 1:","Change","Cancel");
                return 1;
            }
            if(listitem == 2) //Msg2
            {
                NoDialogs(playerid);
                ShowPlayerDialog(playerid,DLG_EditM2,1,"Change Message 2.","Please type the new message to display for option 2:","Change","Cancel");
                return 1;
           
            if(listitem == 3) //Msg3
            {
                NoDialogs(playerid);
                ShowPlayerDialog(playerid,DLG_EditM3,1,"Change Message 3.","Please type the new message to display for option 3:","Change","Cancel");
                return 1;
            }
            if(listitem == 4) //Msg4
            {
                NoDialogs(playerid);
                ShowPlayerDialog(playerid,DLG_EditM4,1,"Change Message 4.","Please type the new message to display for option 4:","Change","Cancel");
                return 1;
            }
            if(listitem == 5) //Msg5
            {
                NoDialogs(playerid);
                ShowPlayerDialog(playerid,DLG_EditM5,1,"Change Message 5.","Please type the new message to display for option 5:","Change","Cancel");
                return 1;
            }
        }
        return 1;
    }
    if(dialogid == DLG_Time)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            new updatedtimer,text[128],printupdate[128];
            updatedtimer = strval(inputtext);
            GetPlayerName(playerid,pName,sizeof(pName));
            if(updatedtimer < 60 || updatedtimer > 900 || strlen(inputtext) == 0) return ShowPlayerDialog(playerid,DLG_Time,1,"Update how often the messages should appear.","Input the amount of seconds for messages to change:","Update","Cancel");
            DOF2_SetInt(settings(),"Timer",updatedtimer);
            format(text,sizeof(text),"The duration of messages rotating has been updated to %d seconds!",updatedtimer);
            SendClientMessage(playerid,limegreen,text);
            format(printupdate,sizeof(printupdate),"[AutoMessage] : %s changed the rotation time to %d seconds.",pName,updatedtimer);
            print(printupdate);
            return 1;
        }
    }
    if(dialogid == DLG_EditM1)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM1,1,"Change Message 1.","Please type the new message to display for option 1:","Change","Cancel");
            new text[200],rcondis[200];
            GetPlayerName(playerid,pName,sizeof(pName));
            DOF2_SetString(settings(),"m1",inputtext);
            format(text,sizeof(text),"You changed message 1 to display: \n%s",inputtext);
            SendClientMessage(playerid,limegreen,text);
            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 1.",pName);
            print(rcondis);
            return 1;
        }
    }
    if(dialogid == DLG_EditM2)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM2,1,"Change Message 2.","Please type the new message to display for option 2:","Change","Cancel");
            new text[200],rcondis[200];
            GetPlayerName(playerid,pName,sizeof(pName));
            DOF2_SetString(settings(),"m2",inputtext);
            format(text,sizeof(text),"You changed message 2 to display: \n%s",inputtext);
            SendClientMessage(playerid,limegreen,text);
            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 2.",pName);
            print(rcondis);
            return 1;
        }
    }
    if(dialogid == DLG_EditM3)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM3,1,"Change Message 3.","Please type the new message to display for option 3:","Change","Cancel");
            new text[200],rcondis[200];
            GetPlayerName(playerid,pName,sizeof(pName));
            DOF2_SetString(settings(),"m3",inputtext);
            format(text,sizeof(text),"You changed message 3 to display: \n%s",inputtext);
            SendClientMessage(playerid,limegreen,text);
            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 3.",pName);
            print(rcondis);
            return 1;
        }
    }
    if(dialogid == DLG_EditM4)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM4,1,"Change Message 4.","Please type the new message to display for option 4:","Change","Cancel");
            new text[200],rcondis[200];
            GetPlayerName(playerid,pName,sizeof(pName));
            DOF2_SetString(settings(),"m4",inputtext);
            format(text,sizeof(text),"You changed message 4 to display: \n%s",inputtext);
            SendClientMessage(playerid,limegreen,text);
            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 4.",pName);
            print(rcondis);
            return 1;
        }
    }
    if(dialogid == DLG_EditM5)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM5,1,"Change Message 5.","Please type the new message to display for option 5:","Change","Cancel");
            new text[200],rcondis[200];
            GetPlayerName(playerid,pName,sizeof(pName));
            DOF2_SetString(settings(),"m5",inputtext);
            format(text,sizeof(text),"You changed message 5 to display: \n%s",inputtext);
            SendClientMessage(playerid,limegreen,text);
            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 5.",pName);
            print(rcondis);
            return 1;
        }
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by Dubya
Посмотреть сообщение
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DLG_Control)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            if(listitem == 0) //Seconds
            {
                NoDialogs(playerid);
                ShowPlayerDialog(playerid,DLG_Time,1,"Update how often messages should appear.","Input the amount of seconds for messages to change:","Update","Cancel");
                return 1;
            }
            if(listitem == 1) //Msg1
            {
                NoDialogs(playerid);
                ShowPlayerDialog(playerid,DLG_EditM1,1,"Change Message 1.","Please type the new message to display for option 1:","Change","Cancel");
                return 1;
            }
            if(listitem == 2) //Msg2
            {
                NoDialogs(playerid);
                ShowPlayerDialog(playerid,DLG_EditM2,1,"Change Message 2.","Please type the new message to display for option 2:","Change","Cancel");
                return 1;
           
            if(listitem == 3) //Msg3
            {
                NoDialogs(playerid);
                ShowPlayerDialog(playerid,DLG_EditM3,1,"Change Message 3.","Please type the new message to display for option 3:","Change","Cancel");
                return 1;
            }
            if(listitem == 4) //Msg4
            {
                NoDialogs(playerid);
                ShowPlayerDialog(playerid,DLG_EditM4,1,"Change Message 4.","Please type the new message to display for option 4:","Change","Cancel");
                return 1;
            }
            if(listitem == 5) //Msg5
            {
                NoDialogs(playerid);
                ShowPlayerDialog(playerid,DLG_EditM5,1,"Change Message 5.","Please type the new message to display for option 5:","Change","Cancel");
                return 1;
            }
        }
        return 1;
    }
    if(dialogid == DLG_Time)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            new updatedtimer,text[128],printupdate[128];
            updatedtimer = strval(inputtext);
            GetPlayerName(playerid,pName,sizeof(pName));
            if(updatedtimer < 60 || updatedtimer > 900 || strlen(inputtext) == 0) return ShowPlayerDialog(playerid,DLG_Time,1,"Update how often the messages should appear.","Input the amount of seconds for messages to change:","Update","Cancel");
            DOF2_SetInt(settings(),"Timer",updatedtimer);
            format(text,sizeof(text),"The duration of messages rotating has been updated to %d seconds!",updatedtimer);
            SendClientMessage(playerid,limegreen,text);
            format(printupdate,sizeof(printupdate),"[AutoMessage] : %s changed the rotation time to %d seconds.",pName,updatedtimer);
            print(printupdate);
            return 1;
        }
    }
    if(dialogid == DLG_EditM1)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM1,1,"Change Message 1.","Please type the new message to display for option 1:","Change","Cancel");
            new text[200],rcondis[200];
            GetPlayerName(playerid,pName,sizeof(pName));
            DOF2_SetString(settings(),"m1",inputtext);
            format(text,sizeof(text),"You changed message 1 to display: \n%s",inputtext);
            SendClientMessage(playerid,limegreen,text);
            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 1.",pName);
            print(rcondis);
            return 1;
        }
    }
    if(dialogid == DLG_EditM2)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM2,1,"Change Message 2.","Please type the new message to display for option 2:","Change","Cancel");
            new text[200],rcondis[200];
            GetPlayerName(playerid,pName,sizeof(pName));
            DOF2_SetString(settings(),"m2",inputtext);
            format(text,sizeof(text),"You changed message 2 to display: \n%s",inputtext);
            SendClientMessage(playerid,limegreen,text);
            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 2.",pName);
            print(rcondis);
            return 1;
        }
    }
    if(dialogid == DLG_EditM3)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM3,1,"Change Message 3.","Please type the new message to display for option 3:","Change","Cancel");
            new text[200],rcondis[200];
            GetPlayerName(playerid,pName,sizeof(pName));
            DOF2_SetString(settings(),"m3",inputtext);
            format(text,sizeof(text),"You changed message 3 to display: \n%s",inputtext);
            SendClientMessage(playerid,limegreen,text);
            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 3.",pName);
            print(rcondis);
            return 1;
        }
    }
    if(dialogid == DLG_EditM4)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM4,1,"Change Message 4.","Please type the new message to display for option 4:","Change","Cancel");
            new text[200],rcondis[200];
            GetPlayerName(playerid,pName,sizeof(pName));
            DOF2_SetString(settings(),"m4",inputtext);
            format(text,sizeof(text),"You changed message 4 to display: \n%s",inputtext);
            SendClientMessage(playerid,limegreen,text);
            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 4.",pName);
            print(rcondis);
            return 1;
        }
    }
    if(dialogid == DLG_EditM5)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DLG_EditM5,1,"Change Message 5.","Please type the new message to display for option 5:","Change","Cancel");
            new text[200],rcondis[200];
            GetPlayerName(playerid,pName,sizeof(pName));
            DOF2_SetString(settings(),"m5",inputtext);
            format(text,sizeof(text),"You changed message 5 to display: \n%s",inputtext);
            SendClientMessage(playerid,limegreen,text);
            format(rcondis,sizeof(rcondis),"[AutoMessage] : %s changed the display of message 5.",pName);
            print(rcondis);
            return 1;
        }
    }
    return 1;
}
Made no difference :/

Quote:
Originally Posted by FUNExtreme
Посмотреть сообщение
Could you show me the line where you create the control dialog? I think it might be how you set your buttons.. Otherwise I'll have to keep looking
pawn Код:
dcmd_amsg(playerid,params[])
{
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
        ShowPlayerDialog(playerid,DLG_Control,2,"Auto Message Configuration.","Alter Seconds \nEdit Message 1 \nEdit Message 2\nEdit Message 3 \nEdit Message 4 \nEdit Message 5","Select","Cancel");
    }
    else SendClientMessage(playerid,-1,"SERVER: Unknown command.");
    return 1;
}
Reply
#7

pawn Код:
// This will Work.
    if(dialogid == DLG_Control)
    {
        if(!response) return NoDialogs(playerid);
        if(response)
        {
            switch(listitem)
            {
                case 0: //Seconds
                {
                    NoDialogs(playerid);
                    ShowPlayerDialog(playerid,DLG_Time,1,"Update how often messages should appear.","Input the amount of seconds for messages to change:","Update","Cancel");
                    return 1;
                }
                case 1: //Msg1
                {
                    NoDialogs(playerid);
                    ShowPlayerDialog(playerid,DLG_EditM1,1,"Change Message 1.","Please type the new message to display for option 1:","Change","Cancel");
                    return 1;
                }
                case 2: //Msg2
                {
                    NoDialogs(playerid);
                    ShowPlayerDialog(playerid,DLG_EditM2,1,"Change Message 2.","Please type the new message to display for option 2:","Change","Cancel");
                    return 1;
               
                case 3: //Msg3
                {
                    NoDialogs(playerid);
                    ShowPlayerDialog(playerid,DLG_EditM3,1,"Change Message 3.","Please type the new message to display for option 3:","Change","Cancel");
                    return 1;
                }
                case 4: //Msg4
                {
                    NoDialogs(playerid);
                    ShowPlayerDialog(playerid,DLG_EditM4,1,"Change Message 4.","Please type the new message to display for option 4:","Change","Cancel");
                    return 1;
                }
                case 5: //Msg5
                {
                    NoDialogs(playerid);
                    ShowPlayerDialog(playerid,DLG_EditM5,1,"Change Message 5.","Please type the new message to display for option 5:","Change","Cancel");
                    return 1;
                }
            }
        }
        return 1;
    }
Reply
#8

Hmm, this one is tough it seems.. So, buttons are correct, ids are correct... Could add a debug message in the response callback before the first if dialogid == blah statement. One after the opening bracket of the control dialog response and one inside the listitem you are going to choose.

Edit: @ the post above, you just did the exact same thing just with a different method, it doesn't make a difference at all and will not work.
Reply
#9

So I can't open one dialog from another then?
Reply
#10

Nobody said that..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)