Duplicate case label
#1

What the hell is wrong? I'm getting "duplicate "case" label (value 11) at this code placed on OnDialogResponse:

pawn Code:
/* ---- Commands Dialog ---- */
        case DIALOG_COMMANDS:
        {
            if(!response) return 1;

            switch(listitem)
            {
                case 0: ShowGeneralCmds(playerid);
                case 1: ShowPMCmds(playerid);
                case 2: ShowGarageCmds(playerid);
                case 3: ShowCrateCmds(playerid);
                case 4: ShowCollectiblesCmds(playerid);
                case 5: ShowBountyCmds(playerid);
                case 6: ShowReputationCmds(playerid);
                case 7: ShowCookiesCmds(playerid);
                case 8: ShowPartyCmds(playerid);
                case 9: ShowDeathmatchCmds(playerid);
                case 10: ShowTeleportCmds(playerid);
            }
        }
        /* ------------------------- */
Reply
#2

Well it\'s not that one.
Reply
#3

Check your dialog's id. Probably you have some contrast.
Try to insert these in enum.
Reply
#4

find somethere "case 11:" in your code and delete case, which is duplicated.
Reply
#5

Duplicate "case label (value 11)" means you duplicated case dialog 11 in your switch. You may have some defines with same id of your dialog too, check out.
Reply
#6

So I said it isn’t that one, referring to the inner switch in the code you posted. I forgot about the outer one - what is the value of DIALOG_COMMANDS? I guess 11, and I also guess another dialog is also 11. I suggest using far more unique IDs, like 56940983 instead of common numbers like 0-99.
Reply
#7

I don't even use ID's for dialogs. I place them in an enum.

pawn Code:
enum
{
DIALOG_TEST,
DIALOG_CMDS,
//And so on..
}
And the problem is only with this dialog because with other dialogs there are no problems.

However i searched for case 11: and found nothing on OnDialogResponse.
Reply
#8

You might have placed the same dialog id twice.
Which exact line is the error line? Search for that one to find it.
Reply
#9

It's impossible to place same dialog ID because they're stored in an enum. The error line is referred to case DIALOG_COMMANDS: and i seriously can't see where Pawno has took out this "case 11" from. This is stupid.
Reply
#10

Assign a value to the very first value in your enum, a higher value to be sure it doesn't conflict with any other dialogs.

pawn Code:
enum {
    DIALOG_TEST = 1337,
    DIALOG_CMDS // automatically 1338 and so on...
}
Reply
#11

Ok assigned ID 1300 at first dialog, now:

pawn Code:
error 040: duplicate "case" label (value 1311)
Now i got it, 1311 is the dialog ID assigned to DIALOG_COMMANDS.

I tried #define DIALOG_COMMANDS 5000 (a more higher value) and it worked.

This Pawno is so damn strange.
Reply
#12

So, again, two of your cases have the same ID, I don\'t know whats so strange to understand about that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)