SA-MP Forums Archive
Duplicate case label - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Duplicate case label (/showthread.php?tid=665144)



Duplicate case label - SymonClash - 23.03.2019

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);
            }
        }
        /* ------------------------- */



Re: Duplicate case label - Y_Less - 23.03.2019

Well it\'s not that one.


Re: Duplicate case label - h3x - 23.03.2019

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


Re: Duplicate case label - Heress - 23.03.2019

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


Re: Duplicate case label - v1k1nG - 23.03.2019

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.


Re: Duplicate case label - Y_Less - 24.03.2019

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.


Re: Duplicate case label - SymonClash - 24.03.2019

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.


Re: Duplicate case label - NaS - 24.03.2019

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


Re: Duplicate case label - SymonClash - 24.03.2019

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.


Re: Duplicate case label - TheToretto - 24.03.2019

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...
}



Re: Duplicate case label - SymonClash - 24.03.2019

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.


Re: Duplicate case label - Y_Less - 24.03.2019

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