21.03.2017, 15:34
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!
But the compiler says: warning 209: function "TeamsAlive" should return a value
Where is the problem?
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; }
Where is the problem?