warning 225: unreachable code
#1

pawn Код:
case DIALOG_QUIZ3:
            {
                if(!response) return Kick(playerid);
                else
                {
                    switch(listitem)
                    {
                        case 0:
                        {
                            KickWithMessage(playerid, RED, "You have answered an incorrect answer and you have been kicked.");
                        }
                        case 1:
                        {
                            return cmd_quizcontinuecommand(playerid, "");
                            QuizStep[playerid] = 4;                    
                        }
                        case 2:
                        {
                            KickWithMessage(playerid, RED, "You have answered an incorrect answer and you have been kicked.");
                        }
                        case 3:
                        {
                            KickWithMessage(playerid, RED, "You have answered an incorrect answer and you have been kicked.");
                        }
                    }              
                }
                return 1;
            }
Can someone help me with this?
I will really thank you for it.
Reply
#2

Which line is the warning?
Reply
#3

QuizStep[playerid] = 4;
Reply
#4

pawn Код:
case DIALOG_QUIZ3:
            {
                if(!response) return Kick(playerid);
                else
                {
                    switch(listitem)
                    {
                        case 0:
                        {
                            KickWithMessage(playerid, RED, "You have answered an incorrect answer and you have been kicked.");
                        }
                        case 1:
                        {
                            cmd_quizcontinuecommand(playerid, "");
                            QuizStep[playerid] = 4;
                            return 1;                  
                        }
                        case 2:
                        {
                            KickWithMessage(playerid, RED, "You have answered an incorrect answer and you have been kicked.");
                        }
                        case 3:
                        {
                            KickWithMessage(playerid, RED, "You have answered an incorrect answer and you have been kicked.");
                        }
                    }              
                }
                return 1;
            }
Reply
#5

What did you change in it?
Reply
#6

pawn Код:
case 1:
                        {
                            return cmd_quizcontinuecommand(playerid, "");
                            QuizStep[playerid] = 4;                    
                        }
QuizStep[playerid] = 4; is unreachable since return ends callback processing right away. So:
pawn Код:
case 1:
                        {
                            return cmd_quizcontinuecommand(playerid, ""); //cmd quiz command continue will occur and callback process will stop
                            QuizStep[playerid] = 4; //this will never be called.
                        }
While his code executes bot 'functions' and then ends callback.
Reply
#7

Now, the thing is that, when I go in-game and do the quiz, I need to enter the command /quizcontinuecommand to get it to work. And when I use it, I need to press on each answer twice. Can someone help me?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)