unreachable code
#1

Error:
Код:
(1343) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

1 Warning.
Error line:
Код:
1343: 	return 1;
Full code:
Код:
public OnPlayerRequestClass(playerid, classid)
{
	new string[MAX_PLAYER_NAME];
 	new plname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, plname, sizeof(plname));
	format(string, sizeof(string), "mg/%s.ini", plname);
	if(fexist(string))
	{
		gPlayerAccount[playerid] = 1;
		SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are a registered citizen of San Andreas.");
		SendClientMessage(playerid, COLOR_WHITE, "SERVER: Use /login [password] to log in to your account.");
		return 1;
	}
	else
	{
		gPlayerAccount[playerid] = 0;
		SendClientMessage(playerid,COLOR_WHITE,"SERVER: Your'e are not registered,type to register, /register [password]");
		return 1;
	}
	return 1;
}
Reply
#2

try this
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    new string[MAX_PLAYER_NAME];
    new plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
    format(string, sizeof(string), "mg/%s.ini", plname);
    if(fexist(string))
    {
        gPlayerAccount[playerid] = 1;
        SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are a registered citizen of San Andreas.");
        SendClientMessage(playerid, COLOR_WHITE, "SERVER: Use /login [password] to log in to your account.");
        return 1;
    }
    else
    {
        gPlayerAccount[playerid] = 0;
        SendClientMessage(playerid,COLOR_WHITE,"SERVER: Your'e are not registered,type to register, /register [password]");
    }
    return 1;
}
Reply
#3

a 'return' breaks the code immediatly, so your code will never reach the last return 1;. But the last one also isn't needed so you can remove it. But you also don't need to 2 returns in the 'if' if you have the one at the end
Reply
#4

ty m8.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)