Danke @Kaliber
habe es nicht 1:1 uebernommen weil ich es irgendwie nicht ganz verstanden habe
Habe es daher als Denkanstoss genommen, hoffe mein Erzeugniss ist auch halbwegs effizient
stock TeamsAlive(bool:value)
{
new i=0,count=0;
while(i<TEAMSIZE)
{
if(GetTeamCount(i) > 0)
{
count++;
}
i++;
}
if(bool:value == false)//Returns the amount of remaining teams
return count;
if(bool:value == true && count == 1)//Returns the ID of the remaining team
return i;
}
stock isEnd()
{
switch(TeamsAlive(false))
{
case 0:
{
SendClientMessageToAll(COLOR_WHITE,"SERVER: All teams have been wiped. No one has won the game!");
}
case 1:
{
switch(TeamsAlive(true))
{
case 0:
{
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 1:
{
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 2:
{
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 3:
{
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 4:
{
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 5:
{
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
}
printf("Total game time: %d",totaltime);
SendRconCommand("gmx");
}
default:
{
}
}
}
Alles anzeigen
Jedoch meckert der Compiler dass TeamsAlive ein value returnen soll 