SA-MP Forums Archive
[PROBLEM] 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [PROBLEM] Balancer (/showthread.php?tid=116434)



[PROBLEM] Balancer - wert - 28.12.2009

Now i got that balancer but ill go to play alone:

I cannot spawn when I press shift or spawn.

This is my balancer:

Код:
public OnPlayerRequestSpawn(playerid)
{
	new Count1, Count2;
  for(new p = 0; p < GetMaxPlayers(); p++)
	{
	  if (GetPlayerTeam(p) == TEAM_GREEN)
	  {
	    Count1++;
	  }
  	else if (GetPlayerTeam(p) == TEAM_BLUE)
  	{
    	Count2++;
  	}
	}
	if ((Count1 > Count2) && GetPlayerTeam(playerid) == TEAM_GREEN)
	  return !SendClientMessage(playerid,red, "[BALANCER] Balancing teams. Choose Another Team");
	else if ((Count2 > Count1) && GetPlayerTeam(playerid) == TEAM_BLUE)
	  return !SendClientMessage(playerid,red, "[BALANCER] Balancing teams. Choose Another Team");
	return 0;
}
So if you found the problem and you can help me then im happy


Re: [PROBLEM] Balancer - Blantas - 28.12.2009

Код:
public OnPlayerRequestSpawn(playerid)
{
  new Count1, Count2;
  for(new p = 0; p < GetMaxPlayers(); p++)
  {
    if (GetPlayerTeam(p) == TEAM_GREEN) Count1++;
    else if (GetPlayerTeam(p) == TEAM_BLUE) Count2++;
  }
  if ((Count1 > Count2) && GetPlayerTeam(playerid) == TEAM_GREEN)
  {
    SendClientMessage(playerid,red, "[BALANCER] Balancing teams. Choose Another Team");
    return 0;
  }
  else if ((Count2 > Count1) && GetPlayerTeam(playerid) == TEAM_BLUE)
  {
    SendClientMessage(playerid,red, "[BALANCER] Balancing teams. Choose Another Team");
    return 0;
  }
  return 1;
}