File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ mapm_rtv_allow_extend "0"
214214
215215// EN: Ignores spectators when counting required votes for RTV.
216216// RU: Игнорирует спектаторов в подсчете необходимых голосов для ртв.
217- // 0 - disable, 1 - enable
217+ // 0 - disable, 1 - ignore as count, 2 - ignore as vote
218218mapm_rtv_ignore_spectators " 0"
219219
220220
Original file line number Diff line number Diff line change 77#endif
88
99# define PLUGIN " Map Manager: Rtv"
10- # define VERSION " 0.1.5 "
10+ # define VERSION " 0.1.6 "
1111# define AUTHOR " Mistrick"
1212
1313#pragma semicolon 1
@@ -35,6 +35,11 @@ enum {
3535 MODE_PLAYERS
3636};
3737
38+ enum {
39+ IGNORE_SPECTATORS_COUNT = 1 ,
40+ IGNORE_SPECTATORS_FULL
41+ };
42+
3843new g_pCvars[Cvars];
3944new g_iMapStartTime;
4045new bool: g_bVoted[33 ];
@@ -104,11 +109,33 @@ public clcmd_rtv(id)
104109 g_iVotes++ ;
105110 }
106111
112+ new current_votes = 0 ;
113+
114+ new ignore_spec = get_num (IGNORE_SPECTATORS);
115+ if (ignore_spec == IGNORE_SPECTATORS_FULL) {
116+ new team;
117+ for (new i = 1 ; i < sizeof (g_bVoted); i++ ) {
118+ if (! g_bVoted[i] || ! is_user_connected (i))
119+ continue ;
120+
121+ team = get_user_team (i);
122+ if (team == 1 || team == 2 ) {
123+ current_votes++ ;
124+ }
125+ }
126+ team = get_user_team (id);
127+ if (! g_bVoted[id] && (team == 1 || team == 2 )) {
128+ current_votes++ ;
129+ }
130+ } else {
131+ current_votes = g_iVotes;
132+ }
133+
107134 new need_votes;
108135 if (get_num (MODE) == MODE_PERCENTS) {
109- need_votes = floatround (get_players_num (get_num (IGNORE_SPECTATORS) ? - 1 : 0 ) * get_num (PERCENT) / 100 .0 , floatround_ceil) - g_iVotes ;
136+ need_votes = floatround (get_players_num (ignore_spec ? - 1 : 0 ) * get_num (PERCENT) / 100 .0 , floatround_ceil) - current_votes ;
110137 } else {
111- need_votes = min (get_num (PLAYERS), get_players_num (get_num (IGNORE_SPECTATORS) ? - 1 : 0 )) - g_iVotes ;
138+ need_votes = min (get_num (PLAYERS), get_players_num (ignore_spec ? - 1 : 0 )) - current_votes ;
112139 }
113140
114141 if (need_votes <= 0 ) {
You can’t perform that action at this time.
0 commit comments