[REQUEST] read
#1

I need someone to help me make a team balancer for my server. If you know how to do it, please PM me
Reply
#2

Well that depends on how you have your teams system setup. All you would need to do is add a check to see which team has more players than the other(s). If all teams have the same amount of players then I suppose you could create a random to decide which team they join or just let them freely join whichever they choose.
Reply
#3

Код:
	{
	    team[playerid] = 2;
        infected[playerid] = 0;
		SetPlayerPos(playerid,X,Y,Z);
		SetPlayerColor(playerid,ZRED);
		SetPlayerTeam(playerid, 2);
		SetPlayerHealth(playerid, 200);
 		SetPlayerSkin(playerid,162);
		GameTextForPlayer(playerid,"~r~Zombie: ~b~/hide",10000,1);
		return 1;
	}
	if(team[playerid] == 1) //Humans
	{
		SetPlayerColor(playerid,CYAN);
		SetPlayerTeam(playerid, 1);
		GameTextForPlayer(playerid,"~b~~h~Human: ~b~/panic",10000,1);
		GivePlayerWeapon(playerid,24,300);
		GivePlayerWeapon(playerid,25,300);
		GivePlayerMoney(playerid, 20000);
	}
	if(team[playerid] == 2) //Zombies
	{
		SetPlayerColor(playerid,ZRED);
		SetPlayerTeam(playerid, 2);
		SetPlayerHealth(playerid, 200);
		GameTextForPlayer(playerid,"~r~Zombie: ~b~/hide",10000,1);
	}
	if(team[playerid] == 4) //Scientists
	{
		SetPlayerColor(playerid,WHITE);
		SetPlayerTeam(playerid, 1);
		GameTextForPlayer(playerid,"~w~Scientist: ~b~/anti",10000,1);
		GivePlayerWeapon(playerid,23,300);
		GivePlayerMoney(playerid, 20000);
		SetPlayerArmour(playerid, 100);
	}
	if(team[playerid] == 5) //Doctor
	{
		SetPlayerColor(playerid,ORANGE);
		SetPlayerTeam(playerid, 1);
		GameTextForPlayer(playerid,"~r~~h~Doctor: ~b~/heal",10000,1);
		SetPlayerPos(playerid,1624.2527,1821.0498,10.8203);
		SetPlayerFacingAngle(playerid,5.6779);
		GivePlayerWeapon(playerid,24,300);
		GivePlayerMoney(playerid, 20000);
		SetPlayerInterior(playerid,0);
		SetPlayerArmour(playerid, 100);
		return 1;
	}
	if(team[playerid] == 6) //S.T.A.R.S
	{
		SetPlayerColor(playerid,GREEN);
		SetPlayerTeam(playerid, 1);
		SetPlayerPos(playerid,1624.2527,1821.0498,10.8203);
		SetPlayerFacingAngle(playerid,5.6779);
		GivePlayerWeapon(playerid,31,300);
 		GivePlayerWeapon(playerid,24,300);
		GivePlayerMoney(playerid, 20000);
		SetPlayerInterior(playerid,0);
		SetPlayerArmour(playerid, 100);
		return 1;
	}
	if(team[playerid] == 7) //UC
	{
		SetPlayerColor(playerid,TAN);
		SetPlayerTeam(playerid, 1);
		SetPlayerFacingAngle(playerid,5.6779);
		GivePlayerWeapon(playerid,31,300);
 		GivePlayerWeapon(playerid,24,300);
		GivePlayerMoney(playerid, 20000);
		SetPlayerInterior(playerid,0);
		SetPlayerArmour(playerid, 100);
		return 1;
	}
Reply
#4

Create Some global variables like this:

pawn Код:
new HumansPlayers;
new ZombiesPlayers;
new ScientistPlayers;
new DoctorPlayers;
new HumansPlayers;
new StarsPlayers;
new UCPlayers;
Everytime someone joins a team add that + 1, everytime someone leaves minus by 1

So if someone joins the UC team do

pawn Код:
UCPlayers++;
When they leave UC team do

pawn Код:
UCPlayers--;

Then when joining the team do comparisons to all the other teams.

For example say UCPlayers has 3 players online and humans have 2

if player trys to join UCPlayers do:
if(UCPlayers > HumansPlayers)
{
Send a message saying you cannot join this team because it's too big.
}

And to do a balance eg. many people on one team leave. Have a check that runs every once in a while like every 30 seconds or 60 seconds.
Reply
#5

If I PM u my script would you do the code for me ? (English isn't my first language, so I can't code so good)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)