Unrachable Code
#1

pawn Код:
{
    new pName[MAX_PLAYER_NAME];
    new String[128];
    new Anti;
    new R;
    while(strlen(text[Anti]))
    {
      if('0' <= text[Anti] <= '9')
      {
        new Anti2 = Anti+1;
        new P;
        while(P == 0)
        {
          if('0' <= text[Anti2] <= '9' && strlen(text[Anti2])) Anti2 ++;
          else
          {
            strmid(String[R] , text , Anti , Anti2 , 255);
            if(strval(String[R]) < 255) R ++;
            Anti = Anti2;
            P = 1;
          }
        }
      }
      Anti ++;
    }
    if(R >= 4)
    {
      for(new z = 0; z < R; z++)
      {
        new AntiServer;
        while((AntiServer = strfind(text,String[z] , true)) !=-1)
        for(new i = AntiServer,j = AntiServer+strlen(String[z]); i < j; i ++) text[i] = '*';
        if(Warnings[playerid] == 3)
        {
          GetPlayerName(playerid,pName,sizeof(pName));
          format(String,sizeof(String),"\"%s\" {FFFF00}Has Kicked From The Server ({FF0000C}Reason: {FFFF00}Server Publishing)",pName);
          SendClientMessageToAll(0xFF0000C8,String);
          Warnings[playerid] = 0;
          Kick(playerid);
        }
        else
        {
          Warnings[playerid] ++;
          format(String,sizeof(String),"Do Not Advertise Other Servers In Our Server {FF9900}[%d/3]",Warnings[playerid]);
          SendClientMessage(playerid,0xFF0000C8,String);
          }
        return 0;
}
}
    return 1;
}
Error :
pawn Код:
warning 225: unreachable code
Reply
#2

which line ??
Reply
#3

pawn Код:
format(String,sizeof(String),"Do Not Advertise Other Servers On Our Server {FF9900}[%d/3]",Warnings[playerid]);
          SendClientMessage(playerid,0xFF0000C8,String);
        }
        return 0;
      }
    }
    return 1;
}
Reply
#4

what is the
pawn Код:
return 0;
supposed to break?
comment it out, and see what happens.
Reply
#5

Quote:
Originally Posted by Babul
Посмотреть сообщение
what is the
pawn Код:
return 0;
supposed to break?
comment it out, and see what happens.
same error ..
Reply
#6

its close to impossible that the compiler complains unreachable code after
pawn Код:
Warnings[playerid] ++;
...not being able to reach a simple format() after that.
maybe post the whole command, and add a //comment for the line?
edit: nvm. i still come to the conclusion that the return 0; breaks the for loop, therefore the return 1; cannot be reached.
edit2: and iam wrong? i added
pawn Код:
new text[256];
new Warnings[MAX_PLAYERS];
CMD:test2(playerid,params[])
{
    new pName[MAX_PLAYER_NAME];
    new String[128];
    new Anti;
//...
..to be able to compile the command. it doesnt show any warning here o.O

edit3: erm. i need to ask a stupid question: is it LINE 225 you posted? read the whole report, it may show a different line number before the warning. like
(659): warning 225: unreachable code

btw, do this:
pawn Код:
return 1;
return 0;
then you force another warning about the return 0; not getting executed. try it
Reply
#7

Quote:
Originally Posted by Babul
Посмотреть сообщение
its close to impossible that the compiler complains unreachable code after
pawn Код:
Warnings[playerid] ++;
...not being able to reach a simple format() after that.
maybe post the whole command, and add a //comment for the line?
edit: nvm. i still come to the conclusion that the return 0; breaks the for loop, therefore the return 1; cannot be reached.
edit2: and iam wrong? i added
pawn Код:
new text[256];
new Warnings[MAX_PLAYERS];
CMD:test2(playerid,params[])
{
    new pName[MAX_PLAYER_NAME];
    new String[128];
    new Anti;
//...
..to be able to compile the command. it doesnt show any warning here o.O

edit3: erm. i need to ask a stupid question: is it LINE 225 you posted? read the whole report, it may show a different line number before the warning. like
(659): warning 225: unreachable code

btw, do this:
pawn Код:
return 1;
return 0;
then you force another warning about the return 0; not getting executed. try it
full code please ..
Reply
#8

UP ..
Reply
#9

Don't bump your posts please, Nobody will reply to them with an answer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)