Skip to content

Commit ebba390

Browse files
committed
rtv: add cvar mapm_rtv_ignore_spectators
1 parent c92fcd6 commit ebba390

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

cstrike/addons/amxmodx/configs/map_manager.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,11 @@ mapm_rtv_delay "0"
196196
// 0 - disable, 1 - enable
197197
mapm_rtv_allow_extend "0"
198198

199+
// EN: Ignores spectators when counting required votes for RTV.
200+
// RU: Игнорирует спектаторов в подсчете необходимых голосов для ртв.
201+
// 0 - disable, 1 - enable
202+
mapm_rtv_ignore_spectators "0"
203+
199204

200205
// Nomination
201206

cstrike/addons/amxmodx/scripting/include/map_manager_stocks.inc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ stock get_players_num(ignore = 0)
6464
|| is_user_hltv(i)) {
6565
continue;
6666
}
67+
68+
if(ignore == -1) {
69+
new team = get_user_team(i);
70+
if(team == 0 || team == 4) {
71+
continue;
72+
}
73+
}
74+
6775
pnum++;
6876
}
6977
return pnum;

cstrike/addons/amxmodx/scripting/map_manager_rtv.sma

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#endif
88

99
#define PLUGIN "Map Manager: Rtv"
10-
#define VERSION "0.1.1"
10+
#define VERSION "0.1.2"
1111
#define AUTHOR "Mistrick"
1212

1313
#pragma semicolon 1
@@ -25,7 +25,8 @@ enum Cvars {
2525
DELAY,
2626
CHANGE_AFTER_VOTE,
2727
CHANGE_TYPE,
28-
ALLOW_EXTEND
28+
ALLOW_EXTEND,
29+
IGNORE_SPECTATORS
2930
};
3031

3132
enum {
@@ -50,6 +51,7 @@ public plugin_init()
5051
g_pCvars[PLAYERS] = register_cvar("mapm_rtv_players", "5");
5152
g_pCvars[DELAY] = register_cvar("mapm_rtv_delay", "0"); // minutes
5253
g_pCvars[ALLOW_EXTEND] = register_cvar("mapm_rtv_allow_extend", "0"); // 0 - disable, 1 - enable
54+
g_pCvars[IGNORE_SPECTATORS] = register_cvar("mapm_rtv_ignore_spectators", "0"); // 0 - disable, 1 - enable
5355

5456
register_clcmd("say rtv", "clcmd_rtv");
5557
register_clcmd("say /rtv", "clcmd_rtv");
@@ -88,9 +90,9 @@ public clcmd_rtv(id)
8890

8991
new need_votes;
9092
if(get_num(MODE) == MODE_PERCENTS) {
91-
need_votes = floatround(get_players_num() * get_num(PERCENT) / 100.0, floatround_ceil) - g_iVotes;
93+
need_votes = floatround(get_players_num(get_num(IGNORE_SPECTATORS) ? -1 : 0) * get_num(PERCENT) / 100.0, floatround_ceil) - g_iVotes;
9294
} else {
93-
need_votes = get_num(PLAYERS) - g_iVotes;
95+
need_votes = min(get_num(PLAYERS), get_players_num(get_num(IGNORE_SPECTATORS) ? -1 : 0)) - g_iVotes;
9496
}
9597

9698
if(need_votes <= 0) {

0 commit comments

Comments
 (0)