11.03.2015, 16:41
please help me to fix the bug in OnDialogResponse nothing work
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_ADJUSTGANG)
{
if(!response) return 1;
else if(response)
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid, DIALOG_GANGNAME, DIALOG_STYLE_INPUT, "Gang Name", "Please input your new gang name below.", "Done", "Quit");
}
case 1:
{
ShowPlayerDialog(playerid, DIALOG_GANGMOTD, DIALOG_STYLE_INPUT, "Gang MOTD", "Please input your new gang MOTD below.", "Done", "Quit");
}
case 2:
{
ShowPlayerDialog(playerid, DIALOG_RANK1NAME, DIALOG_STYLE_INPUT, "Rank 1 Name", "Please input the new rank 1 name below.", "Done", "Quit");
}
case 3:
{
ShowPlayerDialog(playerid, DIALOG_RANK2NAME, DIALOG_STYLE_INPUT, "Rank 2 Name", "Please input the new rank 2 name below.", "Done", "Quit");
}
case 4:
{
ShowPlayerDialog(playerid, DIALOG_RANK3NAME, DIALOG_STYLE_INPUT, "Rank 3 Name", "Please input the new rank 3 name below.", "Done", "Quit");
}
case 5:
{
ShowPlayerDialog(playerid, DIALOG_RANK4NAME, DIALOG_STYLE_INPUT, "Rank 4 Name", "Please input the new rank 4 name below.", "Done", "Quit");
}
case 6:
{
ShowPlayerDialog(playerid, DIALOG_RANK5NAME, DIALOG_STYLE_INPUT, "Rank 5 Name", "Please input the new rank 5 name below.", "Done", "Quit");
}
case 7:
{
ShowPlayerDialog(playerid, DIALOG_RANK6NAME, DIALOG_STYLE_INPUT, "Rank 6 Name", "Please input the new rank 6 name below.", "Done", "Quit");
}
case 8:
{
ShowPlayerDialog(playerid, DIALOG_GANGCOLOR, DIALOG_STYLE_LIST, "Gang Color", "Green\nRed\nLight Blue\nYellow\nBrown\nBlack\nOrange", "Done", "Quit");
}
case 9:
{
ShowPlayerDialog(playerid, DIALOG_RANK1SKIN, DIALOG_STYLE_INPUT, "Rank 1 Skin", "Input the new rank 1 skin ID below.", "Done", "Quit");
}
case 10:
{
ShowPlayerDialog(playerid, DIALOG_RANK2SKIN, DIALOG_STYLE_INPUT, "Rank 2 Skin", "Input the new rank 2 skin ID below.", "Done", "Quit");
}
case 11:
{
ShowPlayerDialog(playerid, DIALOG_RANK3SKIN, DIALOG_STYLE_INPUT, "Rank 3 Skin", "Input the new rank 3 skin ID below.", "Done", "Quit");
}
case 12:
{
ShowPlayerDialog(playerid, DIALOG_RANK4SKIN, DIALOG_STYLE_INPUT, "Rank 4 Skin", "Input the new rank 4 skin ID below.", "Done", "Quit");
}
case 13:
{
ShowPlayerDialog(playerid, DIALOG_RANK5SKIN, DIALOG_STYLE_INPUT, "Rank 5 Skin", "Input the new rank 5 skin ID below.", "Done", "Quit");
}
case 14:
{
ShowPlayerDialog(playerid, DIALOG_RANK6SKIN, DIALOG_STYLE_INPUT, "Rank 6 Skin", "Input the new rank 6 skin ID below.", "Done", "Quit");
}
}
}
}
if(dialogid == DIALOG_GANGNAME)
{
if(!response) return 1;
else if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, GREY, "Invalid Gang Name.");
}
else if(strlen(inputtext) < 5)
{
SendClientMessage(playerid, GREY, "Your new gang name mustn't be under 3 characters.");
}
else if(strlen(inputtext) > 20)
{
SendClientMessage(playerid, GREY, "Your new gang name mustn't be more than 20 characters.");
}
else
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
new str[128];
format(str, sizeof(str), "You have successfully changed your gang name to %s", inputtext);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
format(GangStat[PlayerStat[playerid][GangID]][GangName], 128, "%s", inputtext);
SaveGang(PlayerStat[playerid][GangID]);
}
}
}
}
if(dialogid == DIALOG_GANGMOTD)
{
if(!response) return 1;
else if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, GREY, "Invalid Gang MOTD.");
}
else if(strlen(inputtext) < 15)
{
SendClientMessage(playerid, GREY, "Your new gang MOTD mustn't be under 15 characters.");
}
else if(strlen(inputtext) > 128)
{
SendClientMessage(playerid, GREY, "Your new gang MOTD mustn't be more than 128 characters.");
}
else
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
new str[128];
format(str, sizeof(str), "New gang MOTD: to %s", inputtext);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
format(GangStat[PlayerStat[playerid][GangID]][MOTD], 128, "%s", inputtext);
SaveGang(PlayerStat[playerid][GangID]);
}
}
}
}
if(dialogid == DIALOG_RANK1NAME)
{
if(!response) return 1;
else if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, GREY, "Invalid Rank name.");
}
else if(strlen(inputtext) < 3)
{
SendClientMessage(playerid, GREY, "The new rank 1 name mustn't be under 3 characters.");
}
else if(strlen(inputtext) > 10)
{
SendClientMessage(playerid, GREY, "The new rank 1 name mustn't be more than 10 characters.");
}
else
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
new str[128];
format(str, sizeof(str), "You have successfully changed the rank 1 name to %s", inputtext);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
format(GangStat[PlayerStat[playerid][GangID]][Rank1], 128, "%s", inputtext);
SaveGang(PlayerStat[playerid][GangID]);
}
}
}
}
if(dialogid == DIALOG_RANK2NAME)
{
if(!response) return 1;
else if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, GREY, "Invalid Rank name.");
}
else if(strlen(inputtext) < 3)
{
SendClientMessage(playerid, GREY, "The new rank 2 name mustn't be under 3 characters.");
}
else if(strlen(inputtext) > 10)
{
SendClientMessage(playerid, GREY, "The new rank 2 name mustn't be more than 10 characters.");
}
else
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
new str[128];
format(str, sizeof(str), "You have successfully changed the rank 2 name to %s", inputtext);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
format(GangStat[PlayerStat[playerid][GangID]][Rank2], 128, "%s", inputtext);
SaveGang(PlayerStat[playerid][GangID]);
}
}
}
}
if(dialogid == DIALOG_RANK3NAME)
{
if(!response) return 1;
else if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, GREY, "Invalid Rank name.");
}
else if(strlen(inputtext) < 3)
{
SendClientMessage(playerid, GREY, "The new rank 3 name mustn't be under 3 characters.");
}
else if(strlen(inputtext) > 10)
{
SendClientMessage(playerid, GREY, "the new rank 3 name mustn't be more than 10 characters.");
}
else
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
new str[128];
format(str, sizeof(str), "You have successfully changed the rank 3 name to %s", inputtext);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
format(GangStat[PlayerStat[playerid][GangID]][Rank3], 128, "%s", inputtext);
SaveGang(PlayerStat[playerid][GangID]);
}
}
}
}
if(dialogid == DIALOG_RANK4NAME)
{
if(!response) return 1;
else if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, GREY, "Invalid Rank name.");
}
else if(strlen(inputtext) < 3)
{
SendClientMessage(playerid, GREY, "The new rank 4 name mustn't be under 3 characters.");
}
else if(strlen(inputtext) > 10)
{
SendClientMessage(playerid, GREY, "The new rank 4 name mustn't be more than 10 characters.");
}
else
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
new str[128];
format(str, sizeof(str), "You have successfully changed the rank 4 name to %s", inputtext);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
format(GangStat[PlayerStat[playerid][GangID]][Rank4], 128, "%s", inputtext);
SaveGang(PlayerStat[playerid][GangID]);
}
}
}
}
if(dialogid == DIALOG_RANK5NAME)
{
if(!response) return 1;
else if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, GREY, "Invalid Rank name.");
}
else if(strlen(inputtext) < 3)
{
SendClientMessage(playerid, GREY, "The new rank 5 name mustn't be under 3 characters.");
}
else if(strlen(inputtext) > 10)
{
SendClientMessage(playerid, GREY, "The new rank 5 name mustn't be more than 10 characters.");
}
else
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
new str[128];
format(str, sizeof(str), "You have successfully changed the rank 5 name to %s", inputtext);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
format(GangStat[PlayerStat[playerid][GangID]][Rank5], 128, "%s", inputtext);
SaveGang(PlayerStat[playerid][GangID]);
}
}
}
}
if(dialogid == DIALOG_RANK6NAME)
{
if(!response) return 1;
else if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, GREY, "Invalid Rank name.");
}
else if(strlen(inputtext) < 3)
{
SendClientMessage(playerid, GREY, "The new rank 6 name mustn't be under 3 characters.");
}
else if(strlen(inputtext) > 10)
{
SendClientMessage(playerid, GREY, "The new rank 6 name mustn't be more than 10 characters.");
}
else
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
new str[128];
format(str, sizeof(str), "You have successfully changed the rank 6 name to %s", inputtext);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
format(GangStat[PlayerStat[playerid][GangID]][Rank6], 128, "%s", inputtext);
SaveGang(PlayerStat[playerid][GangID]);
}
}
}
}
if(dialogid == DIALOG_GANGCOLOR)
{
if(!response) return 1;
else if(response)
{
switch(listitem)
{
case 0:
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
GangStat[PlayerStat[playerid][GangID]][Color] = 0x33AA33AA;
SaveGang(PlayerStat[playerid][GangID]);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], "You have successfully changed the gang color to Green");
}
}
case 1:
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
GangStat[PlayerStat[playerid][GangID]][Color] = 0xAA3333AA;
SaveGang(PlayerStat[playerid][GangID]);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], "You have successfully changed the gang color to Red");
}
}
case 2:
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
GangStat[PlayerStat[playerid][GangID]][Color] = 0x33CCFFAA;
SaveGang(PlayerStat[playerid][GangID]);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], "You have successfully changed the gang color to Light Blue");
}
}
case 3:
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
GangStat[PlayerStat[playerid][GangID]][Color] = 0xFFFF00AA;
SaveGang(PlayerStat[playerid][GangID]);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], "You have successfully changed the gang color to Yellow");
}
}
case 4:
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
GangStat[PlayerStat[playerid][GangID]][Color] = 0xA52A2AAA;
SaveGang(PlayerStat[playerid][GangID]);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], "You have successfully changed the gang color to Brown");
}
}
case 5:
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
GangStat[PlayerStat[playerid][GangID]][Color] = 0x000000AA;
SaveGang(PlayerStat[playerid][GangID]);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], "You have successfully changed the gang color to Black");
}
}
case 6:
{
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
GangStat[PlayerStat[playerid][GangID]][Color] = 0xFF9900AA;
SaveGang(PlayerStat[playerid][GangID]);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], "You have successfully changed the gang color to Orange");
}
}
}
}
}
if(dialogid == DIALOG_RANK1SKIN)
{
if(!response) return 1;
if(response)
{
if(!strval(inputtext))
{
SendClientMessage(playerid, GREY, "You have entered an Invalid Skin ID.");
}
else if(strval(inputtext))
{
if(0 < strval(inputtext) < 299)
{
new str[128];
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
GangStat[PlayerStat[playerid][GangID]][Skin1] = strval(inputtext);
SaveGang(PlayerStat[playerid][GangID]);
format(str, sizeof(str), "You have successfully changed rank 1 skin to %d", GangStat[PlayerStat[playerid][GangID]][Skin1]);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
}
}
else
{
SendClientMessage(playerid, GREY, "Skins IDs are between 0 and 299.");
}
}
}
}
if(dialogid == DIALOG_RANK2SKIN)
{
if(!response) return 1;
if(response)
{
if(!strval(inputtext))
{
SendClientMessage(playerid, GREY, "You have entered an Invalid Skin ID.");
}
else if(strval(inputtext))
{
if(0 < strval(inputtext) < 299)
{
new str[128];
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
GangStat[PlayerStat[playerid][GangID]][Skin2] = strval(inputtext);
SaveGang(PlayerStat[playerid][GangID]);
format(str, sizeof(str), "You have successfully changed rank 2 skin to %d", GangStat[PlayerStat[playerid][GangID]][Skin2]);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
}
}
else
{
SendClientMessage(playerid, GREY, "Skins IDs are between 0 and 299.");
}
}
}
}
if(dialogid == DIALOG_RANK3SKIN)
{
if(!response) return 1;
if(response)
{
if(!strval(inputtext))
{
SendClientMessage(playerid, GREY, "You have entered an Invalid Skin ID.");
}
else if(strval(inputtext))
{
if(0 < strval(inputtext) < 299)
{
new str[128];
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
GangStat[PlayerStat[playerid][GangID]][Skin3] = strval(inputtext);
SaveGang(PlayerStat[playerid][GangID]);
format(str, sizeof(str), "You have successfully changed rank 3 skin to %d", GangStat[PlayerStat[playerid][GangID]][Skin3]);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
}
}
else
{
SendClientMessage(playerid, GREY, "Skins IDs are between 0 and 299.");
}
}
}
}
if(dialogid == DIALOG_RANK4SKIN)
{
if(!response) return 1;
if(response)
{
if(!strval(inputtext))
{
SendClientMessage(playerid, GREY, "You have entered an Invalid Skin ID.");
}
else if(strval(inputtext))
{
if(0 < strval(inputtext) < 299)
{
new str[128];
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
GangStat[PlayerStat[playerid][GangID]][Skin4] = strval(inputtext);
SaveGang(PlayerStat[playerid][GangID]);
format(str, sizeof(str), "You have successfully changed rank 4 skin to %d", GangStat[PlayerStat[playerid][GangID]][Skin4]);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
}
}
else
{
SendClientMessage(playerid, GREY, "Skins IDs are between 0 and 299.");
}
}
}
}
if(dialogid == DIALOG_RANK5SKIN)
{
if(!response) return 1;
if(response)
{
if(!strval(inputtext))
{
SendClientMessage(playerid, GREY, "You have entered an Invalid Skin ID.");
}
else if(strval(inputtext))
{
if(0 < strval(inputtext) < 299)
{
new str[128];
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
GangStat[PlayerStat[playerid][GangID]][Skin5] = strval(inputtext);
SaveGang(PlayerStat[playerid][GangID]);
format(str, sizeof(str), "You have successfully changed rank 5 skin to %d", GangStat[PlayerStat[playerid][GangID]][Skin5]);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
}
}
else
{
SendClientMessage(playerid, GREY, "Skins IDs are between 0 and 299.");
}
}
}
}
if(dialogid == DIALOG_RANK6SKIN)
{
if(!response) return 1;
if(response)
{
if(!strval(inputtext))
{
SendClientMessage(playerid, GREY, "You have entered an Invalid Skin ID.");
}
else if(strval(inputtext))
{
if(0 < strval(inputtext) < 299)
{
new str[128];
format(GangStat[PlayerStat[playerid][GangID]][GangFile], 60, "Gangs/Gang %d.ini", PlayerStat[playerid][GangID]);
if(fexist(GangStat[PlayerStat[playerid][GangID]][GangFile]))
{
GangStat[PlayerStat[playerid][GangID]][Skin6] = strval(inputtext);
SaveGang(PlayerStat[playerid][GangID]);
format(str, sizeof(str), "You have successfully changed rank 6 skin to %d", GangStat[PlayerStat[playerid][GangID]][Skin6]);
SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str);
}
}
else
{
SendClientMessage(playerid, GREY, "Skins IDs are between 0 and 299.");
}
}
}
}
return 1;
}