SA-MP Forums Archive
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: Unreachable code (/showthread.php?tid=427140)



Unreachable code - Stanford - 31.03.2013

Код:
D:\STRUCTURE\test\gamemodes\test123.pwn(34483) : error 010: invalid function or declaration
Here are the lines:
Код:
		}
	    else
	    {
			SetPlayerHealth(playerid,65535.0);
			SetPlayerArmour(playerid,65535.0);
			PlayerSpawnStats[playerid][pstime] = 21;
		             PlayerSpawnStats[playerid][psx] = 2336.9832;
		             PlayerSpawnStats[playerid][psy] = -1244.5867;
		             PlayerSpawnStats[playerid][psz] = 22.5000;
			SetPlayerToTeamColor(playerid);
			SetPlayerPos(playerid,2336.9832,-1244.5867,22.5000); // Warp the player
			SetPlayerFacingAngle(playerid,0.0);
			SetPlayerInterior(playerid,0);
			return 1;
		}
	}
	return 1;
}



Re: Unreachable code - Feastahashi - 31.03.2013

What is exactly the line 34483?


Re: Unreachable code - Abhishek. - 31.03.2013

pawn Код:
}
        else
        {
            SetPlayerHealth(playerid,65535.0);
            SetPlayerArmour(playerid,65535.0);
            PlayerSpawnStats[playerid][pstime] = 21;
                     PlayerSpawnStats[playerid][psx] = 2336.9832;
                     PlayerSpawnStats[playerid][psy] = -1244.5867;
                     PlayerSpawnStats[playerid][psz] = 22.5000;
            SetPlayerToTeamColor(playerid);
            SetPlayerPos(playerid,2336.9832,-1244.5867,22.5000); // Warp the player
            SetPlayerFacingAngle(playerid,0.0);
            SetPlayerInterior(playerid,0);
            return 1;
        }
   
    return 1;
}
may be this could work just guessing as this error occurs to me when i close a extra brace.


Re : Unreachable code - petrux - 31.03.2013

Can we have the line please ?


Re: Unreachable code - Stanford - 31.03.2013

same, doesn't work the line is the return 1;

Quote:

{
SetPlayerHealth(playerid,65535.0);
SetPlayerArmour(playerid,65535.0);
PlayerSpawnStats[playerid][pstime] = 21;
PlayerSpawnStats[playerid][psx] = 2336.9832;
PlayerSpawnStats[playerid][psy] = -1244.5867;
PlayerSpawnStats[playerid][psz] = 22.5000;
SetPlayerToTeamColor(playerid);
SetPlayerPos(playerid,2336.9832,-1244.5867,22.5000); // Warp the player
SetPlayerFacingAngle(playerid,0.0);
SetPlayerInterior(playerid,0);
return 1;
}

THIS ONE return 1;
}




Re: Unreachable code - Dj_maryo1993 - 31.03.2013

Its a simply warning , unrecheable code means it wont get to your line (wich contain return 1 . Just remove return 1 and u will lose that warning . That return 1; will never be called anyway because all the cases have been covered .