Warning 225: Unreachable Code [PAWN]
#10

This is the exact same code:

pawn Код:
CMD:handsup(playerid, params[])
{
    if (GetPlayerState(playerid) != 1 && GetPlayerState(playerid) != 2 && GetPlayerState(playerid) != 3 && GetPlayerState(playerid) != 7)
    {
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
        {
            return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot use animations while in the vehicle!");
        }
    }
   
    return SendClientMessage(playerid, COLOR_RED, "[Spawned]: You must be spawned, To use this command!");
   
    if (pInfo[playerid][Freeze] == 1)
    {
        return SendClientMessage(playerid, COLOR_RED, "[Error]: You are frozen, Cannot use this command!");
    }
   
    SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
    SendAdminCMD(playerid, "handsup");
   
    return 1;
}
Do you see it now?
Your code will always do the return statement in the middle, which means the code below can never be reached (hence "unreachable").


So please, please, just INDENT YOUR CODE AND USE BRACES.
Reply


Messages In This Thread
Warning 225: Unreachable Code [PAWN] (FIXED) - by DarkPower010 - 11.06.2013, 10:49
Re: warning 225: unreachable code - by rpg894 - 11.06.2013, 10:51
Re: Warning 225: Unreachable Code [PAWN] - by DarkPower010 - 11.06.2013, 10:52
Re: Warning 225: Unreachable Code [PAWN] - by rpg894 - 11.06.2013, 10:53
Re: Warning 225: Unreachable Code [PAWN] - by DarkPower010 - 11.06.2013, 11:00
AW: Re: Warning 225: Unreachable Code [PAWN] - by HurtLocker - 11.06.2013, 11:03
Re: Warning 225: Unreachable Code [PAWN] - by [ABK]Antonio - 11.06.2013, 11:03
Re: Warning 225: Unreachable Code [PAWN] - by Sascha - 11.06.2013, 11:06
Re: Warning 225: Unreachable Code [PAWN] - by DarkPower010 - 11.06.2013, 11:07
Re: Warning 225: Unreachable Code [PAWN] - by Slice - 11.06.2013, 11:09

Forum Jump:


Users browsing this thread: 4 Guest(s)