Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] get_players_num should return playing bots too #56

Open
di57inct opened this issue Jul 6, 2024 · 2 comments
Open

[Suggestion] get_players_num should return playing bots too #56

di57inct opened this issue Jul 6, 2024 · 2 comments

Comments

@di57inct
Copy link

di57inct commented Jul 6, 2024

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;
}
@Mistrick
Copy link
Owner

Mistrick commented Jul 7, 2024

get_players_num should return playing bots too

Any reason for this?

It can also be optimized by using get_players instead.

Nope

@di57inct
Copy link
Author

di57inct commented Jul 7, 2024

Any reason for this?

let's say you have small maps(like dust2x2 for example) defined in the map list file where you want a maximum of 16 players on them and you have 15 players on the server and 10 bots and it ends up changing to that map even if there are actually 25 actively playing slots

Nope

current code uses at least 4 natives for each player * 32 = 128 native calls when you can use just 3 or 4 with get_players but i guess it doesn't matter that much since the stock is called just a few times per map

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants