SA-MP Forums Archive
[SOLVED] Team Balance - 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: [SOLVED] Team Balance (/showthread.php?tid=106633)



[SOLVED] Team Balance - Nameless303 - 04.11.2009

Hi,
I know it has been posted before, but in the posts before I didn't really get it ;S
Can some1 just give me the code?

Thanks (:


Re: [PLEASEEEE ;s] Team Balance - -xy! - 04.11.2009

http://forum.sa-mp.com/index.php?topic=64320.0


Re: [PLEASEEEE ;s] Team Balance - Nameless303 - 04.11.2009

Quote:
Originally Posted by -xy!
Quote:
Originally Posted by Sly™
Quote:
Originally Posted by Seif_
Change the returns message to this:
pawn Код:
return SendClientMessage(playerid, color_here, "This team is full!"), 0;
It will return 0 so you can't spawn.
Would be easier to understand using this:
pawn Код:
return !SendClientMessage(playerid, color_here, "This team is full!");
The SendClientMessage returns 1 if message was received by the client and 0 if not. So, if the player didn't receive the message, let him spawn to avoid problems
I tried both way, but I'm still getting an error;
Код:
warning 209: function "OnPlayerRequestSpawn" should return a value
My Code;
Код:
public OnPlayerRequestSpawn(playerid)
{
  for(new p = 0; p < GetMaxPlayers(); p++)
	{
	  if (GetPlayerTeam(p) == TEAM_ARMY)
	  {
	    ArmyCount++;
	  }
  	else if (GetPlayerTeam(p) == TEAM_TERROR)
  	{
    	TerrorCount++;
  	}
	}
	if ((ArmyCount > TerrorCount) && GetPlayerTeam(playerid) == TEAM_ARMY)
	  return !SendClientMessage(playerid, COLOR_RED, ">> This team is full!");
	else if ((TerrorCount > ArmyCount) && GetPlayerTeam(playerid) == TEAM_TERROR)
	  return !SendClientMessage(playerid, COLOR_RED, ">> This team is full!");
}
Thanks! (:


Re: [PLEASEEEE ;s] Team Balance - Zeromanster - 04.11.2009

Just make it return 1, it should remove the warning.


Re: [PLEASEEEE ;s] Team Balance - Nameless303 - 04.11.2009

Quote:
Originally Posted by Zeromanster
Just make it return 1, it should remove the warning.
Oke (: Thanks, it worked!


Re: [PLEASEEEE ;s] Team Balance - Nameless303 - 04.11.2009

Quote:
Originally Posted by Nameless303
Quote:
Originally Posted by Zeromanster
Just make it return 1, it should remove the warning.
Oke (: Thanks, it worked!
Now theres something else wrong; When I try to join whatever team it says it's full ;S