Dialog issue
#1

need a little help here am getting warnings.


Код:
C:\Users\Brandon\Desktop\Infusion Gaming\Infusion Gaming\gamemodes\IG.pwn(13296) : error 040: duplicate "case" label (value 14)
C:\Users\Brandon\Desktop\Infusion Gaming\Infusion Gaming\gamemodes\IG.pwn(13428) : error 040: duplicate "case" label (value 16)
C:\Users\Brandon\Desktop\Infusion Gaming\Infusion Gaming\gamemodes\IG.pwn(13748) : error 040: duplicate "case" label (value 15)
the defines
Код:
// SASD
#define DIALOG_SASD 14
#define DIALOG_SASD2 15
#define DIALOG_SASD3 16
the dialog i made.
Код:
// DIALOG SASD NEED SORTING FROM HERE
		case DIALOG_SASD:
        {
            if(!response)
            {
                return 1;
			}
			if(response)
			{
			    if(listitem == 0)
			    {
			        if(badge[playerid] == 0)
			        {
					    SetPlayerColor(playerid, 0x0800FF00);
					    badge[playerid] = 1;
					    SkipWepCheck(playerid);
						SkipACheck(playerid);
						PlayerInfo[playerid][pArmor] = 100;
						SetPlayerArmour(playerid, 100);
						SetPlayerHealth(playerid, 100);
						GivePlayerValidWeapon(playerid, 24, 100);
						GivePlayerValidWeapon(playerid, 29, 100);
						GivePlayerValidWeapon(playerid, 3, 100);
						GivePlayerValidWeapon(playerid, 25, 100);
						GivePlayerValidWeapon(playerid, 41, 100);
						PlayerInfo[playerid][pSkin] = 280;
						SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
						return 1;
					}
    			    if(badge[playerid] == 1)
			        {
					    SetPlayerColor(playerid, 0xFFFFFF00);
					    badge[playerid] = 0;
					    SkipWepCheck(playerid);
						SkipACheck(playerid);
						PlayerInfo[playerid][pArmor] = 100;
						SetPlayerArmour(playerid, 100);
						SetPlayerHealth(playerid, 100);
						ResetPlayerWeapons(playerid);
						ResetPlayerWeaponsEx(playerid);
						PlayerInfo[playerid][pSkin] = 2;
						SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
						return 1;
					}
				}
               	if(listitem == 1)
			    {
                    ShowPlayerDialog(playerid, DIALOG_SASD2, DIALOG_STYLE_LIST, "SASD Equipment", "Desert Eagle ($0)\nShotgun ($0)\nMP5 ($0)\nM4($0)\nSpray Can ($0)\nNitestick\nSpas-12 ($700)\nSniper ($800)\nFirst Aid Kit\nKevlar Vest", "Ok", "Close");
					return 1;
				}
                if(listitem == 2)
			    {
                    ShowPlayerDialog(playerid, DIALOG_SASD3, DIALOG_STYLE_LIST, "SASD Uniform", "Cadet\nOfficer\nCorporal\nCorporal2\nCorporal3\nBike Officer\nSergeant\nLieutenant\nChief\nSWAT", "Ok", "Close");
					return 1;
				}
				if(listitem == 2)
				{
				    ShowPlayerDialog(playerid, DIALOG_UNINVITESKIN, DIALOG_STYLE_INPUT,""COL_WHITE"Skin change",""COL_WHITE"Select a skin to use. Valid skin IDs are 0 to 299.","Change","No");
					return 1;
				}
			}
			return 1;
		}
		// HERE AS WELL
		case DIALOG_SASD2:
        {
            if(!response)
            {
            	ShowPlayerDialog(playerid, DIALOG_SASD, DIALOG_STYLE_LIST, "SASD Locker", "Duty\nEquipment\nUniform\nSelect Skin", "Ok", "Close");
				return 1;
			}
			if(response)
			{
			    switch(listitem)
			    {
			        case 0:
			        {
			        SkipWepCheck(playerid);
					GivePlayerValidWeapon(playerid, 24, 100);
					}
					case 1:
					{
					SkipWepCheck(playerid);
					GivePlayerValidWeapon(playerid, 25, 100);
					}
					case 2:
					{
					SkipWepCheck(playerid);
					GivePlayerValidWeapon(playerid, 29, 100);
					}
					case 3:
					{
					SkipWepCheck(playerid);
					GivePlayerValidWeapon(playerid, 31, 100);
					}
					case 4:
					{
					SkipWepCheck(playerid);
					GivePlayerValidWeapon(playerid, 41, 100);
					}
					case 5:
					{
					SkipWepCheck(playerid);
					GivePlayerValidWeapon(playerid, 3, 1);
					}
					case 6:
					{
					if(PlayerInfo[playerid][pCash] < 700) { SendClientMessage(playerid, -1, "You don't have enough cash to buy this."); return -1; }
					GivePlayerValidWeapon(playerid, 27, 100);
					PlayerInfo[playerid][pCash] -= 700;
					}
					case 7:
					{
					if(PlayerInfo[playerid][pCash] < 800) { SendClientMessage(playerid, -1, "You don't have enough cash to buy this."); return -1; }
					GivePlayerValidWeapon(playerid, 34, 100);
					PlayerInfo[playerid][pCash] -= 800;
					}
					case 8:
					{
					SetPlayerHealth(playerid, 100);
					}
					case 9:
					{
					SkipACheck(playerid);
					PlayerInfo[playerid][pArmor] = 100;
					SetPlayerArmour(playerid, 100);
					}
				}
				return 1;
			}
			return 1;
		}
		// AND AGAIN HERE AS WELL.
        case DIALOG_SASD3:
        {
            if(!response)
            {
            	ShowPlayerDialog(playerid, DIALOG_SASD, DIALOG_STYLE_LIST, "SASD Locker", "Duty\nEquipment\nUniform\nSelect Skin", "Ok", "Close");
				return 1;
			}
			if(response)
			{
			    if(listitem == 0)
			    {
					PlayerInfo[playerid][pSkin] = 71; // cadet
					SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
				}
                if(listitem == 1)
			    {
					PlayerInfo[playerid][pSkin] = 280; // officer
					SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
				}
    			if(listitem == 2)
			    {
					PlayerInfo[playerid][pSkin] = 281; // corporal 1
					SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
				}
				if(listitem == 3)
				{
					PlayerInfo[playerid][pSkin] = 266; // corporal 2
					SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
				}
				if(listitem == 4)
				{
					PlayerInfo[playerid][pSkin] = 267; // corporal 3
					SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
				}
                if(listitem == 5)
				{
					PlayerInfo[playerid][pSkin] = 284; // bike officer
					SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
				}
				if(listitem == 6)
				{
					PlayerInfo[playerid][pSkin] = 282; // sergeant
					SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
				}
				if(listitem == 7)
				{
					PlayerInfo[playerid][pSkin] = 283; // lieutenant
					SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
				}
    			if(listitem == 8)
				{
					PlayerInfo[playerid][pSkin] = 288; // chief
					SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
				}
    			if(listitem == 9)
				{
					PlayerInfo[playerid][pSkin] = 285; // SWAT
					SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
				}
				return 1;
			}
			return 1;
		}
Reply
#2

Can you show us exactly the lines where the errors appear?
Reply
#3

on the cases such as case DIALOG_SASD:

Код:
case DIALOG_SASD:
case DIALOG_SASD2:
case DIALOG_SASD3:
Reply
#4

I guess you simply can't have a switch within a switch, pawn might mix it up maybe...
at least that's what I understand by that error text... no clue though, but I'd simply try to change one of those switches to "if" and "else if"... (I'd suggest the dialog ID switch to be changed)
Reply
#5

As the error says: You cannot make a switch in another switch
Reply
#6

Quote:
Originally Posted by Sascha
Посмотреть сообщение
I guess you simply can't have a switch within a switch, pawn might mix it up maybe...
at least that's what I understand by that error text... no clue though, but I'd simply try to change one of those switches to "if" and "else if"... (I'd suggest the dialog ID switch to be changed)
Alright i see but there ant a switch in that

EDIT: my bad there is silly me lol
Reply
#7

Код:
case DIALOG_SASD2:
        {
            if(!response)
            {
            	ShowPlayerDialog(playerid, DIALOG_SASD, DIALOG_STYLE_LIST, "SASD Locker", "Duty\nEquipment\nUniform\nSelect Skin", "Ok", "Close");
				return 1;
			}
			if(response)
			{
			    switch(listitem)
			    {
			        case 0:
			        {
			        SkipWepCheck(playerid);
					GivePlayerValidWeapon(playerid, 24, 100);
					}
					case 1:
made the second switch part bold...
Reply
#8

i duno how to what should i change it to

EDIT: FIXED IT
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)