Skip to content
This repository was archived by the owner on May 1, 2019. It is now read-only.

Commit 5ecda69

Browse files
committed
add round support for extend map
1 parent 231170b commit 5ecda69

File tree

2 files changed

+65
-15
lines changed

2 files changed

+65
-15
lines changed

mapmanager.sma

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#endif
66

77
#define PLUGIN "Map Manager"
8-
#define VERSION "2.5.44"
8+
#define VERSION "2.5.45"
99
#define AUTHOR "Mistrick"
1010

1111
#pragma semicolon 1
@@ -88,8 +88,10 @@ enum _:CVARS
8888
LAST_ROUND,
8989
CHANGE_TO_DEDAULT,
9090
DEFAULT_MAP,
91-
EXENDED_MAX,
92-
EXENDED_TIME,
91+
EXTENDED_TYPE,
92+
EXTENDED_MAX,
93+
EXTENDED_TIME,
94+
EXTENDED_ROUNDS,
9395
#if defined FUNCTION_RTV
9496
ROCK_MODE,
9597
ROCK_PERCENT,
@@ -201,8 +203,10 @@ public plugin_init()
201203
g_pCvars[CHANGE_TO_DEDAULT] = register_cvar("mapm_change_to_default_map", "0");//minutes, 0 - disable
202204
g_pCvars[DEFAULT_MAP] = register_cvar("mapm_default_map", "de_dust2");
203205

204-
g_pCvars[EXENDED_MAX] = register_cvar("mapm_extended_map_max", "3");
205-
g_pCvars[EXENDED_TIME] = register_cvar("mapm_extended_time", "15");//minutes
206+
g_pCvars[EXTENDED_TYPE] = register_cvar("mapm_extended_type", "0");//0 - minutes, 1 - rounds
207+
g_pCvars[EXTENDED_MAX] = register_cvar("mapm_extended_map_max", "3");
208+
g_pCvars[EXTENDED_TIME] = register_cvar("mapm_extended_time", "15");//minutes
209+
g_pCvars[EXTENDED_ROUNDS] = register_cvar("mapm_extended_rounds", "3");//rounds
206210

207211
#if defined FUNCTION_RTV
208212
g_pCvars[ROCK_MODE] = register_cvar("mapm_rtv_mode", "0");//0 - percents, 1 - players
@@ -848,7 +852,23 @@ public plugin_end()
848852
}
849853
if(g_iExtendedMax)
850854
{
851-
set_pcvar_float(g_pCvars[TIMELIMIT], get_pcvar_float(g_pCvars[TIMELIMIT]) - float(g_iExtendedMax * get_pcvar_num(g_pCvars[EXENDED_TIME])));
855+
if(get_pcvar_num(g_pCvars[EXTENDED_TYPE]) == 0)
856+
{
857+
set_pcvar_float(g_pCvars[TIMELIMIT], get_pcvar_float(g_pCvars[TIMELIMIT]) - float(g_iExtendedMax * get_pcvar_num(g_pCvars[EXTENDED_TIME])));
858+
}
859+
else
860+
{
861+
new iWinLimit = get_pcvar_num(g_pCvars[WINLIMIT]);
862+
if(iWinLimit > 0)
863+
{
864+
set_pcvar_num(g_pCvars[WINLIMIT], iWinLimit - get_pcvar_num(g_pCvars[EXTENDED_ROUNDS]) * g_iExtendedMax);
865+
}
866+
new iMaxRounds = get_pcvar_num(g_pCvars[MAXROUNDS]);
867+
if(iMaxRounds > 0)
868+
{
869+
set_pcvar_num(g_pCvars[MAXROUNDS], iMaxRounds - get_pcvar_num(g_pCvars[EXTENDED_ROUNDS]) * g_iExtendedMax);
870+
}
871+
}
852872
}
853873
}
854874
public plugin_cfg()
@@ -1406,15 +1426,15 @@ public StartVote(id)
14061426
}
14071427

14081428
#if defined FUNCTION_RTV && defined FUNCTION_NIGHTMODE
1409-
if(get_pcvar_float(g_pCvars[TIMELIMIT]) > 0.0 && !g_bRockVote && g_iExtendedMax < get_pcvar_num(g_pCvars[EXENDED_MAX]) && (g_bNightMode && g_bCurMapInNightMode || !g_bNightMode))
1429+
if(get_pcvar_float(g_pCvars[TIMELIMIT]) > 0.0 && !g_bRockVote && g_iExtendedMax < get_pcvar_num(g_pCvars[EXTENDED_MAX]) && (g_bNightMode && g_bCurMapInNightMode || !g_bNightMode))
14101430
#else
14111431
#if defined FUNCTION_RTV
1412-
if(get_pcvar_float(g_pCvars[TIMELIMIT]) > 0.0 && !g_bRockVote && g_iExtendedMax < get_pcvar_num(g_pCvars[EXENDED_MAX]))
1432+
if(get_pcvar_float(g_pCvars[TIMELIMIT]) > 0.0 && !g_bRockVote && g_iExtendedMax < get_pcvar_num(g_pCvars[EXTENDED_MAX]))
14131433
#else
14141434
#if defined FUNCTION_NIGHTMODE
1415-
if(get_pcvar_float(g_pCvars[TIMELIMIT]) > 0.0 && g_iExtendedMax < get_pcvar_num(g_pCvars[EXENDED_MAX]) && (g_bNightMode && g_bCurMapInNightMode || !g_bNightMode))
1435+
if(get_pcvar_float(g_pCvars[TIMELIMIT]) > 0.0 && g_iExtendedMax < get_pcvar_num(g_pCvars[EXTENDED_MAX]) && (g_bNightMode && g_bCurMapInNightMode || !g_bNightMode))
14161436
#else
1417-
if(get_pcvar_float(g_pCvars[TIMELIMIT]) > 0.0 && g_iExtendedMax < get_pcvar_num(g_pCvars[EXENDED_MAX]))
1437+
if(get_pcvar_float(g_pCvars[TIMELIMIT]) > 0.0 && g_iExtendedMax < get_pcvar_num(g_pCvars[EXTENDED_MAX]))
14181438
#endif
14191439
#endif
14201440
#endif
@@ -1702,11 +1722,35 @@ FinishVote()
17021722
{
17031723
g_bVoteFinished = false;
17041724
g_iExtendedMax++;
1705-
new iMin = get_pcvar_num(g_pCvars[EXENDED_TIME]);
1706-
new szMin[16]; get_ending(iMin, "MAPM_MINUTE1", "MAPM_MINUTE2", "MAPM_MINUTE3", szMin, charsmax(szMin));
17071725

1708-
client_print_color(0, print_team_default, "%s^1 %L %L.", PREFIX, LANG_SERVER, "MAPM_MAP_EXTEND", iMin, LANG_SERVER, szMin);
1709-
set_pcvar_float(g_pCvars[TIMELIMIT], get_pcvar_float(g_pCvars[TIMELIMIT]) + float(iMin));
1726+
new iWinLimit = get_pcvar_num(g_pCvars[WINLIMIT]);
1727+
new iMaxRounds = get_pcvar_num(g_pCvars[MAXROUNDS]);
1728+
1729+
if(get_pcvar_num(g_pCvars[EXTENDED_TYPE]) == 1 && (iWinLimit || iMaxRounds))
1730+
{
1731+
if(iWinLimit > 0)
1732+
{
1733+
set_pcvar_num(g_pCvars[WINLIMIT], iWinLimit + get_pcvar_num(g_pCvars[EXTENDED_ROUNDS]));
1734+
}
1735+
1736+
if(iMaxRounds > 0)
1737+
{
1738+
set_pcvar_num(g_pCvars[MAXROUNDS], iMaxRounds + get_pcvar_num(g_pCvars[EXTENDED_ROUNDS]));
1739+
}
1740+
1741+
new iRounds = get_pcvar_num(g_pCvars[EXTENDED_ROUNDS]);
1742+
new szRounds[16]; get_ending(iRounds, "MAPM_ROUND1", "MAPM_ROUND2", "MAPM_ROUND3", szRounds, charsmax(szRounds));
1743+
1744+
client_print_color(0, print_team_default, "%s^1 %L %L.", PREFIX, LANG_SERVER, "MAPM_MAP_EXTEND", iRounds, LANG_SERVER, szRounds);
1745+
}
1746+
else
1747+
{
1748+
new iMin = get_pcvar_num(g_pCvars[EXTENDED_TIME]);
1749+
new szMin[16]; get_ending(iMin, "MAPM_MINUTE1", "MAPM_MINUTE2", "MAPM_MINUTE3", szMin, charsmax(szMin));
1750+
1751+
client_print_color(0, print_team_default, "%s^1 %L %L.", PREFIX, LANG_SERVER, "MAPM_MAP_EXTEND", iMin, LANG_SERVER, szMin);
1752+
set_pcvar_float(g_pCvars[TIMELIMIT], get_pcvar_float(g_pCvars[TIMELIMIT]) + float(iMin));
1753+
}
17101754
}
17111755

17121756
new iRet;

mapmanager.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ MAPM_NOBODY_VOTE = Nobody voted. Next map is^3 %s^1.
4343
MAPM_LASTROUND = Last round.
4444
MAPM_MAP_CHANGE = Map will change in^3 %d
4545
MAPM_MAP_CHANGE_NEXTROUND = Map change will happen after this round.
46-
MAPM_MAP_EXTEND = Current map has been extended to ^3 %d^1
46+
MAPM_MAP_EXTEND = Current map has been extended to^3 %d^1
4747
MAPM_VOTE1 = votes
4848
MAPM_VOTE2 = votes
4949
MAPM_VOTE3 = votes
@@ -53,6 +53,9 @@ MAPM_SECOND3 = seconds
5353
MAPM_MINUTE1 = minutes
5454
MAPM_MINUTE2 = minutes
5555
MAPM_MINUTE3 = minutes
56+
MAPM_ROUND1 = rounds
57+
MAPM_ROUND2 = rounds
58+
MAPM_ROUND3 = rounds
5659

5760
[ru]
5861
MAPM_VOTE_WILL_BEGIN = Голосование начнется в следующем раунде.
@@ -109,3 +112,6 @@ MAPM_SECOND3 = секунды
109112
MAPM_MINUTE1 = минут
110113
MAPM_MINUTE2 = минута
111114
MAPM_MINUTE3 = минуты
115+
MAPM_ROUND1 = раундов
116+
MAPM_ROUND2 = раунд
117+
MAPM_ROUND3 = раунда

0 commit comments

Comments
 (0)