SA-MP Forums Archive
Help to FIX a warning 225: unreachable code - 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: Help to FIX a warning 225: unreachable code (/showthread.php?tid=523275)



Help to FIX a warning 225: unreachable code - huydollar - 01.07.2014

my code have a
Код:
warning 225: unreachable code
can you help me to fix this
line of this warning
Код:
if(dialogid == DIALOG_REFUND)
	{
	    if(response)
	    {
	    if(listitem == 0)
	    {
			if(PlayerInfo[playerid][pCoin] >= 0)
			{
				SendClientMessage(playerid , COLOR_WHITE,"Ban da duoc Refund Vip Gold 3days + 10tokens");
	    		PlayerInfo[playerid][pDonateRank] = 3;
    			PlayerInfo[playerid][pTokens] = 10;
	    		PlayerInfo[playerid][pVIPExpire] = gettime()+259200*1;
			}
			else
			{
			SendClientMessage(playerid,COLOR_GREY,"ERROR : ban khong du Coin ");
			}
		}
		if(listitem == 1)
		{
		    if(PlayerInfo[playerid][pCoin] >= 0)
			{
			    SendClientMessage(playerid,  COLOR_WHITE,"Ban da duoc Refund Vip Bac 15days + 12 Tokens");
  			  PlayerInfo[playerid][pDonateRank] = 1;
	    		PlayerInfo[playerid][pTokens] = 12;
		    	PlayerInfo[playerid][pVIPExpire] = gettime()+1296000*1;
			}
			else
			{
			SendClientMessage(playerid,COLOR_GREY,"ERROR : ban khong du Coin ");
			}
		}
 		if(listitem == 2)
		{
		    if(PlayerInfo[playerid][pCoin] >= 0)
			{
			    SendClientMessage(playerid,  COLOR_WHITE,"Ban da duoc Refund 500,000$");
			    GivePlayerCash(playerid, 500000);
			}
			else
			{
			SendClientMessage(playerid,COLOR_GREY,"ERROR : ban khong du Coin ");
			}
		}
 		if(listitem == 3)
		{
		    if(PlayerInfo[playerid][pCoin] >= 0)
			{
   				SendClientMessage(playerid,  COLOR_WHITE,"Ban da duoc Refund Cap 2");
			    PlayerInfo[playerid][pLevel] = 2;
			}
			else
			{
			SendClientMessage(playerid,COLOR_GREY,"ERROR : ban khong du Coin ");
				}
			}
		}
		return 1;
	}



Re: Help to FIX a warning 225: unreachable code - HyDrAtIc - 01.07.2014

First of all, warnings do NOT affect your script at all, second thing, you've showed us the whole code, not the line, so please, show us which line exactly has the warning.


Re: Help to FIX a warning 225: unreachable code - Vince - 01.07.2014

Quote:
Originally Posted by HyDrAtIc
Посмотреть сообщение
First of all, warnings do NOT affect your script at all
Yes, they DO. Especially this one. If they don't affect your script, then why do we need the warnings in the first place? Warnings are thrown for common mistakes and compiler assumptions.

@OP: Check the lines just above the snippet you posted. There is probably a return that shouldn't be there.