Public feed #891255

Something

public text v1 · immutable
Raw Edit
·published 2008-02-04 14:26 UTC
rendered paste body
forward ModeUpdate();
public ModeUpdate()
{
	if(Current == -1) return 1;
	new string[256], aalive = 0, dalive = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
		if(IsPlayerConnected(i))
		{
 			switch(Player[i][pTeam])
 			{
 				case T_ATT:
				{
					if (GetPlayerScore(i)>0) {
					    aalive=aalive+GetPlayerScore(i);
					}
				}
				case T_DEF:
				{
					if (GetPlayerScore(i)>0) {
					    dalive=dalive+GetPlayerScore(i);
					}
				}
				case T_REF:
				{
					SetPlayerHealth(i, 100);
					SetPlayerArmour(i, 100);
				}
			}
		}
    }
    new attackers_playing=0;
	for(new x=0; x<MAX_PLAYERS; x++) {
		if ((Player[x][pTeam]==T_ATT) && (Player[x][pPlaying])) {
		    attackers_playing++;
		}
	}

	new defenders_playing=0;
	for(new x=0; x<MAX_PLAYERS; x++) {
		if ((Player[x][pTeam]==T_DEF) && (Player[x][pPlaying])) {
		   defenders_playing++;
		}
	}

	if ((attackers_playing<1) || (defenders_playing<1)) {
		SendClientMessageToAll(AAD_COLOR_WHITE,"Round ended, no one is left");
		EndRound();
	}
	
	format(string,200,"~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~r~(KR) Base %d  ~w~]  ~g~a: %d  ~b~d: %d",Current,aalive,dalive);
	
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(Player[i][pPlaying])
		{
			GameTextForPlayer(i,string,1200,3);
		}
	}
    ModeTimer = SetTimer("ModeUpdate",1000,0);
    return 0;
}