SA-MP Forums Archive
Teams Balancer - 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: Teams Balancer (/showthread.php?tid=606334)



Teams Balancer - karoliko - 02.05.2016

I have searched this a lot, i have testes more than four balance systems and didnґt work on my server.
Im looking for balancer team (If player will choose Team1 and this team have more players than the other, GameTextForPlayer shows and tell to him that this team is full, then he need choose the other one to spawn)
Im using gTeam and two teams (Policias and Terroristas)


Re: Teams Balancer - F1N4L - 02.05.2016

Код:
        new Balance, gTeam[MAX_PLAYERS];

        if(Balance == 0 || Balance == 1)
	{
		Balance = 2;
		gTeam[playerid] = 0;
	}
	else if(Balance == 2)
	{
		Balance = 1;
		gTeam[playerid] = 1;
	}
debug?

Код:
public OnGameModeInit()
{
	SetTimer("TestBalance", 500, true);
	return 1;
}

forward TestBalance();
public TestBalance()
{
	if(Balance == 0 || Balance == 1)
	{
		Balance = 2;
		gTeam[0] = 0;
		
		print("Team 0");
	}
	else if(Balance == 2)
	{
		Balance = 1;
		gTeam[0] = 1;
		
		print("Team 1");
	}
	return 1;
}



Re: Teams Balancer - karoliko - 02.05.2016

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Код:
        new Balance, gTeam[MAX_PLAYERS];

        if(Balance == 0 || Balance == 1)
	{
		Balance = 2;
		gTeam[playerid] = 0;
	}
	else if(Balance == 2)
	{
		Balance = 1;
		gTeam[playerid] = 1;
	}
debug?

Код:
public OnGameModeInit()
{
	SetTimer("TestBalance", 500, true);
	return 1;
}

forward TestBalance();
public TestBalance()
{
	if(Balance == 0 || Balance == 1)
	{
		Balance = 2;
		gTeam[0] = 0;
		
		print("Team 0");
	}
	else if(Balance == 2)
	{
		Balance = 1;
		gTeam[0] = 1;
		
		print("Team 1");
	}
	return 1;
}
Why timer i donґt understand?
Can you change it to my teams (Policias and Terroristas) please...


Re: Teams Balancer - F1N4L - 02.05.2016

Tell me exactly which variable is responsible for two teams and the timer was just a debug for you to test the functionality (works!)


Re: Teams Balancer - karoliko - 02.05.2016

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Tell me exactly which variable is responsible for two teams and the timer was just a debug for you to test the functionality (works!)
PHP код:
//Teams
static gTeam[MAX_PLAYERS];
#define Policias 1
#define Terroristas 2 
I want to only, if the team wich the user choose have more players than the other, gametextforplayer show to the user that the team is full and he only can spawn choosing other team...


Re: Teams Balancer - F1N4L - 02.05.2016

Код:
if(Balance == 0 || Balance == 1)
	{
		Balance = 2;
		gTeam[playerid] = Policias;
	}
	else if(Balance == 2)
	{
		Balance = 1;
		gTeam[playerid] = Terroristas;
	}
Because it's in Portuguese?


Re: Teams Balancer - karoliko - 02.05.2016

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Код:
if(Balance == 0 || Balance == 1)
	{
		Balance = 2;
		gTeam[playerid] = Policias;
	}
	else if(Balance == 2)
	{
		Balance = 1;
		gTeam[playerid] = Terroristas;
	}
Because it's in Portuguese?
It's Spanish e.e


Re: Teams Balancer - F1N4L - 02.05.2016

Words are like, I 'm Brazilian!

Test and if it does not post here again

****** translator did not do it right! hahaha sorry


Re: Teams Balancer - karoliko - 02.05.2016

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Words are like, I 'm Brazilian!

Test and if it does not post here again
I think you didn't understood me. I want when player connect and when is OnPlayerClassRequest, if he choose Team Policias and this team have more players than the other, he cannot spawn as Policia, he must spawn like a Terrorista.


Re: Teams Balancer - Stuntff - 02.05.2016

Код:
new team = (AllTeamPlayersVariable % 2 == 0) ? 1 : 2;
gTeam[playerid] = team;