Team Balance when the MapEnd
#5

I made this function along time ago once i began scripting. Its just to give you an idea, you can use it anyways (not tested).

Код:
stock fxnX()
{
	new 
		humans, zombies, total
	;
	foreach (new i : Player)
	{
		switch (gTeam[i]) 
		{
			case TEAM_HUMAN: humans++;
			case TEAM_ZOMBIE: zombies++;
		}
		total++;
	}
	if (humans < zombies)
	{
		//more zombies
		new 
			humancount = floatround((total/2), floatround_floor) + 1/*Humans will always have 1 extra player*/,
			zombiecount = total - humancount
		;
		foreach (new i : Player)
		{
			if (humancount > 0) //humans can still get a member?
			{
				gTeam[i] = TEAM_HUMAN; //set that guy
				humancount--; //decrease the var
				continue; //skip that loop to avoid continuation
			}

			if (zombiecount > 0) //zombies can count?
			{
				gTeam[i] = TEAM_ZOMBIE; //set as zombie
				zombiecount--; //count decrease
			}
		}
	}
	else SendClientMessageToAll(-1, "Teams are balanced")
	
	return 1;
}
Reply


Messages In This Thread
Team Balance when the MapEnd - by arlindi - 10.03.2015, 21:00
Re: Team Balance when the MapEnd [+REP] - by Medscripter - 10.03.2015, 21:24
Re: Team Balance when the MapEnd [+REP] - by arlindi - 10.03.2015, 21:26
Re: Team Balance when the MapEnd [+REP] - by Medscripter - 10.03.2015, 21:33
Re: Team Balance when the MapEnd [+REP] - by Evocator - 10.03.2015, 22:03
Re: Team Balance when the MapEnd [+REP] - by arlindi - 10.03.2015, 22:59
Re: Team Balance when the MapEnd [+REP] - by Evocator - 11.03.2015, 05:40
Re: Team Balance when the MapEnd [+REP] - by arlindi - 11.03.2015, 12:01
Re: Team Balance when the MapEnd [+REP] - by arlindi - 19.03.2015, 20:53
Re: Team Balance when the MapEnd - by arlindi - 20.03.2015, 17:17

Forum Jump:


Users browsing this thread: 3 Guest(s)