Skip to content

Commit

Permalink
scheduler: new native is_vote_will_in_next_round
Browse files Browse the repository at this point in the history
added block for votemap
  • Loading branch information
Mistrick committed Apr 8, 2018
1 parent e794c86 commit 5cc5af0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
11 changes: 10 additions & 1 deletion include/map_manager_scheduler.inc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@
#endif

/**
* TODO: write this.
* Start vote by scheduler, work with own cvars.
*
* @param type Type of vote, used const VOTE_BY_*
*
* @noreturn
*/
native map_scheduler_start_vote(type);

/**
* Returns if vote will in next round.
*
* @return true/false
*/
native bool:is_vote_will_in_next_round();
21 changes: 16 additions & 5 deletions map_manager_scheduler.sma
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ enum {
CHANGE_MAP_END
};

enum {
EXTEND_MINUTES,
EXTEND_ROUNDS
};

enum Cvars {
CHANGE_TYPE,
TIMELEFT_TO_VOTE,
Expand Down Expand Up @@ -92,6 +87,8 @@ public plugin_init()
register_concmd("mapm_start_vote", "concmd_startvote", ADMIN_MAP);
register_concmd("mapm_stop_vote", "concmd_stopvote", ADMIN_MAP);

register_clcmd("votemap", "clcmd_votemap");

register_event("TeamScore", "event_teamscore", "a");
register_event("HLTV", "event_newround", "a", "1=0", "2=0");
// register_event("TextMsg", "event_restart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in");
Expand All @@ -106,6 +103,7 @@ public plugin_natives()
register_library("map_manager_scheduler");

register_native("map_scheduler_start_vote", "native_start_vote");
register_native("is_vote_will_in_next_round", "native_vote_will_in_next_round");
}
public native_start_vote(plugin, params)
{
Expand All @@ -118,6 +116,10 @@ public native_start_vote(plugin, params)

return 1;
}
public native_vote_will_in_next_round(plugin, params)
{
return g_bVoteInNewRound;
}
public plugin_end()
{
if(g_fOldTimeLimit > 0.0) {
Expand Down Expand Up @@ -177,6 +179,11 @@ public concmd_stopvote(id, level, cid)

return PLUGIN_HANDLED;
}
public clcmd_votemap()
{
// Block default vote
return PLUGIN_HANDLED;
}
public task_checktime()
{
if(is_vote_started() || is_vote_finished() || get_float(TIMELIMIT) <= 0.0) {
Expand Down Expand Up @@ -234,6 +241,10 @@ public event_restart()
*/
public event_intermission()
{
if(task_exists(TASK_DELAYED_CHANGE)) {
log_amx("Double intermission, how?");
return;
}
set_task(get_float(CHATTIME), "delayed_change", TASK_DELAYED_CHANGE);
}
public delayed_change()
Expand Down

0 comments on commit 5cc5af0

Please sign in to comment.