Skip to content

[Suggestion] get_players_num should return playing bots too #56

Description

@di57inct

It can also be optimized by using get_players instead.

stock get_players_num(ignore = 0)
{
    static maxplayers;
    if(!maxplayers) {
        maxplayers = get_maxplayers();
    }
    new pnum, team;
    for(new i = 1; i <= maxplayers; i++) {
        if(ignore > 0 && i == ignore
            || !is_user_connected(i)
            || is_user_hltv(i)) {
            continue;
        }

		team = get_user_team(i);

        if((team == 0 || team == 3) && (ignore == -1 || is_user_bot(i))) {
            continue;
        }

        pnum++;
    }
    return pnum;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions