need help fixing this
#1

So, I guess I have bugged my dialog in this dialog:
pawn Код:
if(dialogid == 9000) { // Setting Admin Flags
        if(response) {
            new giveplayerid = AdminEdit[playerid];
            switch(listitem) {
                case 0: { // Basic Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_Basic] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_Basic] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Refund] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Scripter] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Event] = 0;
                        PlayerInfo[giveplayerid][pAdmin_House] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Business] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Control] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Unban] = 0;
                        PlayerInfo[giveplayerid][pAdmin_RangeBan] = 0;
                        PlayerInfo[giveplayerid][pAdmin_FamFac] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Chat] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Hidden] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Vehicle] = 0;
                        PlayerInfo[giveplayerid][pAdmin_All] = 0;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your Admin status has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_Basic] = 1;
                        PlayerInfo[giveplayerid][pAdmin_Refund] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Scripter] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Event] = 0;
                        PlayerInfo[giveplayerid][pAdmin_House] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Business] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Control] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Unban] = 0;
                        PlayerInfo[giveplayerid][pAdmin_RangeBan] = 0;
                        PlayerInfo[giveplayerid][pAdmin_FamFac] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Chat] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Hidden] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Vehicle] = 0;
                        PlayerInfo[giveplayerid][pAdmin_All] = 0;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given the Basic admin flag.");
                    }
                } case 1: { // Refund Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_Refund] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_Basic]--;
                        PlayerInfo[giveplayerid][pAdmin_Refund] = 0;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your Refund admin flag has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_Refund] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Basic]++;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given the Refund admin flag.");
                    }
                } case 2: { // Scripter Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_Scripter] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_Scripter] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Basic]--;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your Scripter flag has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_Scripter] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Basic]++;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given the Scripter flag.");
                    }
                } case 3: { // Event Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_Event] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_Event] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Basic]--;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your Event admin flag has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_Event] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Basic]++;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given the Event admin flag.");
                    }
                } case 4: { // House Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_House] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_House] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Basic]--;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your House admin flag has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_House] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Basic]++;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given the House admin flag.");
                    }
                } case 5: { // Business Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_Business] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_Business] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Basic]--;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your Business admin flag has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_Business] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Basic]++;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given the Business admin flag.");
                    }
                } case 6: { // Control Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_Control] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_Control] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Basic]--;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your Control admin flag has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_Control] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Basic]++;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given the Control admin flag.");
                    }
                } case 7: { // Unban Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_Unban] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_Unban] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Basic]--;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your Unban admin flag has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_Unban] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Basic]++;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given the Unban admin flag.");
                    }
                } case 8: { // RangeBan Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_RangeBan] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_RangeBan] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Basic]--;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your RangeBan admin flag has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_RangeBan] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Basic]++;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given the RangeBan admin flag.");
                    }
                } case 9: { // FamFac Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_FamFac] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_FamFac] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Basic]--;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your Family/Faction admin flag has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_FamFac] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Basic]++;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given the Family/Faction admin flag.");
                    }
                } case 10: { // Chat Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_Chat] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_Chat] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Basic]--;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your Chat admin flag has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_Chat] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Basic]++;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given the Chat admin flag.");
                    }
                } case 11: { // Hidden Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_Hidden] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_Hidden] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Basic]--;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your Hidden admin flag has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_Hidden] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Basic]++;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given the Hidden admin flag.");
                    }
                } case 12: { // Vehicle Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_Vehicle] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_Vehicle] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Basic]--;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your Vehicle admin flag has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_Vehicle] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Basic]++;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given the Vehicle admin flag.");
                    }
                } case 13: { // All Admin Flag
                    if(PlayerInfo[giveplayerid][pAdmin_All] > 0) {
                        PlayerInfo[giveplayerid][pAdmin_All] = 0;
                        PlayerInfo[giveplayerid][pAdmin_Basic]--;
                        SCM(giveplayerid, COLOR_YELLOW2, "Your 'All' admin flag has been removed.");
                    } else {
                        PlayerInfo[giveplayerid][pAdmin_Basic] = 13;
                        PlayerInfo[giveplayerid][pAdmin_Refund] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Scripter] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Event] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_House] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Business] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Control] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Unban] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_RangeBan] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_FamFac] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Chat] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Hidden] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_Vehicle] = 9999;
                        PlayerInfo[giveplayerid][pAdmin_All] = 9999;
                        SCM(giveplayerid, COLOR_YELLOW2, "You have been given every admin flag.");
                    }
                }
                ShowAdminMenu(playerid, giveplayerid);
            }
        }
        return 1;
    }
But I do not know where I went wrong as it crashes when I compile it with this. Please help?
Reply
#2

There are some missing braces somewhere.
Reply
#3

But there isn't.. I've checked it in BracketFix © iPLEOMAX and there was nothing wrong.
Reply
#4

but when you remove that? your pawno compiler doesn't crash? just need to make sure if the problem is there.
Reply
#5

so.. i fixed it. not sure why this fixed it, but I had "ShowAdminMenu(playerid, giveplayerid);" after the switch, and so I placed it before the switch, and it compiles?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)