Team Balance Problem
#1

Hello everybody.I created my own Team balance and its not working i dont see any problem maybe you will see.

pawn Код:
new swatcount;//Global Variable
new terrorcount;//Global Variable


public OnPlayerDisconnect(playerid, reason)
{
    if(GetPlayerTeam(playerid) == 1)
    {
        terrorcount--;
    }
    else if(GetPlayerTeam(playerid) == 2)
    {
        swatcount--;
    }
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    SetPlayerInterior(playerid, 0);
    if(GetPlayerSkin(playerid) == 121)
    {
        SetPlayerTeam(playerid, 1);
        SetPlayerColor(playerid,0xFF4600FF);
        terrorcount++;
    }
    if(GetPlayerSkin(playerid) == 285)
    {
        SetPlayerTeam(playerid, 2);
        SetPlayerColor(playerid,0x0091FFFF);
        swatcount++;
    }
    if((terrorcount > swatcount) && (GetPlayerTeam(playerid) == 1))
    {
        GameTextForPlayer(playerid,"~r~Team Full choose other",2000,3);
        return 0;
    }
    if((terrorcount < swatcount) && (GetPlayerTeam(playerid) == 2))
    {
        GameTextForPlayer(playerid,"~r~Team Full choose other",2000,3);
        return 0;
    }
    return 1;
}
Reply
#2

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    SetPlayerInterior(playerid, 0);
    if(GetPlayerSkin(playerid) == 121)
    {
        SetPlayerTeam(playerid, 1);
        SetPlayerColor(playerid,0xFF4600FF);
        terrorcount++;
    }
    if(GetPlayerSkin(playerid) == 285)
    {
        SetPlayerTeam(playerid, 2);
        SetPlayerColor(playerid,0x0091FFFF);
        swatcount++;
    }
    if(GetPlayerTeam[playerid] == 1 && swatcount > terrorcount)
    {
        GameTextForPlayer(playerid,"~r~Team Full choose other",2000,3);
        return 0;
    }
    if(GetPlayerTeam[playerid] == 2 && terrorcount > swatcount)
    {
        GameTextForPlayer(playerid,"~r~Team Full choose other",2000,3);
        return 0;
    }
    return 1;
}
Try this one.
Reply
#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
#4

Its not working Luka.Also from WoodPecker
Reply
#5

Quote:
Originally Posted by SpiderWalk
Посмотреть сообщение
Its not working Luka.Also from WoodPecker
What's the problem? What's not working?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)