help about team balance
#1

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
Reply


Messages In This Thread
help about team balance - by handerson - 11.07.2011, 02:59
Re: help about team balance - by emon - 11.07.2011, 03:49
Re: help about team balance - by handerson - 11.07.2011, 04:03
Re: help about team balance - by Lorenc_ - 11.07.2011, 04:16

Forum Jump:


Users browsing this thread: 2 Guest(s)