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



[HELP] Team Balance - ZigGamerx - 23.08.2018

guys i searched a lot for team balance but i dont found which type i want.

like i have some teams,

team_1
team_2

and i want each team balance like team_1 only get 1 player and team_2 also get 1 player only


Re: [HELP] Team Balance - xMoBi - 23.08.2018

Why not write code that yourself - it's basic.


Re: [HELP] Team Balance - TheBlackHand - 23.08.2018

PHP код:
new
    
Team1Count 0,
    
Team2Count 0;

stock TeamBalance(playerid)
{
    if(
Team1Count Team2Count
    
{
        
SetPlayerTeam(playeridTeam_1);
        
Team1Count++;
    }
    else if(
Team1Count Team2Count)
    {
        
SetPlayerTeam(playeridTeam_2);
        
Team2Count++;
    }
}
public 
OnPlayerDisconnect(playeridreason)
{
    if(
GetPlayerTeam(playerid) == Team_1)
    {
        if(
Team1Count 0)
            
Team1Count--;
    }
    if(
GetPlayerTeam(playerid) == Team_2)
    {
        if(
Team2Count 0)
            
Team2Count--;
    }