SA-MP Forums Archive
team members - 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: team members (/showthread.php?tid=444379)



team members - Mattakil - 16.06.2013

Im looking to see if it is possible to set a maximum user amount to SetPlayerTeam, and if there is a way to get the members that are in the team(integer). I want to use this to add a max to the round in my TDM server, and also so players can see who is in what team so they can join based on that.


Re: team members - OrMisicL - 16.06.2013

i dont think u can set the maximum team members for that function, all u need to do is create an array that holds every team members count, then when the max is reached u just disallow players from joining it

this array gets initialized to 0 (for all teams), then when somebody joins a certain team, it gets inceased by one, and when somebody leaves, it gets decreased, as simple as that


Re: team members - DetoNater - 16.06.2013

here's an example but you cant set the maximum players... it sets atomatically btw its like auto balance hope this was te one u are seraching for... btw edit your team name to the one here, these teams are in my server , its a stock place it in the place you want.

pawn Код:
stock IsTeamFull(teamid)
{
    if(teamid == T_ENGLAND)
    {
        if(TeamMembers(teamid) > TeamMembers(T_RUSSIA) || TeamMembers(teamid) > TeamMembers(T_MEXICO) || TeamMembers(teamid) > TeamMembers(T_ISRAEL) || TeamMembers(teamid) > TeamMembers(T_JAPAN))
        {
            return 1;
        }
        else return 0;
    }
    if(teamid == T_RUSSIA)
    {
        if(TeamMembers(teamid) > TeamMembers(T_ENGLAND) || TeamMembers(teamid) > TeamMembers(T_MEXICO) || TeamMembers(teamid) > TeamMembers(T_ISRAEL) || TeamMembers(teamid) > TeamMembers(T_JAPAN))
        {
            return 1;
        }
        else return 0;
    }
    if(teamid == T_MEXICO)
    {
        if(TeamMembers(teamid) > TeamMembers(T_RUSSIA) || TeamMembers(teamid) > TeamMembers(T_ENGLAND) || TeamMembers(teamid) > TeamMembers(T_ISRAEL) || TeamMembers(teamid) > TeamMembers(T_JAPAN))
        {
            return 1;
        }
        else return 0;
    }
    if(teamid == T_ISRAEL)
    {
        if(TeamMembers(teamid) > TeamMembers(T_RUSSIA) || TeamMembers(teamid) > TeamMembers(T_MEXICO) || TeamMembers(teamid) > TeamMembers(T_ENGLAND) || TeamMembers(teamid) > TeamMembers(T_JAPAN))
        {
            return 1;
        }
        else return 0;
    }
    if(teamid == T_JAPAN)
    {
        if(TeamMembers(teamid) > TeamMembers(T_RUSSIA) || TeamMembers(teamid) > TeamMembers(T_MEXICO) || TeamMembers(teamid) > TeamMembers(T_ENGLAND) || TeamMembers(teamid) > TeamMembers(T_ISRAEL))
        {
            return 1;
        }
        else return 0;
    }
    return 0;
}