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
#2

what pawno ur using 0.3c or 0.3b?
Reply
#3

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


0.3 c
Reply
#4

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


Forum Jump:


Users browsing this thread: 2 Guest(s)