function should return a value? But i use return..
#1

Ahoy friends.

Thats my function to check if there is only one team left in my gamemode.
I love to use recursive functions so thats it!

Код:
stock TeamsAlive(bool:value)
{
	new i=0,count=0;
	while(i<TEAMSIZE)
	{
		if(GetTeamCount(i) > 0)
		{
			count++;
		}
		i++;	
	}
	if(bool:value == false)
	switch(count)
	{
		case 1:
		{
			switch(TeamsAlive(true))
			{
				case FIRST_TEAM:
				{
					for(new i;i<MAX_PLAYERS;i++)
					{
						SendClientMessageEx(i,COLOR_WHITE,"SERVER: All remaining teams have been wiped. Team %s {FFFFFF}has won the game!",FIRST_TEAM_COLOR_TAG);
					}	
				}
				case SECOND_TEAM:
				{
					for(new i;i<MAX_PLAYERS;i++)
					{
						SendClientMessageEx(i,COLOR_WHITE,"SERVER: All remaining teams have been wiped. Team %s {FFFFFF}has won the game!",SECOND_TEAM_COLOR_TAG);
					}	
				}
				#if defined TEAMSIZE
				#if TEAMSIZE >= 3
				case THIRD_TEAM:
				{
					for(new i;i<MAX_PLAYERS;i++)
					{
						SendClientMessageEx(i,COLOR_WHITE,"SERVER: All remaining teams have been wiped. Team %s {FFFFFF}has won the game!",THIRD_TEAM_COLOR_TAG);
					}	
				}
				#endif
				#endif
				#if defined TEAMSIZE
				#if TEAMSIZE >= 4
				case FOURTH_TEAM:
				{
					for(new i;i<MAX_PLAYERS;i++)
					{
						SendClientMessageEx(i,COLOR_WHITE,"SERVER: All remaining teams have been wiped. Team %s {FFFFFF}has won the game!",FOURTH_TEAM_COLOR_TAG);
					}	
				}
				#endif
				#endif
				#if defined TEAMSIZE
				#if TEAMSIZE >= 5
				case FIFTH_TEAM:
				{
					for(new i;i<MAX_PLAYERS;i++)
					{
						SendClientMessageEx(i,COLOR_WHITE,"SERVER: All remaining teams have been wiped. Team %s {FFFFFF}has won the game!",FIFTH_TEAM_COLOR_TAG);
					}	
				}
				#endif
				#endif
				#if defined TEAMSIZE
				#if TEAMSIZE == 6
				case SIXTH_TEAM:
				{
					for(new i;i<MAX_PLAYERS;i++)
					{
						SendClientMessageEx(i,COLOR_WHITE,"SERVER: All remaining teams have been wiped. Team %s {FFFFFF}has won the game!",SIXTH_TEAM_COLOR_TAG);
					}	
				}
				#endif
				#endif
			}
		}
	}
	if(bool:value == true && count == 1)//Returns the ID of the remaining team
	return i;
	
}
But the compiler says: warning 209: function "TeamsAlive" should return a value
Where is the problem?
Reply


Messages In This Thread
function should return a value? But i use return.. - by faxxe - 21.03.2017, 15:34
Re: function should return a value? But i use return.. - by SyS - 21.03.2017, 15:41
Re: function should return a value? But i use return.. - by faxxe - 21.03.2017, 15:57
Re: function should return a value? But i use return.. - by SyS - 21.03.2017, 17:00
Re: function should return a value? But i use return.. - by OneDay - 21.03.2017, 22:08

Forum Jump:


Users browsing this thread: 1 Guest(s)