SA-MP Forums Archive
help about 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: help about team balance (/showthread.php?tid=268057)



help about team balance - handerson - 11.07.2011

i made this code,

Код:
new Team1 = 0 ;
new Team2 = 0 ;
Код:
public OnPlayerRequestSpawn(playerid)
{
  if(Team1 > Team2)
  {
   if(gTeam[playerid] == TEAM_RED )
   {
    GameTextForPlayer(playerid, "~w~Team Kopassus is full", 600, 5);
    return 0;
    }
   return 1;
   }
   else if(Team2 > Team1)
   {
     if(gTeam[playerid] == TEAM_BLUE )
   {
    GameTextForPlayer(playerid, "~w~Team Terrorist is full", 600, 5);
    return 0;
    }
   return 1;
   }
   else if(Team2 == Team1)
   {
     if(gTeam[playerid] == TEAM_BLUE && gTeam[playerid] == TEAM_RED )
     {
      GameTextForPlayer(playerid, "~w~This Team is Available", 600, 5);
     }
    return 1;
   }
 return 1;
}
Код:
public OnPlayerSpawn(playerid)
{
   if(GetPlayerTeam(playerid) == TEAM_RED)
  {
     Team1++;
  }
  else if(GetPlayerTeam(playerid) == TEAM_BLUE)
  {
     Team2++;
  }
 return 1;
}
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  //Team Balance//
 if(gTeam[playerid] == TEAM_RED)
 {
  Team1--;
 }
  if(gTeam[playerid] == TEAM_BLUE)
 {
  Team2--;
 }
 return 1;
}
the problem is when i spawned with team terrorsit and spawned, then i want to change team, so i pressed f4 and used command kill, but when i wanted to spawn with Kopassus team, it said that it is full,,, why,,, i think my code is work,

sorry bad eng,, lol


Re: help about team balance - emon - 11.07.2011

what pawno ur using 0.3c or 0.3b?


Re: help about team balance - handerson - 11.07.2011

what pawno,,,,,
u mean what ver of my samp server


0.3 c


Re: help about team balance - Lorenc_ - 11.07.2011

make a variable to check if a player is already in a team, after just decrease the teams count he was previously in.