warning 225: unreachable code
#6

Quote:
Originally Posted by Joe Staff
Посмотреть сообщение
pawn Код:
dcmd_goto(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid))
    {
        if(!strlen(params)) return
            SendClientMessage(playerid, LIGHTBLUE2, "Usage: /goto [PlayerID]") &&
                SendClientMessage(playerid, orange, "Function: Will Go to specified player");

        new player1;
        new string[128];

        if(!IsNumeric(params))
            player1 = ReturnPlayerID(params);
        else player1 = strval(params);

        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid)

            if(NotAllowedGoto[player1] == 1) return SendClientMessage(playerid, red, "ERROR: This player is not allowing players to teleport to them");

            //{ //Invalid brace
        SendCommandToAdmins(playerid,"Goto");
        new Float:x, Float:y, Float:z;  GetPlayerPos(player1,x,y,z);
        SetPlayerInterior(playerid,GetPlayerInterior(player1));
        SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player1));

        if(GetPlayerState(playerid) == 2)
        {
            SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z);
            LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(player1));
            SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player1));
        }
        else SetPlayerPos(playerid,x+2,y,z);

        format(string,sizeof(string),"|- You have Teleported to \"%s\" -|", pName(player1));
        return SendClientMessage(playerid,BlueMsg,string); //This is end
            //} //Invalid brace
        return ErrorMessages(playerid, 4);//line 4727 //After the end
    }
    else return ErrorMessages(playerid, 1);
}
Indenting your code properly showed where your problem is (near the end)


EDIT: Gamer_Z beat me to it.
Those breaces are not really incorrect (from programming perspective), this is totally valid programming, for example:

pawn Код:
dcmd_x(playerid,params[])
{
    new a = 0;
    {
        new b = 1;
        printf("%d%d",a,b);
        //b gets destroyed
    }
    {
        new b = 2;//no error, totally valid
        printf("%d%d",a,b);
    }
    //prints:
    //01
    //02
    printf("%d%d",a,b); //error, undefined symbol "b"
    return 0
}
Reply


Messages In This Thread
warning 225: unreachable code - by Guest123 - 11.05.2013, 00:18
Re: warning 225: unreachable code - by OpticKiller - 11.05.2013, 00:24
Re: warning 225: unreachable code - by Guest123 - 11.05.2013, 00:32
Re: warning 225: unreachable code - by Gamer_Z - 11.05.2013, 00:54
Re: warning 225: unreachable code - by Joe Staff - 11.05.2013, 01:02
Re: warning 225: unreachable code - by Gamer_Z - 11.05.2013, 01:06
Re: warning 225: unreachable code - by Joe Staff - 11.05.2013, 01:10
Re: warning 225: unreachable code - by Gamer_Z - 11.05.2013, 01:17

Forum Jump:


Users browsing this thread: 1 Guest(s)