SA-MP Forums Archive
Team Balance when the MapEnd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Team Balance when the MapEnd (/showthread.php?tid=567091)



Team Balance when the MapEnd - arlindi - 10.03.2015

Hello Everyone I have the function EndMap

I want to add in it when the map end
Set some zombies and other humans
I want it to be combinate example if
Players online 5 Set 2 Zombie and 3 Humans
But i want the server to do it automaticly
Soo The team Human Have more Players Than Zombie

Thanks you
If you dont understand nothing please tell mee i will try to explain again it


Re: Team Balance when the MapEnd [+REP] - Medscripter - 10.03.2015

https://sampforum.blast.hk/showthread.php?tid=224853
check this


Re: Team Balance when the MapEnd [+REP] - arlindi - 10.03.2015

Thanks for it but
I said in EndMap Function
I dont want on player request class


Re: Team Balance when the MapEnd [+REP] - Medscripter - 10.03.2015

you can post the Fuction code


Re: Team Balance when the MapEnd [+REP] - Evocator - 10.03.2015

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;
}



Re: Team Balance when the MapEnd [+REP] - arlindi - 10.03.2015

No no you didnt understand mee
Lisen... I want when I call the StartMap function
I want just to get an team balance like as said the theard up


Re: Team Balance when the MapEnd [+REP] - Evocator - 11.03.2015

Yes, call that function under the StartMap or whatever.


Re: Team Balance when the MapEnd [+REP] - arlindi - 11.03.2015

Not Work I tested


Re: Team Balance when the MapEnd [+REP] - arlindi - 19.03.2015

AnyOne now ?


Re: Team Balance when the MapEnd - arlindi - 20.03.2015

Heyy ??