SA-MP Forums Archive
warning 225: unreachable code - Help and get a REP !! - 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: warning 225: unreachable code - Help and get a REP !! (/showthread.php?tid=419694)



warning 225: unreachable code - Help and get a REP !! - Jaber_Brown - 01.03.2013

I got this
pawn Код:
if(newkeys & KEY_SPRINT)
{
    if(GetPVarInt(playerid, "UsingBuyMenu") > 0)
        {// Purchased a vehicle
            new ID = GetPVarInt(playerid, "BuySelection");
            switch (GetPVarInt(playerid, "UsingBuyMenu"))
            {
                case 1:
                {
                    if(PlayerInfo[playerid][pCash] >= NormalVehicleInfo[ID][carprice])
                    {
                        //if(PlayerInfo[playerid][pConnectTime] < NormalVehicleInfo[ID][carlevel])
                        {
                            //SendClientMessage(playerid,COLOR_RED,"[ERROR]: You're time in Los Santos is too low to get this vehicle.");
                            return 1;
                        }
                        PlayerInfo[playerid][pUsingSkin] = 2;
                        TogglePlayerSpectating(playerid, 0);
                        DestroyVehicle(GetPVarInt(playerid, "VehicleID"));
                        SetPVarInt(playerid, "UsingBuyMenu", 0);
                        TextDrawHideForPlayer(playerid,VehicleBuy[playerid]);
                        SetPVarInt(playerid, "VehicleType", 1);
                    }
                    else
                    {
                        SendClientMessage(playerid,COLOR_RED,"[ERROR]: You cannot afford this vehicle.");
                    }
                }
            }
        }

}
When I compile I get his

Код:
RP.pwn(8559) : warning 225: unreachable code



Re: warning 225: unreachable code - Help and get a REP !! - Vince - 01.03.2013

It's pretty obvious, really. You commented out your condition so the code in that block will always be executed.


Re: warning 225: unreachable code - Help and get a REP !! - Babul - 01.03.2013

thats why i mostly use the /* */ comment style hehe