Team Balance Problem
#3

This should do it.
Naskripto sam ti ovo, al svejedno si budala <3

pawn Код:
#define TEAM_SWAT           (0)
#define TEAM_TERROR         (1)

#define TEAM_SWAT_COLOR     (0xFF4600FF)
#define TEAM_TERROR_COLOR   (0x0091FFFF)

new gTeamCount[2];

public OnPlayerConnect(playerid)
{
    SetPlayerTeam(playerid, NO_TEAM);
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    SetPlayerInterior(playerid, 0);
    new playerSkin = GetPlayerSkin(playerid);
   
    switch(playerSkin)
    {
        case 121:
        {
            SetPlayerTeam(playerid, TEAM_SWAT);
            SetPlayerColor(playerid, TEAM_SWAT_COLOR);
           
            if((gTeamCount[TEAM_SWAT]++ > gTeamCount[TEAM_TERROR]) && (!(gTeamCount[TEAM_TERROR]++ > gTeamCount[TEAM_SWAT])) && (!(gTeamCount[TEAM_SWAT]++ == gTeamCount[TEAM_TERROR]++)))
            {
                GameTextForPlayer(playerid,"~r~This team is full~n~Choose another", 2000, 3);
                return 0;
            }
           
            gTeamCount[TEAM_SWAT]++;
        }
        case 285:
        {
            SetPlayerTeam(playerid, TEAM_TERROR);
            SetPlayerColor(playerid, TEAM_TERROR_COLOR);
           
            if((gTeamCount[TEAM_TERROR]++ > gTeamCount[TEAM_SWAT]) && (!(gTeamCount[TEAM_SWAT]++ > gTeamCount[TEAM_TERROR])) && (!(gTeamCount[TEAM_TERROR]++ == gTeamCount[TEAM_SWAT]++)))
            {
                GameTextForPlayer(playerid,"~r~This team is full~n~Choose another", 2000, 3);
                return 0;
            }
        }
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    switch(GetPlayerTeam(playerid))
    {
        case TEAM_SWAT:
        {
            gTeamCount[TEAM_SWAT] --;
        }
        case TEAM_TERROR:
        {
            gTeamCount[TEAM_TERROR] --;
        }
    }
    return 1;
}
Reply


Messages In This Thread
Team Balance Problem - by SpiderWalk - 21.02.2012, 19:59
Re: Team Balance Problem - by WoodPecker - 21.02.2012, 20:08
Re: Team Balance Problem - by Luka P. - 22.02.2012, 01:29
Re: Team Balance Problem - by SpiderWalk - 24.02.2012, 17:04
Re: Team Balance Problem - by T0pAz - 24.02.2012, 17:47

Forum Jump:


Users browsing this thread: 1 Guest(s)