SA-MP Forums Archive
[HELP] Team balancer - Im half way there - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Team balancer - Im half way there (/showthread.php?tid=88802)



[HELP] Team balancer - Im half way there - Mowgli - 28.07.2009

for OnplayerRequestSpawn ive got

Код:
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if (WestTeam[i] < EastTeam[i])
			{
			}
		}
	}
Now, i dont know wat to do, i want to make it so that If West team has more players than East team....(Btw, its defined that if a player enters server and chooses a west team skin, then WestTeam =1 and EastTeam= 0.)

These are errors i get when i compile, they are all on line 'if (WestTeam[i] < EastTeam[i])'

Код:
C:\Documents and Settings\Darren(cool person)\Desktop\SGGW.pwn(889) : error 017: undefined symbol "EastTeam"
C:\Documents and Settings\Darren(cool person)\Desktop\SGGW.pwn(889) : warning 215: expression has no effect
C:\Documents and Settings\Darren(cool person)\Desktop\SGGW.pwn(889) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Darren(cool person)\Desktop\SGGW.pwn(889) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Darren(cool person)\Desktop\SGGW.pwn(889) : fatal error 107: too many error messages on one line



Re: [HELP] Team balancer - Im half way there - miceiken - 28.07.2009

I don't see why you need a loop for this.. Actually I don't see the issue.


Re: [HELP] Team balancer - Im half way there - Fukara_GM - 28.07.2009

define EastTeam

new EastTeam[MAX_PLAYERS];


Re: [HELP] Team balancer - Im half way there - D3nnis - 28.07.2009

Quote:
Originally Posted by Fukara_GM
define EastTeam

new EastTeam[MAX_PLAYERS];
Why do you want to define it and then make a "new ...."decleration? it's useless

@topic I don't know how your code would become a "Team balancer" but I would make something like this:
set a variable "gTeam[playerid]" for your Teams (WestTeam = 1 and EastTeam = 0) and define WestSpawn and EastSpawn onto your mode. Those variables can be raised the same way you'll define the gTeam.

Код:
public OnPlayerRequestSpawn(playerid)
{
	if(gTeam[playerid] == 1 && WestSpawn > EastSpawn || gTeam[playerid] == 0 && EastSpawn > WestSpawn)
	{
	  GameTextForPlayer(playerid, "Please chose another Team!", 3500, 5);
	  return 0;
	}
	return 1;
}
This is the method I would choose.

Good bye
D3nnis


Re: [HELP] Team balancer - Im half way there - Mowgli - 28.07.2009

wat is Gteam


Re: [HELP] Team balancer - Im half way there - D3nnis - 29.07.2009

Quote:
Originally Posted by Mowgli
wat is Gteam
It's just a variable?
On top of your Script "new gTeam[MAX_PLAYERS]" you can name it as you like.. "PlayerTeam", "pTeam" or "gTeam"(my case)
or what do you mean?