Players count without specs, hltv and bots?

Сообщения
58
Реакции
10
Помог
1 раз(а)
Hi.
I use this but count spectators.
How to ignore specs too?​

stock players_num()
{
new players[32], pnum;
get_players(players, pnum, "ch");
return pnum;
}
 
Сообщения
24
Реакции
4
Код:
stock players_num()
{ 
    static player_num
    player_num = 0
    new g_MaxPlayers = get_maxplayers();
 
    for(new i = 0; i < g_MaxPlayers; i++)
    {
        if(!is_user_connected(i))
            continue;
        if(is_user_bot(i) || is_user_hltv(i))
           continue;    
        if(get_user_team(i) == 3))
           continue;

        player_num++
    }

    return player_num
}
 
  • Нравится
Реакции: Tigs
Сообщения
14
Реакции
1
There are such options. Try

1.

Код:
stock players_num() {
    new players[32], CTnum, Tnum;
    get_players(players, CTnum, "che", "CT");
    get_players(players, Tnum, "che", "TERRORIST");
    return CTnum + Tnum;
}
2.

Код:
stock players_num() {
    return get_playersnum_ex(GetPlayers_ExcludeBots | GetPlayers_ExcludeHLTV | GetPlayers_MatchTeam, "CT")
        + get_playersnum_ex(GetPlayers_ExcludeBots | GetPlayers_ExcludeHLTV | GetPlayers_MatchTeam, "TERRORIST");
}
3.
Код:
stock players_num() {
    new iNum[4]; rg_initialize_player_counts(iNum[0], iNum[1], iNum[2], iNum[3]);
 
    return iNum[0] + iNum[1] + iNum[2] + iNum[3];
}
4.
Код:
stock players_num() {
    new iNum;
    for (new id = 1; id <= MAX_PLAYERS; id++) {
        if (!is_user_connected(id) || get_user_team(id) & 3 || is_user_bot(id) || is_user_hltv(id))
            continue;

        iNum++;
    }

    return iNum;
}
 
  • Нравится
Реакции: Tigs

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу