Skip to content

Commit 5cc5af0

Browse files
committed
scheduler: new native is_vote_will_in_next_round
added block for votemap
1 parent e794c86 commit 5cc5af0

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

include/map_manager_scheduler.inc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,17 @@
1313
#endif
1414

1515
/**
16-
* TODO: write this.
16+
* Start vote by scheduler, work with own cvars.
1717
*
18+
* @param type Type of vote, used const VOTE_BY_*
19+
*
1820
* @noreturn
1921
*/
2022
native map_scheduler_start_vote(type);
23+
24+
/**
25+
* Returns if vote will in next round.
26+
*
27+
* @return true/false
28+
*/
29+
native bool:is_vote_will_in_next_round();

map_manager_scheduler.sma

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ enum {
3030
CHANGE_MAP_END
3131
};
3232

33-
enum {
34-
EXTEND_MINUTES,
35-
EXTEND_ROUNDS
36-
};
37-
3833
enum Cvars {
3934
CHANGE_TYPE,
4035
TIMELEFT_TO_VOTE,
@@ -92,6 +87,8 @@ public plugin_init()
9287
register_concmd("mapm_start_vote", "concmd_startvote", ADMIN_MAP);
9388
register_concmd("mapm_stop_vote", "concmd_stopvote", ADMIN_MAP);
9489

90+
register_clcmd("votemap", "clcmd_votemap");
91+
9592
register_event("TeamScore", "event_teamscore", "a");
9693
register_event("HLTV", "event_newround", "a", "1=0", "2=0");
9794
// register_event("TextMsg", "event_restart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in");
@@ -106,6 +103,7 @@ public plugin_natives()
106103
register_library("map_manager_scheduler");
107104

108105
register_native("map_scheduler_start_vote", "native_start_vote");
106+
register_native("is_vote_will_in_next_round", "native_vote_will_in_next_round");
109107
}
110108
public native_start_vote(plugin, params)
111109
{
@@ -118,6 +116,10 @@ public native_start_vote(plugin, params)
118116

119117
return 1;
120118
}
119+
public native_vote_will_in_next_round(plugin, params)
120+
{
121+
return g_bVoteInNewRound;
122+
}
121123
public plugin_end()
122124
{
123125
if(g_fOldTimeLimit > 0.0) {
@@ -177,6 +179,11 @@ public concmd_stopvote(id, level, cid)
177179

178180
return PLUGIN_HANDLED;
179181
}
182+
public clcmd_votemap()
183+
{
184+
// Block default vote
185+
return PLUGIN_HANDLED;
186+
}
180187
public task_checktime()
181188
{
182189
if(is_vote_started() || is_vote_finished() || get_float(TIMELIMIT) <= 0.0) {
@@ -234,6 +241,10 @@ public event_restart()
234241
*/
235242
public event_intermission()
236243
{
244+
if(task_exists(TASK_DELAYED_CHANGE)) {
245+
log_amx("Double intermission, how?");
246+
return;
247+
}
237248
set_task(get_float(CHATTIME), "delayed_change", TASK_DELAYED_CHANGE);
238249
}
239250
public delayed_change()

0 commit comments

Comments
 (0)