WIP
This commit is contained in:
parent
bf8bd72176
commit
04660fde95
@ -106,8 +106,11 @@ native CanNominateResult CanNominate();
|
||||
* @return true on success
|
||||
*/
|
||||
native bool ExcludeMap(const char[] map, int cooldown = 0, int mode = 0);
|
||||
// Cooldown in minutes
|
||||
native bool ExcludeMapTime(const char[] map, int cooldown = 0, int mode = 0);
|
||||
|
||||
native int GetMapCooldown(const char[] map);
|
||||
native int GetMapCooldownTime(const char[] map); // in unix time
|
||||
native int GetMapMinTime(const char[] map);
|
||||
native int GetMapMaxTime(const char[] map);
|
||||
native int GetMapMinPlayers(const char[] map);
|
||||
@ -141,7 +144,7 @@ native bool GetMapVIPRestriction(const char[] map, int client = 0);
|
||||
*/
|
||||
native int GetExtendsLeft();
|
||||
|
||||
native int AreRestrictionsActive();
|
||||
native bool AreRestrictionsActive();
|
||||
|
||||
public SharedPlugin __pl_mapchooser_extended =
|
||||
{
|
||||
|
@ -105,6 +105,7 @@ ConVar g_Cvar_ExtendTimeStep;
|
||||
ConVar g_Cvar_ExtendRoundStep;
|
||||
ConVar g_Cvar_ExtendFragStep;
|
||||
ConVar g_Cvar_ExcludeMaps;
|
||||
ConVar g_Cvar_ExcludeMapsTime;
|
||||
ConVar g_Cvar_IncludeMaps;
|
||||
ConVar g_Cvar_IncludeMapsReserved;
|
||||
ConVar g_Cvar_NoVoteMode;
|
||||
@ -122,6 +123,7 @@ Handle g_MapList = INVALID_HANDLE;
|
||||
Handle g_NominateList = INVALID_HANDLE;
|
||||
Handle g_NominateOwners = INVALID_HANDLE;
|
||||
StringMap g_OldMapList;
|
||||
StringMap g_TimeMapList;
|
||||
Handle g_NextMapList = INVALID_HANDLE;
|
||||
Handle g_VoteMenu = INVALID_HANDLE;
|
||||
KeyValues g_Config;
|
||||
@ -224,6 +226,7 @@ public void OnPluginStart()
|
||||
g_NominateList = CreateArray(arraySize);
|
||||
g_NominateOwners = CreateArray(1);
|
||||
g_OldMapList = new StringMap();
|
||||
g_TimeMapList = new StringMap();
|
||||
g_NextMapList = CreateArray(arraySize);
|
||||
g_OfficialList = CreateArray(arraySize);
|
||||
|
||||
@ -238,6 +241,7 @@ public void OnPluginStart()
|
||||
g_Cvar_ExtendRoundStep = CreateConVar("mce_extend_roundstep", "5", "Specifies how many more rounds each extension makes", _, true, 1.0);
|
||||
g_Cvar_ExtendFragStep = CreateConVar("mce_extend_fragstep", "10", "Specifies how many more frags are allowed when map is extended.", _, true, 5.0);
|
||||
g_Cvar_ExcludeMaps = CreateConVar("mce_exclude", "5", "Specifies how many past maps to exclude from the vote.", _, true, 0.0);
|
||||
g_Cvar_ExcludeMapsTime = CreateConVar("mce_exclude_time", "5", "Specifies how long in minutes an old map is excluded from the vote.", _, true, 0.0);
|
||||
g_Cvar_IncludeMaps = CreateConVar("mce_include", "5", "Specifies how many maps to include in the vote.", _, true, 2.0, true, 7.0);
|
||||
g_Cvar_IncludeMapsReserved = CreateConVar("mce_include_reserved", "2", "Specifies how many private/random maps to include in the vote.", _, true, 0.0, true, 5.0);
|
||||
g_Cvar_NoVoteMode = CreateConVar("mce_novote", "1", "Specifies whether or not MapChooser should pick a map if no votes are received.", _, true, 0.0, true, 1.0);
|
||||
@ -406,7 +410,9 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
|
||||
CreateNative("IsMapOfficial", Native_IsMapOfficial);
|
||||
CreateNative("CanNominate", Native_CanNominate);
|
||||
CreateNative("ExcludeMap", Native_ExcludeMap);
|
||||
CreateNative("ExcludeMapTime", Native_ExcludeMapTime);
|
||||
CreateNative("GetMapCooldown", Native_GetMapCooldown);
|
||||
CreateNative("GetMapCooldownTime", Native_GetMapCooldownTime);
|
||||
CreateNative("GetMapMinTime", Native_GetMapMinTime);
|
||||
CreateNative("GetMapMaxTime", Native_GetMapMaxTime);
|
||||
CreateNative("GetMapMinPlayers", Native_GetMapMinPlayers);
|
||||
@ -534,6 +540,9 @@ public void OnMapEnd()
|
||||
GetCurrentMap(map, PLATFORM_MAX_PATH);
|
||||
Cooldown = InternalGetMapCooldown(map);
|
||||
g_OldMapList.SetValue(map, Cooldown, true);
|
||||
|
||||
Cooldown = InternalGetMapCooldownTime(map);
|
||||
g_TimeMapList.SetValue(map, Cooldown, true);
|
||||
}
|
||||
|
||||
StringMapSnapshot OldMapListSnapshot = g_OldMapList.Snapshot();
|
||||
@ -548,8 +557,20 @@ public void OnMapEnd()
|
||||
else
|
||||
g_OldMapList.Remove(map);
|
||||
}
|
||||
InternalStoreMapCooldowns();
|
||||
delete OldMapListSnapshot;
|
||||
|
||||
StringMapSnapshot TimeMapListSnapshot = g_TimeMapList.Snapshot();
|
||||
for(int i = 0; i < TimeMapListSnapshot.Length; i++)
|
||||
{
|
||||
TimeMapListSnapshot.GetKey(i, map, sizeof(map));
|
||||
g_TimeMapList.GetValue(map, Cooldown);
|
||||
|
||||
if(Cooldown < GetTime())
|
||||
g_TimeMapList.Remove(map);
|
||||
}
|
||||
delete OldMapListSnapshot;
|
||||
|
||||
InternalStoreMapCooldowns();
|
||||
}
|
||||
|
||||
public void OnClientPutInServer(int client)
|
||||
@ -1552,7 +1573,7 @@ void CreateNextVote()
|
||||
GetCurrentMap(map, PLATFORM_MAX_PATH);
|
||||
RemoveStringFromArray(tempMaps, map);
|
||||
|
||||
if((GetConVarInt(g_Cvar_ExcludeMaps) && GetArraySize(tempMaps) > GetConVarInt(g_Cvar_ExcludeMaps)) && (InternalAreRestrictionsActive()))
|
||||
if(GetConVarInt(g_Cvar_ExcludeMaps) && GetArraySize(tempMaps) > GetConVarInt(g_Cvar_ExcludeMaps) && InternalAreRestrictionsActive())
|
||||
{
|
||||
StringMapSnapshot OldMapListSnapshot = g_OldMapList.Snapshot();
|
||||
for(int i = 0; i < OldMapListSnapshot.Length; i++)
|
||||
@ -1563,6 +1584,21 @@ void CreateNextVote()
|
||||
delete OldMapListSnapshot;
|
||||
}
|
||||
|
||||
if(GetConVarInt(g_Cvar_ExcludeMapsTime) && InternalAreRestrictionsActive())
|
||||
{
|
||||
StringMapSnapshot TimeMapListSnapshot = g_TimeMapList.Snapshot();
|
||||
for(int i = 0; i < TimeMapListSnapshot.Length; i++)
|
||||
{
|
||||
TimeMapListSnapshot.GetKey(i, map, sizeof(map));
|
||||
int Cooldown;
|
||||
g_TimeMapList.GetValue(map, Cooldown);
|
||||
|
||||
if(Cooldown > GetTime())
|
||||
RemoveStringFromArray(tempMaps, map);
|
||||
}
|
||||
delete TimeMapListSnapshot;
|
||||
}
|
||||
|
||||
int voteSize = GetVoteSize(2);
|
||||
int limit = (voteSize < GetArraySize(tempMaps) ? voteSize : GetArraySize(tempMaps));
|
||||
|
||||
@ -2031,8 +2067,51 @@ public int Native_ExcludeMap(Handle plugin, int numParams)
|
||||
return true;
|
||||
}
|
||||
|
||||
public int Native_ExcludeMapTime(Handle plugin, int numParams)
|
||||
{
|
||||
if(!InternalAreRestrictionsActive())
|
||||
return true;
|
||||
|
||||
int len;
|
||||
GetNativeStringLength(1, len);
|
||||
|
||||
if(len <= 0)
|
||||
return false;
|
||||
|
||||
char[] map = new char[len+1];
|
||||
GetNativeString(1, map, len+1);
|
||||
|
||||
int Cooldown;
|
||||
int Mode = GetNativeCell(3);
|
||||
|
||||
if(Mode == 0)
|
||||
{
|
||||
Cooldown = InternalGetMapCooldownTime(map);
|
||||
}
|
||||
else if(Mode == 1)
|
||||
{
|
||||
Cooldown = GetNativeCell(2) * 60;
|
||||
}
|
||||
else if(Mode == 2)
|
||||
{
|
||||
g_TimeMapList.GetValue(map, Cooldown);
|
||||
int NewCooldown = GetTime() + GetNativeCell(2) * 60;
|
||||
if(NewCooldown > Cooldown)
|
||||
Cooldown = GetNativeCell(2) * 60;
|
||||
}
|
||||
|
||||
Cooldown += GetTime();
|
||||
g_TimeMapList.SetValue(map, Cooldown, true);
|
||||
InternalStoreMapCooldowns();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int Native_GetMapCooldown(Handle plugin, int numParams)
|
||||
{
|
||||
if(!InternalAreRestrictionsActive())
|
||||
return 0;
|
||||
|
||||
int len;
|
||||
GetNativeStringLength(1, len);
|
||||
|
||||
@ -2048,6 +2127,26 @@ public int Native_GetMapCooldown(Handle plugin, int numParams)
|
||||
return Cooldown;
|
||||
}
|
||||
|
||||
public int Native_GetMapCooldownTime(Handle plugin, int numParams)
|
||||
{
|
||||
if(!InternalAreRestrictionsActive())
|
||||
return 0;
|
||||
|
||||
int len;
|
||||
GetNativeStringLength(1, len);
|
||||
|
||||
if(len <= 0)
|
||||
return false;
|
||||
|
||||
char[] map = new char[len+1];
|
||||
GetNativeString(1, map, len+1);
|
||||
|
||||
int Cooldown = 0;
|
||||
g_TimeMapList.GetValue(map, Cooldown);
|
||||
|
||||
return Cooldown;
|
||||
}
|
||||
|
||||
public int Native_GetMapMinTime(Handle plugin, int numParams)
|
||||
{
|
||||
int len;
|
||||
@ -2304,6 +2403,19 @@ stock int InternalGetMapCooldown(const char[] map)
|
||||
return Cooldown;
|
||||
}
|
||||
|
||||
stock int InternalGetMapCooldownTime(const char[] map)
|
||||
{
|
||||
int Cooldown = g_Cvar_ExcludeMapsTime.IntValue;
|
||||
|
||||
if(g_Config && g_Config.JumpToKey(map))
|
||||
{
|
||||
Cooldown = g_Config.GetNum("CooldownTime", Cooldown);
|
||||
g_Config.Rewind();
|
||||
}
|
||||
|
||||
return Cooldown;
|
||||
}
|
||||
|
||||
void CheckMapRestrictions(bool time = false, bool players = false)
|
||||
{
|
||||
if(!InternalAreRestrictionsActive())
|
||||
@ -2513,10 +2625,10 @@ stock int InternalGetMapPlayerRestriction(const char[] map)
|
||||
return 0;
|
||||
}
|
||||
|
||||
stock int InternalAreRestrictionsActive()
|
||||
stock bool InternalAreRestrictionsActive()
|
||||
{
|
||||
if (!GetConVarBool(g_Cvar_NoRestrictionTimeframeEnable))
|
||||
return 1;
|
||||
return true;
|
||||
|
||||
char sTime[8];
|
||||
FormatTime(sTime, sizeof(sTime), "%H%M");
|
||||
@ -2531,10 +2643,10 @@ stock int InternalAreRestrictionsActive()
|
||||
|
||||
if ((MinTime <= CurTime <= MaxTime))
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
stock int FindIntInArray(int[] array, int size, int value)
|
||||
@ -2605,6 +2717,12 @@ stock void InternalRestoreMapCooldowns()
|
||||
LogMessage("Restored cooldown: %s -> %d", map, Cooldown);
|
||||
g_OldMapList.SetValue(map, Cooldown, true);
|
||||
}
|
||||
|
||||
if((Cooldown = Cooldowns.GetNum("CooldownTime", -1)) > 0)
|
||||
{
|
||||
LogMessage("Restored time cooldown: %s -> %d", map, Cooldown);
|
||||
g_TimeMapList.SetValue(map, Cooldown, true);
|
||||
}
|
||||
} while(Cooldowns.GotoNextKey(true));
|
||||
|
||||
delete Cooldowns;
|
||||
@ -2643,15 +2761,33 @@ stock void InternalStoreMapCooldowns()
|
||||
Cooldowns.SetNum("Cooldown", Cooldown);
|
||||
Cooldowns.Rewind();
|
||||
}
|
||||
delete OldMapListSnapshot;
|
||||
|
||||
StringMapSnapshot TimeMapListSnapshot = g_TimeMapList.Snapshot();
|
||||
for(int i = 0; i < TimeMapListSnapshot.Length; i++)
|
||||
{
|
||||
TimeMapListSnapshot.GetKey(i, map, sizeof(map));
|
||||
g_TimeMapList.GetValue(map, Cooldown);
|
||||
|
||||
if (!Cooldowns.JumpToKey(map, true))
|
||||
{
|
||||
LogMessage("Unable to create/find key: %s", map);
|
||||
delete TimeMapListSnapshot;
|
||||
delete Cooldowns;
|
||||
return;
|
||||
}
|
||||
|
||||
Cooldowns.SetNum("CooldownTime", Cooldown);
|
||||
Cooldowns.Rewind();
|
||||
}
|
||||
delete TimeMapListSnapshot;
|
||||
|
||||
if(!Cooldowns.ExportToFile(sCooldownFile))
|
||||
{
|
||||
LogMessage("Unable to export cooldown file: \"%s\"", sCooldownFile);
|
||||
delete OldMapListSnapshot;
|
||||
delete Cooldowns;
|
||||
return;
|
||||
}
|
||||
|
||||
delete OldMapListSnapshot;
|
||||
delete Cooldowns;
|
||||
}
|
@ -280,6 +280,8 @@ public Action Command_Addmap(int client, int args)
|
||||
|
||||
if(!CheckCommandAccess(client, "sm_nominate_ignore", ADMFLAG_CHEATS, true))
|
||||
{
|
||||
bool RestrictionsActive = AreRestrictionsActive();
|
||||
|
||||
int status;
|
||||
if(GetTrieValue(g_mapTrie, mapname, status))
|
||||
{
|
||||
@ -288,7 +290,7 @@ public Action Command_Addmap(int client, int args)
|
||||
if((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT)
|
||||
CPrintToChat(client, "[NE] %t", "Can't Nominate Current Map");
|
||||
|
||||
if((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
|
||||
if(RestrictionsActive && (status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
|
||||
{
|
||||
int Cooldown = GetMapCooldown(mapname);
|
||||
CPrintToChat(client, "[NE] %t (%d)", "Map in Exclude List", Cooldown);
|
||||
@ -302,7 +304,7 @@ public Action Command_Addmap(int client, int args)
|
||||
}
|
||||
|
||||
int TimeRestriction = GetMapTimeRestriction(mapname);
|
||||
if(TimeRestriction)
|
||||
if(RestrictionsActive && TimeRestriction)
|
||||
{
|
||||
CPrintToChat(client, "[NE] %t", "Map Nominate Time Error", RoundToFloor(float(TimeRestriction / 60)), TimeRestriction % 60);
|
||||
|
||||
@ -310,7 +312,7 @@ public Action Command_Addmap(int client, int args)
|
||||
}
|
||||
|
||||
int PlayerRestriction = GetMapPlayerRestriction(mapname);
|
||||
if(PlayerRestriction)
|
||||
if(RestrictionsActive && PlayerRestriction)
|
||||
{
|
||||
if(PlayerRestriction < 0)
|
||||
CPrintToChat(client, "[NE] %t", "Map Nominate MinPlayers Error", PlayerRestriction * -1);
|
||||
@ -321,7 +323,7 @@ public Action Command_Addmap(int client, int args)
|
||||
}
|
||||
|
||||
int GroupRestriction = GetMapGroupRestriction(mapname);
|
||||
if(GroupRestriction >= 0)
|
||||
if(RestrictionsActive && GroupRestriction >= 0)
|
||||
{
|
||||
CPrintToChat(client, "[NE] %t", "Map Nominate Group Error", GroupRestriction);
|
||||
return Plugin_Handled;
|
||||
@ -485,6 +487,7 @@ public Action Command_Nominate(int client, int args)
|
||||
static char mapname[PLATFORM_MAX_PATH];
|
||||
GetCmdArg(1, mapname, sizeof(mapname));
|
||||
|
||||
|
||||
int status;
|
||||
if(!GetTrieValue(g_mapTrie, mapname, status))
|
||||
{
|
||||
@ -493,12 +496,14 @@ public Action Command_Nominate(int client, int args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
bool RestrictionsActive = AreRestrictionsActive();
|
||||
|
||||
if((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
|
||||
{
|
||||
if((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT)
|
||||
CPrintToChat(client, "[NE] %t", "Can't Nominate Current Map");
|
||||
|
||||
if(((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS) && AreRestrictionsActive())
|
||||
if(RestrictionsActive && (status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
|
||||
{
|
||||
int Cooldown = GetMapCooldown(mapname);
|
||||
CPrintToChat(client, "[NE] %t (%d)", "Map in Exclude List", Cooldown);
|
||||
@ -511,7 +516,7 @@ public Action Command_Nominate(int client, int args)
|
||||
}
|
||||
|
||||
bool VIPRestriction = GetMapVIPRestriction(mapname, client);
|
||||
if((VIPRestriction) && AreRestrictionsActive())
|
||||
if(RestrictionsActive && VIPRestriction)
|
||||
{
|
||||
CPrintToChat(client, "[NE] %t", "Map Nominate VIP Error");
|
||||
|
||||
@ -519,7 +524,7 @@ public Action Command_Nominate(int client, int args)
|
||||
}
|
||||
|
||||
int TimeRestriction = GetMapTimeRestriction(mapname);
|
||||
if((TimeRestriction) && AreRestrictionsActive())
|
||||
if(RestrictionsActive && TimeRestriction)
|
||||
{
|
||||
CPrintToChat(client, "[NE] %t", "Map Nominate Time Error", RoundToFloor(float(TimeRestriction / 60)), TimeRestriction % 60);
|
||||
|
||||
@ -527,7 +532,7 @@ public Action Command_Nominate(int client, int args)
|
||||
}
|
||||
|
||||
int PlayerRestriction = GetMapPlayerRestriction(mapname);
|
||||
if((PlayerRestriction) && AreRestrictionsActive())
|
||||
if(RestrictionsActive && PlayerRestriction)
|
||||
{
|
||||
if(PlayerRestriction < 0)
|
||||
CPrintToChat(client, "[NE] %t", "Map Nominate MinPlayers Error", PlayerRestriction * -1);
|
||||
@ -538,7 +543,7 @@ public Action Command_Nominate(int client, int args)
|
||||
}
|
||||
|
||||
int GroupRestriction = GetMapGroupRestriction(mapname, client);
|
||||
if((GroupRestriction >= 0) && AreRestrictionsActive())
|
||||
if(RestrictionsActive && GroupRestriction >= 0)
|
||||
{
|
||||
CPrintToChat(client, "[NE] %t", "Map Nominate Group Error", GroupRestriction);
|
||||
return Plugin_Handled;
|
||||
@ -749,7 +754,12 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
|
||||
|
||||
GetClientName(param1, name, MAX_NAME_LENGTH);
|
||||
|
||||
if((GetMapTimeRestriction(map) || GetMapPlayerRestriction(map) || GetMapGroupRestriction(map, param1) >= 0 || GetMapVIPRestriction(map, param1)) && AreRestrictionsActive())
|
||||
if(AreRestrictionsActive() && (
|
||||
GetMapCooldownTime(map) > GetTime() ||
|
||||
GetMapTimeRestriction(map) ||
|
||||
GetMapPlayerRestriction(map) ||
|
||||
GetMapGroupRestriction(map, param1) >= 0 ||
|
||||
GetMapVIPRestriction(map, param1)))
|
||||
{
|
||||
PrintToChat(param1, "[NE] You can't nominate this map right now.");
|
||||
return 0;
|
||||
@ -800,7 +810,7 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
|
||||
return ITEMDRAW_DISABLED;
|
||||
}
|
||||
|
||||
if(((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS) && AreRestrictionsActive())
|
||||
if(AreRestrictionsActive() && (status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
|
||||
{
|
||||
return ITEMDRAW_DISABLED;
|
||||
}
|
||||
@ -811,8 +821,15 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
|
||||
}
|
||||
}
|
||||
|
||||
if((GetMapTimeRestriction(map) || GetMapPlayerRestriction(map) || GetMapGroupRestriction(map, param1) >= 0 || GetMapVIPRestriction(map, param1)) && AreRestrictionsActive())
|
||||
if(AreRestrictionsActive() && (
|
||||
GetMapCooldownTime(map) > GetTime() ||
|
||||
GetMapTimeRestriction(map) ||
|
||||
GetMapPlayerRestriction(map) ||
|
||||
GetMapGroupRestriction(map, param1) >= 0 ||
|
||||
GetMapVIPRestriction(map, param1)))
|
||||
{
|
||||
return ITEMDRAW_DISABLED;
|
||||
}
|
||||
|
||||
return ITEMDRAW_DEFAULT;
|
||||
}
|
||||
@ -857,8 +874,10 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
|
||||
else
|
||||
strcopy(buffer, sizeof(buffer), map);
|
||||
|
||||
bool RestrictionsActive = AreRestrictionsActive();
|
||||
|
||||
bool VIPRestriction = GetMapVIPRestriction(map);
|
||||
if((VIPRestriction) && AreRestrictionsActive())
|
||||
if(RestrictionsActive && VIPRestriction)
|
||||
{
|
||||
Format(buffer, sizeof(buffer), "%s (%T)", buffer, "VIP Restriction", param1);
|
||||
}
|
||||
@ -871,7 +890,7 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
|
||||
return RedrawMenuItem(display);
|
||||
}
|
||||
|
||||
if(((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS) && AreRestrictionsActive())
|
||||
if(RestrictionsActive && (status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
|
||||
{
|
||||
int Cooldown = GetMapCooldown(map);
|
||||
Format(display, sizeof(display), "%s (%T %d)", buffer, "Recently Played", param1, Cooldown);
|
||||
@ -886,14 +905,14 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
|
||||
}
|
||||
|
||||
int TimeRestriction = GetMapTimeRestriction(map);
|
||||
if((TimeRestriction) && AreRestrictionsActive())
|
||||
if(RestrictionsActive && TimeRestriction)
|
||||
{
|
||||
Format(display, sizeof(display), "%s (%T)", buffer, "Map Time Restriction", param1, "+", RoundToFloor(float(TimeRestriction / 60)), TimeRestriction % 60);
|
||||
return RedrawMenuItem(display);
|
||||
}
|
||||
|
||||
int PlayerRestriction = GetMapPlayerRestriction(map);
|
||||
if((PlayerRestriction) && AreRestrictionsActive())
|
||||
if(RestrictionsActive && PlayerRestriction)
|
||||
{
|
||||
if(PlayerRestriction < 0)
|
||||
Format(display, sizeof(display), "%s (%T)", buffer, "Map Player Restriction", param1, "+", PlayerRestriction * -1);
|
||||
@ -904,13 +923,13 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
|
||||
}
|
||||
|
||||
int GroupRestriction = GetMapGroupRestriction(map, param1);
|
||||
if((GroupRestriction >= 0) && AreRestrictionsActive())
|
||||
if(RestrictionsActive && GroupRestriction >= 0)
|
||||
{
|
||||
Format(display, sizeof(display), "%s (%T)", buffer, "Map Group Restriction", param1, GroupRestriction);
|
||||
return RedrawMenuItem(display);
|
||||
}
|
||||
|
||||
if((VIPRestriction) && AreRestrictionsActive())
|
||||
if(RestrictionsActive && VIPRestriction)
|
||||
{
|
||||
return RedrawMenuItem(buffer);
|
||||
}
|
||||
@ -1036,6 +1055,8 @@ public int Handler_AdminMapSelectMenu(Menu menu, MenuAction action, int param1,
|
||||
|
||||
strcopy(buffer, sizeof(buffer), map);
|
||||
|
||||
bool RestrictionsActive = AreRestrictionsActive();
|
||||
|
||||
int status;
|
||||
if(GetTrieValue(g_mapTrie, map, status))
|
||||
{
|
||||
@ -1047,7 +1068,7 @@ public int Handler_AdminMapSelectMenu(Menu menu, MenuAction action, int param1,
|
||||
return RedrawMenuItem(display);
|
||||
}
|
||||
|
||||
if((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
|
||||
if(RestrictionsActive && (status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
|
||||
{
|
||||
int Cooldown = GetMapCooldown(map);
|
||||
Format(display, sizeof(display), "%s (%T %d)", buffer, "Recently Played", param1, Cooldown);
|
||||
@ -1063,7 +1084,7 @@ public int Handler_AdminMapSelectMenu(Menu menu, MenuAction action, int param1,
|
||||
}
|
||||
|
||||
int TimeRestriction = GetMapTimeRestriction(map);
|
||||
if(TimeRestriction)
|
||||
if(RestrictionsActive && TimeRestriction)
|
||||
{
|
||||
Format(display, sizeof(display), "%s (%T)", buffer, "Map Time Restriction", param1, "+", RoundToFloor(float(TimeRestriction / 60)), TimeRestriction % 60);
|
||||
|
||||
@ -1071,7 +1092,7 @@ public int Handler_AdminMapSelectMenu(Menu menu, MenuAction action, int param1,
|
||||
}
|
||||
|
||||
int PlayerRestriction = GetMapPlayerRestriction(map);
|
||||
if(PlayerRestriction)
|
||||
if(RestrictionsActive && PlayerRestriction)
|
||||
{
|
||||
if(PlayerRestriction < 0)
|
||||
Format(display, sizeof(display), "%s (%T)", buffer, "Map Player Restriction", param1, "+", PlayerRestriction * -1);
|
||||
@ -1082,7 +1103,7 @@ public int Handler_AdminMapSelectMenu(Menu menu, MenuAction action, int param1,
|
||||
}
|
||||
|
||||
int GroupRestriction = GetMapGroupRestriction(map);
|
||||
if(GroupRestriction >= 0)
|
||||
if(RestrictionsActive && GroupRestriction >= 0)
|
||||
{
|
||||
Format(display, sizeof(display), "%s (%T)", buffer, "Map Group Restriction", param1, GroupRestriction);
|
||||
return RedrawMenuItem(display);
|
||||
@ -1214,3 +1235,15 @@ stock int GetVIPTimeRestriction()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
stock void CustomFormatTime(int seconds, char[] buffer, int maxlen)
|
||||
{
|
||||
if(seconds <= 60)
|
||||
Format(buffer, maxlen, "%ds", seconds);
|
||||
else if(seconds <= 3600)
|
||||
Format(buffer, maxlen, "%dm", RoundToNearest(seconds / 60));
|
||||
else if(seconds <= 10*3600)
|
||||
Format(buffer, maxlen, "%dh%dm", RoundToFloor(seconds / 3600), RoundToNearest((seconds % 3600) / 60));
|
||||
else
|
||||
Format(buffer, maxlen, "%dh", RoundToNearest(seconds / 3600));
|
||||
}
|
||||
|
@ -2,45 +2,45 @@
|
||||
{
|
||||
"Vote Nextmap"
|
||||
{
|
||||
"en" "Vote for the next map!"
|
||||
"en" "Vote for the next map!"
|
||||
}
|
||||
|
||||
"Nextmap Voting Started"
|
||||
{
|
||||
"en" "Voting for next map has started."
|
||||
"en" "Voting for next map has started."
|
||||
}
|
||||
|
||||
"Nextmap Voting Finished"
|
||||
{
|
||||
"#format" "{1:s},{2:i},{3:i}"
|
||||
"en" "Map voting has finished. The next map will be {1}. (Received {2}%% of {3} votes)"
|
||||
"#format" "{1:s},{2:i},{3:i}"
|
||||
"en" "Map voting has finished. The next map will be {1}. (Received {2}%% of {3} votes)"
|
||||
}
|
||||
|
||||
"Current Map Extended"
|
||||
{
|
||||
"#format" "{1:i},{2:i}"
|
||||
"en" "The current map has been extended. (Received {1}%% of {2} votes)"
|
||||
"#format" "{1:i},{2:i}"
|
||||
"en" "The current map has been extended. (Received {1}%% of {2} votes)"
|
||||
}
|
||||
|
||||
"Extend Map"
|
||||
{
|
||||
"en" "Extend Current Map"
|
||||
"en" "Extend Current Map"
|
||||
}
|
||||
|
||||
"Dont Change"
|
||||
{
|
||||
"en" "Don't Change"
|
||||
"en" "Don't Change"
|
||||
}
|
||||
|
||||
"Current Map Stays"
|
||||
{
|
||||
"#format" "{1:i},{2:i}"
|
||||
"en" "Current map continues! The Vote has spoken! (Received {1}%% of {2} votes)"
|
||||
"#format" "{1:i},{2:i}"
|
||||
"en" "Current map continues! The Vote has spoken! (Received {1}%% of {2} votes)"
|
||||
}
|
||||
|
||||
"Changed Next Map"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"#format" "{1:s}"
|
||||
"en" "Changed nextmap to \"{1}\"."
|
||||
}
|
||||
|
||||
@ -108,76 +108,76 @@
|
||||
|
||||
"VIP Nomination"
|
||||
{
|
||||
"en" "VIP Nomination"
|
||||
"en" "VIP"
|
||||
}
|
||||
|
||||
"Map Nominate VIP Error"
|
||||
{
|
||||
"en" "Only VIPs can nominate this map."
|
||||
"en" "Only VIPs can nominate this map."
|
||||
}
|
||||
|
||||
"Map Nominate Time Error"
|
||||
{
|
||||
"#format" "{1:d},{2:d}"
|
||||
"en" "You can only nominate this map in {1} hours and {2} minutes."
|
||||
"#format" "{1:d},{2:d}"
|
||||
"en" "You can nominate this map in {1} hours and {2} minutes."
|
||||
}
|
||||
|
||||
"Map Nominate MinPlayers Error"
|
||||
{
|
||||
"#format" "{1:d}"
|
||||
"en" "Map requires {1} more players."
|
||||
"#format" "{1:d}"
|
||||
"en" "Map requires {1} more players."
|
||||
}
|
||||
|
||||
"Map Nominate MaxPlayers Error"
|
||||
{
|
||||
"#format" "{1:d}"
|
||||
"en" "Map requires {1} less players."
|
||||
"#format" "{1:d}"
|
||||
"en" "Map requires {1} less players."
|
||||
}
|
||||
|
||||
"Map Nominate Group Error"
|
||||
{
|
||||
"#format" "{1:d}"
|
||||
"en" "The maximum amount ({1}) of maps from this group has already been nominated."
|
||||
"#format" "{1:d}"
|
||||
"en" "The maximum amount ({1}) of maps from this group has already been nominated."
|
||||
}
|
||||
|
||||
"Map Time Restriction"
|
||||
{
|
||||
"#format" "{1:s},{2:d},{3:d}"
|
||||
"en" "Time{1}{2}H{3}M"
|
||||
"#format" "{1:s},{2:d},{3:d}"
|
||||
"en" "Time{1}{2}H{3}M"
|
||||
}
|
||||
|
||||
"Map Player Restriction"
|
||||
{
|
||||
"#format" "{1:s},{2:d}"
|
||||
"en" "Players{1}{2}"
|
||||
"#format" "{1:s},{2:d}"
|
||||
"en" "Players{1}{2}"
|
||||
}
|
||||
|
||||
"Map Group Restriction"
|
||||
{
|
||||
"#format" "{1:d}"
|
||||
"en" "Group max: {1}"
|
||||
"#format" "{1:d}"
|
||||
"en" "Group max: {1}"
|
||||
}
|
||||
|
||||
"VIP Restriction"
|
||||
{
|
||||
"en" "VIP only"
|
||||
"en" "VIP only"
|
||||
}
|
||||
|
||||
"Nomination Removed Time Error"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"en" "Your nomination {1} has been removed because it doesn't meet the time requirements."
|
||||
"#format" "{1:s}"
|
||||
"en" "Your nomination {1} has been removed because it doesn't meet the time requirements."
|
||||
}
|
||||
|
||||
"Nomination Removed MinPlayers Error"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"en" "Your nomination {1} has been removed because it doesn't meet the minimum player requirements."
|
||||
"#format" "{1:s}"
|
||||
"en" "Your nomination {1} has been removed because it doesn't meet the minimum player requirements."
|
||||
}
|
||||
|
||||
"Nomination Removed MaxPlayers Error"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"en" "Your nomination {1} has been removed because it exceeds the maximum player restriction."
|
||||
"#format" "{1:s}"
|
||||
"en" "Your nomination {1} has been removed because it exceeds the maximum player restriction."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user