SA-MP Forums Archive
A team player count textdraw error - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: A team player count textdraw error (/showthread.php?tid=205085)



A team player count textdraw error - jameskmonger - 31.12.2010

I've got this:
pawn Код:
new count;
GetTeamPlayersAlive(teamid)
{
    for(new i; i>playersAliveCount; i++)
    {
        if(gTeam[i] == teamid) count++;
        if(i == playersAliveCount) {
            return count;
        }
    }
}
UpdateTeamCountTextdraws()
{
    new string[128];
    format(string, sizeof(string), "Ballas left: %d", GetTeamPlayersAlive(TEAM_BALLA));
    if(strcmp("Ballas left: 0", string, true, 14) == 0)
    {
        TextDrawSetString(ballasleft, "No Ballas left!");
    } else {
        TextDrawSetString(ballasleft, string);
    }
    format(string, sizeof(string), "Groves left: %d", GetTeamPlayersAlive(TEAM_GROVE));
    if(strcmp("Groves left: 0", string, true, 14) == 0)
    {
        TextDrawSetString(grovesleft, "No Groves left!");
    } else {
        TextDrawSetString(grovesleft, string);
    }
}
And this:
pawn Код:
if(strcmp(cmdtext, "/update", true) == 0)
    {
        UpdateTeamCountTextdraws();
        return 1;
    }
But for some reason, I go on the Grove team and type /update, and both textdraws say "No Groves left!" and "No Ballas left!"


Re: A team player count textdraw error - MadeMan - 31.12.2010

pawn Код:
GetTeamPlayersAlive(teamid)
{
    new count;
    for(new i; i < playersAliveCount; i++)
    {
        if(IsPlayerConnected(i) && gTeam[i] == teamid) count++;
    }
    return count;
}