(181) : warning 225: unreachable code
#1

180. // Display a message if the player hasn't accepted the rules yet
181. if(APlayerData[playerid][RulesRead] == false)
182. {
183. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You haven't accepted the {FFFF00}/rules{FF0000} yet");
184. }
185. return 1;
186.}


Got only 1 error but can't find it
Reply
#2

Unreachable code is when you use return and the next line has something that could be executed, something like this

pawn Код:
SendClientMessage(playerid, 0xFF000000, "Next send client message will occur a unreachable code error");
return 1;
SendClientMessage(playerid, 0xFF000000, "BAM ERROR");
In your code it doesn't seem to be like that. You can either fix it yourself using my example or provide more code.
Reply
#3

like this?

Код:
	// Display a message if the player hasn't accepted the rules yet
    if(APlayerData[playerid][RulesRead] == false)
	{
    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You haven't accepted the {FFFF00}/rules{FF0000} yet");
    }
	return 1;
}



// This function shows the player how long his ban still is when he tries to login (in days, hours, minutes, seconds)
ShowRemainingBanTime(playerid)
{
	// Setup local variables
	new TotalBanTime, Days, Hours, Minutes, Seconds, Msg[128];

	// Get the total ban-time
	TotalBanTime = APlayerData[playerid][BanTime] - gettime();

	// Calculate days
	if (TotalBanTime >= 86400)
	{
		Days = TotalBanTime / 86400;
		TotalBanTime = TotalBanTime - (Days * 86400);
	}
	// Calculate hours
	if (TotalBanTime >= 3600)
	{
		Hours = TotalBanTime / 3600;
		TotalBanTime = TotalBanTime - (Hours * 3600);
	}
	// Calculate minutes
	if (TotalBanTime >= 60)
	{
		Minutes = TotalBanTime / 60;
		TotalBanTime = TotalBanTime - (Minutes * 60);
	}
	// Calculate seconds
	Seconds = TotalBanTime;

	// Display the remaining ban-time for this player
	SendClientMessage(playerid, 0xFFFFFFFF, TXT_StillBanned);
	format(Msg, 128, TXT_BannedDuration, Days, Hours, Minutes, Seconds);
	SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}



// This callback gets called when a player disconnects from the server
public OnPlayerDisconnect(playerid, reason)
{
	// Always allow NPC's to logout without password or account
	if (IsPlayerNPC(playerid))
		return 1;
Reply
#4

In which line do you get the error? Also it's better to have the code in this section, ShowRemainingBanTime and OnPlayerDisconnect is useless, we need the previous lines.
Reply
#5

i got error at line 181

Код:
C:\Users\me\Desktop\PPC_Trucking6[1]\PPC_Trucking6\gamemodes\PPC_Trucking.pwn(181) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#6

So, before this line(and it's comment), at 179 there should be a return. Remove it and error gone!
Reply
#7

Thanks, lock please
Reply
#8

thank you very much, it served me for my Server
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)