!!Important!! Team Balance!!
#1

hi,

i dont know what else i would have to change.
It seems correct ot me.
I also made a command that i can see where the error is.
It seems that after a few joins and disconnects it f**s up somehow.
The team balance just doesnt work. It counts wrong sometimes....
Pls can someone tell me whats wrong?

pawn Код:
#define TEAM_POLICE 1
#define TEAM_TERRORISTS 2
#define MAX_TEAMS 2

new firstspawn[MAX_PLAYERS];

new Count_Police;
new Count_Terrorists;

//OnPlayerConnect
firstspawn[playerid] = 0;

//OnPlayerDisconnect
    if(GetPlayerTeam(playerid) == TEAM_POLICE)
    {
        Count_Police--;
    }
    else if(GetPlayerTeam(playerid) == TEAM_TERRORISTS)
    {
        Count_Terrorists--;
    }

//OnPlayerSpawn

    if(firstspawn[playerid]==0)
    {

    if(GetPlayerTeam(playerid) == TEAM_POLICE)
    {
        Count_Police++;
    }
    else if(GetPlayerTeam(playerid) == TEAM_TERRORISTS)
    {
        Count_Terrorists++;
    }
}

firstspawn[playerid] = 1;

//OnPlayerRequestSpawn
    if((Count_Police > Count_Terrorists) && GetPlayerTeam(playerid) == TEAM_POLICE)
    {
        SendClientMessage(playerid,0xE100E1FF,"{2B2B2B}Please join the {CC7F32}adverse team {2B2B2B}in order to keep the {CC7F32}teams balanced.");
        GameTextForPlayer(playerid, "~b~~h~CTU ~r~team is full!", 800, 5);
        PlayerPlaySound(playerid,1055,0, 0, 0);
        return 0;
    }
    if((Count_Police < Count_Terrorists) && GetPlayerTeam(playerid) == TEAM_TERRORISTS)
    {
        SendClientMessage(playerid,0xE100E1FF,"{2B2B2B}Please join the {CC7F32}adverse team {2B2B2B}in order to keep the {CC7F32}teams balanced.");
        GameTextForPlayer(playerid, "~r~~h~~h~Coral Snake ~r~team is full!", 800, 5);
        PlayerPlaySound(playerid,1055,0, 0, 0);
        return 0;
    }
Pls this is very important i really need ur help here
Reply
#2

under OnPlayerRequestClass put team variable
for example
pawn Код:
if(class == POLICE)
{ playerteam[playerid] = police; }
else if (...) {playerteam[playerid] = terror;}
and then use `if(playerteam[playerid] == team)` instead of GetPlayerTeam
Reply
#3

hi, thx for ur answer.
does it really make a difference if i use GetPlayerTeam or playerteam?
Reply
#4

I dont know i would preffer integer(variable). Earlyer GetPlayerTeam had bug and it works if you use SetPlayerTeam I guess?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)