SA-MP Forums Archive
*** I can't name topics well! - 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: *** I can't name topics well! (/showthread.php?tid=389192)



*** I can't name topics well! - dr.lozer - 01.11.2012

can anyone how to make auto team balance ??


Re: Need help here plz - ExpertSahil - 01.11.2012

you mean team chat? or family/faction system? or something like bank account for one team?


Re: Need help here plz - dr.lozer - 01.11.2012

Quote:
Originally Posted by ExpertSahil
Посмотреть сообщение
you mean team chat? or family/faction system? or something like bank account for one team?
Noo i mean AutoTeamBalance
when player join a team the autoteambalance check if there is too many player in Terrorist so it SendClientMessage to that player that "there is too many players in Army.. Choose Terrorist"

Sorry for my bad english :P


Re: Need help here plz - XtremeR - 01.11.2012

pawn Код:
//you can add your teams name ... i added them for Example
#define TEAM_ONE 0
#define TEAM_TWO 1

stock GetPlayersInTeamFromMaxPlayers(teamid)
{
    new playercount = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerState(i) == PLAYER_STATE_NONE) continue;
        if(gTeam[i] != teamid) continue;
        playercount++;
    }
    return playercount;
}
public OnPlayerRequestSpawn(playerid)
{
    new team1 = GetPlayersInTeamFromMaxPlayers(TEAM_ONE);
    new team2 = GetPlayersInTeamFromMaxPlayers(TEAM_TWO);
    if(team1 > team2 && gTeam[playerid] == TEAM_ONE)
    {
        GameTextForPlayer(playerid, "~r~Team Full!~n~~w~Choose Another Team!", 3000, 5);
        return 0;
    }
    else if(team2 > team1 && gTeam[playerid] == TEAM_TWO)
    {
        GameTextForPlayer(playerid, "~r~Team Full!~n~~w~Choose Another Team!", 3000, 5);
        return 0;
    }
    return 1;
}



Re: Need help here plz - dr.lozer - 02.11.2012

Quote:
Originally Posted by XtremeR
Посмотреть сообщение
pawn Код:
//you can add your teams name ... i added them for Example
#define TEAM_ONE 0
#define TEAM_TWO 1

stock GetPlayersInTeamFromMaxPlayers(teamid)
{
    new playercount = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerState(i) == PLAYER_STATE_NONE) continue;
        if(gTeam[i] != teamid) continue;
        playercount++;
    }
    return playercount;
}
public OnPlayerRequestSpawn(playerid)
{
    new team1 = GetPlayersInTeamFromMaxPlayers(TEAM_ONE);
    new team2 = GetPlayersInTeamFromMaxPlayers(TEAM_TWO);
    if(team1 > team2 && gTeam[playerid] == TEAM_ONE)
    {
        GameTextForPlayer(playerid, "~r~Team Full!~n~~w~Choose Another Team!", 3000, 5);
        return 0;
    }
    else if(team2 > team1 && gTeam[playerid] == TEAM_TWO)
    {
        GameTextForPlayer(playerid, "~r~Team Full!~n~~w~Choose Another Team!", 3000, 5);
        return 0;
    }
    return 1;
}
Thanks I will try This