23.06.2012, 21:50
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:
Thanks in advanced.
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; }