Skip to content

Commit afbb56a

Browse files
committed
scheduler: add native is_last_round
1 parent d57611c commit afbb56a

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

addons/amxmodx/scripting/include/map_manager_scheduler.inc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@
2222
native map_scheduler_start_vote(type);
2323

2424
/**
25-
* Returns if vote will in next round.
25+
* Returns true if vote will in next round.
2626
*
2727
* @return true/false
2828
*/
2929
native bool:is_vote_will_in_next_round();
30+
31+
/**
32+
* Returns true if now is last round.
33+
*
34+
* @return true/false
35+
*/
36+
native bool:is_last_round();

addons/amxmodx/scripting/map_manager_scheduler.sma

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

99
#define PLUGIN "Map Manager: Scheduler"
10-
#define VERSION "0.0.8"
10+
#define VERSION "0.0.9"
1111
#define AUTHOR "Mistrick"
1212

1313
#pragma semicolon 1
@@ -131,6 +131,7 @@ public plugin_natives()
131131

132132
register_native("map_scheduler_start_vote", "native_start_vote");
133133
register_native("is_vote_will_in_next_round", "native_vote_will_in_next_round");
134+
register_native("is_last_round", "native_is_last_round");
134135
}
135136
public native_start_vote(plugin, params)
136137
{
@@ -147,6 +148,10 @@ public native_vote_will_in_next_round(plugin, params)
147148
{
148149
return g_bVoteInNewRound;
149150
}
151+
public native_is_last_round(plugin, params)
152+
{
153+
return g_bChangeMapNextRound;
154+
}
150155
public plugin_end()
151156
{
152157
if(g_fOldTimeLimit > 0.0) {
@@ -294,7 +299,7 @@ public event_newround()
294299
mapm_start_vote(g_iVoteType);
295300
}
296301

297-
if(is_vote_finished() && (g_bChangeMapNextRound || get_num(LAST_ROUND))) {
302+
if(is_vote_finished() && g_bChangeMapNextRound) {
298303
new nextmap[MAPNAME_LENGTH]; get_string(NEXTMAP, nextmap, charsmax(nextmap));
299304
client_print_color(0, print_team_default, "%s^1 %L^3 %s^1.", g_sPrefix, LANG_PLAYER, "MAPM_NEXTMAP", nextmap);
300305
intermission();
@@ -465,6 +470,8 @@ public mapm_vote_finished(const map[], type, total_votes)
465470
// What if timelimit 0?
466471
g_fOldTimeLimit = get_float(TIMELIMIT);
467472
set_float(TIMELIMIT, 0.0);
473+
g_bChangeMapNextRound = true;
474+
468475
client_print_color(0, print_team_default, "%s^1 %L", g_sPrefix, LANG_PLAYER, "MAPM_LASTROUND");
469476

470477
log_amx("[vote_finished]: last round - saved timelimit is %f", g_fOldTimeLimit);

0 commit comments

Comments
 (0)