MCE: Adding a timeframe where all map restrictions and CDs are disabled

This commit is contained in:
neon
2019-08-17 14:31:28 +02:00
parent 9f9ad1016a
commit 73a77fa919
3 changed files with 93 additions and 21 deletions
@@ -498,7 +498,7 @@ public Action Command_Nominate(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(((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS) && AreRestrictionsActive())
{
int Cooldown = GetMapCooldown(mapname);
CPrintToChat(client, "[NE] %t (%d)", "Map in Exclude List", Cooldown);
@@ -511,7 +511,7 @@ public Action Command_Nominate(int client, int args)
}
bool VIPRestriction = GetMapVIPRestriction(mapname, client);
if(VIPRestriction)
if((VIPRestriction) && AreRestrictionsActive())
{
CPrintToChat(client, "[NE] %t", "Map Nominate VIP Error");
@@ -519,7 +519,7 @@ public Action Command_Nominate(int client, int args)
}
int TimeRestriction = GetMapTimeRestriction(mapname);
if(TimeRestriction)
if((TimeRestriction) && AreRestrictionsActive())
{
CPrintToChat(client, "[NE] %t", "Map Nominate Time Error", RoundToFloor(float(TimeRestriction / 60)), TimeRestriction % 60);
@@ -527,7 +527,7 @@ public Action Command_Nominate(int client, int args)
}
int PlayerRestriction = GetMapPlayerRestriction(mapname);
if(PlayerRestriction)
if((PlayerRestriction) && AreRestrictionsActive())
{
if(PlayerRestriction < 0)
CPrintToChat(client, "[NE] %t", "Map Nominate MinPlayers Error", PlayerRestriction * -1);
@@ -538,7 +538,7 @@ public Action Command_Nominate(int client, int args)
}
int GroupRestriction = GetMapGroupRestriction(mapname, client);
if(GroupRestriction >= 0)
if((GroupRestriction >= 0) && AreRestrictionsActive())
{
CPrintToChat(client, "[NE] %t", "Map Nominate Group Error", GroupRestriction);
return Plugin_Handled;
@@ -636,7 +636,7 @@ public int Handler_NominateListMenu(Menu menu, MenuAction action, int param1, in
GetMenuItem(menu, param2, map, sizeof(map));
bool VIPRestriction = GetMapVIPRestriction(map);
if(VIPRestriction)
if((VIPRestriction) && AreRestrictionsActive())
{
Format(display, sizeof(display), "%s (%T)", map, "VIP Nomination", param1);
return RedrawMenuItem(display);
@@ -749,7 +749,7 @@ 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))
if((GetMapTimeRestriction(map) || GetMapPlayerRestriction(map) || GetMapGroupRestriction(map, param1) >= 0 || GetMapVIPRestriction(map, param1)) && AreRestrictionsActive())
{
PrintToChat(param1, "[NE] You can't nominate this map right now.");
return 0;
@@ -794,9 +794,24 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
}
if((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
return ITEMDRAW_DISABLED;
{
if((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT)
{
return ITEMDRAW_DISABLED;
}
if(GetMapTimeRestriction(map) || GetMapPlayerRestriction(map) || GetMapGroupRestriction(map, param1) >= 0 || GetMapVIPRestriction(map, param1))
if(((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS) && AreRestrictionsActive())
{
return ITEMDRAW_DISABLED;
}
if((status & MAPSTATUS_EXCLUDE_NOMINATED) == MAPSTATUS_EXCLUDE_NOMINATED)
{
return ITEMDRAW_DISABLED;
}
}
if((GetMapTimeRestriction(map) || GetMapPlayerRestriction(map) || GetMapGroupRestriction(map, param1) >= 0 || GetMapVIPRestriction(map, param1)) && AreRestrictionsActive())
return ITEMDRAW_DISABLED;
return ITEMDRAW_DEFAULT;
@@ -843,7 +858,7 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
strcopy(buffer, sizeof(buffer), map);
bool VIPRestriction = GetMapVIPRestriction(map);
if(VIPRestriction)
if((VIPRestriction) && AreRestrictionsActive())
{
Format(buffer, sizeof(buffer), "%s (%T)", buffer, "VIP Restriction", param1);
}
@@ -856,7 +871,7 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
return RedrawMenuItem(display);
}
if((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
if(((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS) && AreRestrictionsActive())
{
int Cooldown = GetMapCooldown(map);
Format(display, sizeof(display), "%s (%T %d)", buffer, "Recently Played", param1, Cooldown);
@@ -871,14 +886,14 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
}
int TimeRestriction = GetMapTimeRestriction(map);
if(TimeRestriction)
if((TimeRestriction) && AreRestrictionsActive())
{
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)
if((PlayerRestriction) && AreRestrictionsActive())
{
if(PlayerRestriction < 0)
Format(display, sizeof(display), "%s (%T)", buffer, "Map Player Restriction", param1, "+", PlayerRestriction * -1);
@@ -889,13 +904,13 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
}
int GroupRestriction = GetMapGroupRestriction(map, param1);
if(GroupRestriction >= 0)
if((GroupRestriction >= 0) && AreRestrictionsActive())
{
Format(display, sizeof(display), "%s (%T)", buffer, "Map Group Restriction", param1, GroupRestriction);
return RedrawMenuItem(display);
}
if(VIPRestriction)
if((VIPRestriction) && AreRestrictionsActive())
{
return RedrawMenuItem(buffer);
}
@@ -920,8 +935,8 @@ stock bool IsNominateAllowed(int client)
if (!CheckCommandAccess(client, "sm_tag", ADMFLAG_CUSTOM1))
{
int VIPTimeRestriction = GetVIPTimeRestriction();
if(VIPTimeRestriction)
int VIPTimeRestriction = GetVIPTimeRestriction();
if((VIPTimeRestriction) && AreRestrictionsActive())
{
CReplyToCommand(client, "[NE] During peak hours only VIPs are allowed to nominate maps. Wait for %d hours and %d minutes or buy VIP at Unloze.com to nominate maps again.", RoundToFloor(float(VIPTimeRestriction / 60)), VIPTimeRestriction % 60);
return false;