#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; }
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;
}
pawn Код:
|
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
|
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;
}
// 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;
}