CMD's with levels dialog box not working
#1

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (!strcmp("/acmds", cmdtext))
	{
		new File[256], Level, Name[256];
		GetPlayerName(playerid, Name, sizeof(Name));
		format(File, sizeof(File),  PlayerFile, Name);
		Level = dini_Int(File, "Level");
		if(Level == 1){
		    ShowPlayerDialog(playerid, 11, DIALOG_STYLE_LIST, "Level 1 Commands", "/bike\r\n/boat\r\n/car\r\n/plane\r\n/trailer\r\n/repair\r\n/fuel\r\n/nos\r\n/asay\r\n/rep\r\nNEXT...\r\n", "SELECT", "CANCEL");
		}
		else if(Level == 2){
		    ShowPlayerDialog(playerid, 20, DIALOG_STYLE_LIST, "Choose a level", "Level 1\r\nLevel 2", "SELECT", "CANCEL");
		    }
		else if(Level == 3){
		    ShowPlayerDialog(playerid, 30, DIALOG_STYLE_LIST, "Choose a level", "Level 1\r\nLevel 2\r\nLevel 3", "SELECT", "CANCEL");
		}
		else if(Level == 4){
			ShowPlayerDialog(playerid, 40, DIALOG_STYLE_LIST, "Choose a level", "Level 1\r\nLevel 2\r\nLevel 3\r\nLevel 4", "SELECT", "CANCEL");
		}
		else if(Level == 5){
			ShowPlayerDialog(playerid, 50, DIALOG_STYLE_LIST, "Choose a level", "Level 1\r\nLevel 2\r\nLevel 3\r\nLevel 4\r\nLevel 5", "SELECT", "CANCEL");
		}
		return 1;
	}
	return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
		case 11:
		{
			if(!response)
			{
				return 1;
			}
			if(listitem >= 10)
			{
				ShowPlayerDialog(playerid, 12, DIALOG_STYLE_LIST, "Level 1 Commands", "/port\r\n/portloc\r\n/get\r\n/spec\r\n/endspec\r\n/engine\r\n/tele\r\n/portvehicle\r\n/warn\r\n/jail\r\nNEXT...\r\n", "SELECT", "CANCEL");
			}
		}
		case 12:
		{
			if(!response)
			{
				return 1;
			}
			if(listitem == 11)
			{
				ShowPlayerDialog(playerid, 13, DIALOG_STYLE_LIST, "Level 1 Commands", "/mute\r\n/unmute\r\n/mutes\r\n/freeze\r\n/respawn", "FINISH", "");
                
			}
		}
		case 13:
		{
			if(response)
			{
				return 1;
			}
		}
		case 20:
		{
			if(!response)
			{
				
			}
			switch(listitem)
			{
				case 0:
				{
					ShowPlayerDialog(playerid, 11, DIALOG_STYLE_LIST, "Level 1 Commands", "/bike\r\n/boat\r\n/car\r\n/plane\r\n/trailer\r\n/repair\r\n/fuel\r\n/nos\r\n/asay\r\n/rep\r\nNEXT...\r\n", "SELECT", "CANCEL");
				}
				case 1:
				{
					ShowPlayerDialog(playerid, 21, DIALOG_STYLE_LIST, "Level 2 Commands", "/fakechat\r\n/clearchat\r\n/wanted\r\n/eject", "FINISH", "");
				}
			}
		}
		case 21:
		{
			if(response)
			{
				return 1;
			}
		}
		case 30:
		{
			if(!response)
			{
				return 1;
			}
			switch(listitem)
			{
				case 0:
				{
					ShowPlayerDialog(playerid, 11, DIALOG_STYLE_LIST, "Level 1 Commands", "/bike\r\n/boat\r\n/car\r\n/plane\r\n/trailer\r\n/repair\r\n/fuel\r\n/nos\r\n/asay\r\n/rep\r\nNEXT...\r\n", "SELECT", "CANCEL");
				}
				case 1:
				{
					ShowPlayerDialog(playerid, 21, DIALOG_STYLE_LIST, "Level 2 Commands", "/fakechat\r\n/clearchat\r\n/wanted\r\n/eject", "FINISH", "");
				}
				case 2:
				{
					ShowPlayerDialog(playerid, 31, DIALOG_STYLE_LIST, "Level 3 Commands", "/repairall\r\n/healall\r\n/loc\r\n/saveloc\r\n/kick\r\n/ban\r\n/unban\r\n/fly\r\n/plate\r\n/caroption\r\nNEXT...", "SELECT", "CANCEL");
				}
			}
		}
		case 31:
		{
			if(!response)
			{
				return 1;
			}
			if(listitem == 11)
			{
				ShowPlayerDialog(playerid, 32, DIALOG_STYLE_LIST, "Level 3 Commands", "/cleanupcars\r\n/ipban\r\n/rangeban\r\n/setscore", "FINISH","");
                
			}
		}
		case 32:
		{
			if(response)
			{
				return 1;
			}
		}
		case 40:
		{
			if(!response)
			{
				return 1;
			}
			switch(listitem)
			{
				case 0:
				{
					ShowPlayerDialog(playerid, 11, DIALOG_STYLE_LIST, "Level 1 Commands", "/bike\r\n/boat\r\n/car\r\n/plane\r\n/trailer\r\n/repair\r\n/fuel\r\n/nos\r\n/asay\r\n/rep\r\nNEXT...\r\n", "SELECT", "CANCEL");
				}
				case 1:
				{
					ShowPlayerDialog(playerid, 21, DIALOG_STYLE_LIST, "Level 2 Commands", "/fakechat\r\n/clearchat\r\n/wanted\r\n/eject", "FINISH", "");
				}
				case 2:
				{
					ShowPlayerDialog(playerid, 31, DIALOG_STYLE_LIST, "Level 3 Commands", "/repairall\r\n/healall\r\n/loc\r\n/saveloc\r\n/kick\r\n/ban\r\n/unban\r\n/fly\r\n/plate\r\n/caroption\r\nNEXT...", "SELECT", "CANCEL");
				}
				case 3:
				{
					ShowPlayerDialog(playerid, 41, DIALOG_STYLE_LIST, "Level 4 Commands", "/cash\r\n/score\r\n/weather\r\n/setskin","FINISH","");
    			}
			}
		}
		case 41:
		{
			if(response)
			{
				return 1;
			}
		}
		case 50:
		{
			if(!response)
			{
				return 1;
			}
			switch(listitem)
			{
				case 0:
				{
					ShowPlayerDialog(playerid, 11, DIALOG_STYLE_LIST, "Level 1 Commands", "/bike\r\n/boat\r\n/car\r\n/plane\r\n/trailer\r\n/repair\r\n/fuel\r\n/nos\r\n/asay\r\n/rep\r\nNEXT...\r\n", "SELECT", "CANCEL");
				}
				case 1:
				{
					ShowPlayerDialog(playerid, 21, DIALOG_STYLE_LIST, "Level 2 Commands", "/fakechat\r\n/clearchat\r\n/wanted\r\n/eject", "FINISH", "");
				}
				case 2:
				{
					ShowPlayerDialog(playerid, 31, DIALOG_STYLE_LIST, "Level 3 Commands", "/repairall\r\n/healall\r\n/loc\r\n/saveloc\r\n/kick\r\n/ban\r\n/unban\r\n/fly\r\n/plate\r\n/caroption\r\nNEXT...", "SELECT", "CANCEL");
				}
				case 3:
				{
					ShowPlayerDialog(playerid, 41, DIALOG_STYLE_LIST, "Level 4 Commands", "/cash\r\n/score\r\n/weather\r\n/setskin","FINISH","");
				}
				case 4:
				{
					ShowPlayerDialog(playerid, 51, DIALOG_STYLE_LIST, "Level 5 Commands", "/createhouse\r\n/delhouse\r\n/object\r\n/delobject\r\n/pickup\r\n/vehicle\r\n/delvehicle\r\n/setlevel\r\n/restart\r\n/clamp\r\nNEXT...", "SELECT", "CANCEL");
				}
			}
		}
		case 51:
		{
			if(!response)
			{
				return 1;
			}
			if(listitem == 11)
			{
				ShowPlayerDialog(playerid, 52, DIALOG_STYLE_LIST, "Level 5 Commands", "/createcamera\r\n/delcamera\r\n/createbusiness\r\n/delbusiness\r\n/resetplayer\r\n/fixplayer", "FINISH","");
				
			}
		}
		case 52:
		{
			if(response)
			{
				return 1;
			}
		}
	}
	return 0;
}
Basically, when i am any of the levels 1-5 i see the main page but when i chose an option it closes and thats it.
The dialog ids are made to the levels so for 1 its 11 cause there are multiple pages so 1 page 2 its 12 etc. Please help?
Reply
#2

Just a bit of script,you can do the rest with this example.
Код:
else if(Level == 2){
		    ShowPlayerDialog(playerid, 20, DIALOG_STYLE_LIST, "Choose a level", "Level 1\r\nLevel 2", "SELECT", "CANCEL");
		    }

//
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 20)
	{
		if(listitem == 1)
		{
			ShowPlayerDialog(playerid, 13, DIALOG_STYLE_LIST, "Level 1 Commands", "/mute\r\n/unmute\r\n/mutes\r\n/freeze\r\n/respawn", "FINISH", "");

		}
		if(listitem == 2)
		{
			ShowPlayerDialog(playerid, 21, DIALOG_STYLE_LIST, "Level 2 Commands", "/fakechat\r\n/clearchat\r\n/wanted\r\n/eject", "FINISH", "");

		}
Reply
#3

It worked Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)