diff --git a/mapchooser_extended/scripting/include/mapchooser_extended.inc b/mapchooser_extended/scripting/include/mapchooser_extended.inc index 0f0c25ab..65c8773a 100644 --- a/mapchooser_extended/scripting/include/mapchooser_extended.inc +++ b/mapchooser_extended/scripting/include/mapchooser_extended.inc @@ -94,7 +94,18 @@ native bool IsMapOfficial(const char[] map); */ native CanNominateResult CanNominate(); -native bool ExcludeMap(const char[] map); +/** + * Add map to nomination exclude list. + * Known as cooldown. + * + * @param map Name of map + * @param cooldown Cooldown, interpretation depends on mode. + * @param mode 0: Normal, use cooldown value from config/default. + * 1: Set or replace cooldown with cooldown value. + * 2: Set or replace cooldown with cooldown value if greater than current cooldown. + * @return true on success + */ +native bool ExcludeMap(const char[] map, int cooldown = 0, int mode = 0); native int GetMapCooldown(const char[] map); native int GetMapMinPlayers(const char[] map); diff --git a/mapchooser_extended/scripting/mapchooser_extended.sp b/mapchooser_extended/scripting/mapchooser_extended.sp index 2a5024da..634a516b 100644 --- a/mapchooser_extended/scripting/mapchooser_extended.sp +++ b/mapchooser_extended/scripting/mapchooser_extended.sp @@ -2019,7 +2019,25 @@ public int Native_ExcludeMap(Handle plugin, int numParams) char[] map = new char[len+1]; GetNativeString(1, map, len+1); - int Cooldown = InternalGetMapCooldown(map); + int Cooldown; + int Mode = GetNativeCell(3); + + if(Mode == 0) + { + Cooldown = InternalGetMapCooldown(map); + } + else if(Mode == 1) + { + Cooldown = GetNativeCell(2); + } + else if(Mode == 2) + { + g_OldMapList.GetValue(map, Cooldown); + int NewCooldown = GetNativeCell(2); + if(NewCooldown > Cooldown) + Cooldown = NewCooldown; + } + g_OldMapList.SetValue(map, Cooldown, true); return true; diff --git a/mapchooser_extended/scripting/nominations_extended.sp b/mapchooser_extended/scripting/nominations_extended.sp index bdb8f029..f087541a 100644 --- a/mapchooser_extended/scripting/nominations_extended.sp +++ b/mapchooser_extended/scripting/nominations_extended.sp @@ -102,7 +102,7 @@ public void OnPluginStart() RegAdminCmd("sm_nominate_addmap", Command_Addmap, ADMFLAG_CHANGEMAP, "sm_nominate_addmap - Forces a map to be on the next mapvote."); RegAdminCmd("sm_nominate_removemap", Command_Removemap, ADMFLAG_CHANGEMAP, "sm_nominate_removemap - Removes a map from Nominations."); - RegAdminCmd("sm_nominate_exclude", Command_AddExclude, ADMFLAG_CHANGEMAP, "sm_nominate_exclude - Forces a map to be inserted into the recently played maps. Effectively blocking the map from being nominated."); + RegAdminCmd("sm_nominate_exclude", Command_AddExclude, ADMFLAG_CHANGEMAP, "sm_nominate_exclude [cooldown] - Forces a map to be inserted into the recently played maps. Effectively blocking the map from being nominated."); // Nominations Extended cvars CreateConVar("ne_version", MCE_VERSION, "Nominations Extended Version", FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD); @@ -296,6 +296,21 @@ public Action Command_AddExclude(int client, int args) static char mapname[PLATFORM_MAX_PATH]; GetCmdArg(1, mapname, sizeof(mapname)); + int cooldown = 0; + int mode = 0; + if(args >= 2) + { + static char buffer[8]; + GetCmdArg(2, buffer, sizeof(buffer)); + cooldown = StringToInt(buffer); + } + if(args >= 3) + { + static char buffer[8]; + GetCmdArg(3, buffer, sizeof(buffer)); + mode = StringToInt(buffer); + } + int status; if(!GetTrieValue(g_mapTrie, mapname, status)) { @@ -309,7 +324,7 @@ public Action Command_AddExclude(int client, int args) SetTrieValue(g_mapTrie, mapname, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_PREVIOUS); // native call to mapchooser_extended - ExcludeMap(mapname); + ExcludeMap(mapname, cooldown, mode); return Plugin_Handled; }