Warning 225: unreachable code
#1

After compilling i got this warning.

Код:
C:\Users\Rares\Desktop\Focux RPG\gamemodes\focux.pwn(48954) : warning 225: unreachable code
Line 48954

Код:
new year, month,day;
I tried to replace/delete the content of this line but everytime this warning comes.

Sorry for my bad english.
Reply
#2

There's no problem with this.Show me some lines before the codes you've provided.
Reply
#3

it usually caused due to placing of a code just after "return" line
Reply
#4

This thread might help you out.Errors and Warnings.
Reply
#5

The error clearly says that a specific code will NEVER get excecuted as the exception above will always be true.
Reply
#6

Quote:
Originally Posted by Sojo12
Посмотреть сообщение
There's no problem with this.Show me some lines before the codes you've provided.
Код:
	    			new year, month,day;
					getdate(year, month, day);
					format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
					BanLog(string);
					format(string, sizeof(string), "{ffe100}Info: %s{a9c4e4} a primit ban de la %s , motiv: %s", giveplayer, sendername, (result));
					SendClientMessageToAll(COLOR_LIGHTRED, string);
					new playersip[256];
					GetPlayerIp(giveplayerid,playersip,sizeof(playersip));
					strmid(PlayerInfo[giveplayerid][pIP], playersip, 0, 100, 255);
					Update(giveplayerid, pIPx);
					//OnPlayerUpdateEx(giveplayerid);
					Kick(giveplayerid);
					return 1;
					}
					new year, month,day;
Reply
#7

Man, show all of it if you want proper answers.
Reply
#8

Код:
	if(strcmp(cmd, "/ban", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{00FF00}Folosire:{FFFFFF} /ban [playerid/numejucator] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
		    if(IsPlayerConnected(giveplayerid))
		    {
		        if(giveplayerid != INVALID_PLAYER_ID)
		        {
					//if(bantime[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "** Incerci sa banezi serverul?");
				    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					GetPlayerName(playerid, sendername, sizeof(sendername));
					new length = strlen(cmdtext);
					while ((idx < length) && (cmdtext[idx] <= ' '))
					{
						idx++;
					}
					new offset = idx;
					new result[128];
					while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
					{
						result[idx - offset] = cmdtext[idx];
						idx++;
					}
					result[idx - offset] = EOS;
					if(!strlen(result))
					{
						SendClientMessage(playerid, COLOR_GRAD2, "{00FF00}Folosire:{FFFFFF} /ban [playerid/numejucator] [reason]");
						return 1;
					}
					if(PlayerInfo[giveplayerid][pAdmin] > 0 && PlayerInfo[playerid][pAdmin] < 6)
		            {
						SendClientMessage(playerid, COLOR_WHITE, "{FFAF00}ADMWARNING: {FFFFFF}Nu poti bana admini!");
						format(string, sizeof(string), "{ffe100}AdmCmd: %s a incercat sa il baneze pe %s cu motivul: %s", sendername, giveplayer, (result));
						ABroadCast(COLOR_LIGHTRED, string, 1);
						//ABroadCast(COLOR_LIGHTRED, string, 1);
						return 1;
		            }
		            if(strmatch(giveplayer, DEVELOPMENT)) return SendClientMessage(playerid, COLOR_WHITE, "{FFAF00}Ban: {FFFFFF}Dude, don't do that.");
					if(BanTimer[playerid] > 0)
					{
						format(string, sizeof(string), "{ffe100}Info: {a9c4e4}Asteapta %d secunde inainte sa mai folosesti aceasta comanda.",BanTimer[playerid]);
						SendClientMessage(playerid, COLOR_WHITE, string);
					}
					{
	    			new year, month,day;
					getdate(year, month, day);
					format(string, sizeof(string), "AdmCmd: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
					BanLog(string);
					format(string, sizeof(string), "{ffe100}Info: %s{a9c4e4} a primit ban de la %s , motiv: %s", giveplayer, sendername, (result));
					SendClientMessageToAll(COLOR_LIGHTRED, string);
					new playersip[256];
					GetPlayerIp(giveplayerid,playersip,sizeof(playersip));
					strmid(PlayerInfo[giveplayerid][pIP], playersip, 0, 100, 255);
					Update(giveplayerid, pIPx);
					//OnPlayerUpdateEx(giveplayerid);
					Kick(giveplayerid);
					return 1;
					}
					new year, month,day; // line with warning
					getdate(year, month, day);
					format(string, sizeof(string), "Info: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
					BanLog(string);
					format(string, sizeof(string), "{ffe100}Info: %s a primit ban de la %s, motiv: %s", giveplayer, sendername, (result));
					SendClientMessageToAll(COLOR_LIGHTRED, string);
					PlayerInfo[giveplayerid][pReg] = -999; Update(giveplayerid, pRegisteredx);
					//jBan(giveplayerid, playerid, result, time);
					new playersip[256];
					GetPlayerIp(giveplayerid,playersip,sizeof(playersip));
					strmid(PlayerInfo[giveplayerid][pIP], playersip, 0, 100, 255);
					Update(giveplayerid, pIPx);
  					new query[512];
					format(query, sizeof(query) ,"INSERT INTO `banslog` (`BanID`,`user_banned`,`user_banned_ip`,`user_banner`,`ban_reason`,`ban_timestamp`,`ban_time`) VALUES ('','%s','%s','%s','%s',CURRENT_TIMESTAMP,'%d')",
					giveplayer,
					PlayerInfo[giveplayerid][pIP],
					sendername,
					result,
					0);
					mysql_query(query);
					Ban(giveplayerid);
					return 1;
				}
			}//not connected
		}
		return 1;
	}
Search for "// line with warning" to find the problem line.
Reply
#9

Remove the 4th "return 1;".

...
//OnPlayerUpdateEx(giveplayerid);
Kick(giveplayerid);
return 1;
...
Reply
#10

Solved! Rep+!
Thanks a lot!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)