mapchooser_extended: new feature: map group restrictions

This commit is contained in:
BotoX
2018-03-20 01:06:26 +01:00
parent 229fb7b8cd
commit 3d24fb83e0
5 changed files with 192 additions and 11 deletions
@@ -309,6 +309,13 @@ public Action Command_Addmap(int client, int args)
return Plugin_Handled;
}
int GroupRestriction = GetMapGroupRestriction(mapname);
if(GroupRestriction >= 0)
{
CPrintToChat(client, "[NE] %t", "Map Nominate Group Error", GroupRestriction);
return Plugin_Handled;
}
}
NominateResult result = NominateMap(mapname, true, 0);
@@ -512,6 +519,13 @@ public Action Command_Nominate(int client, int args)
return Plugin_Handled;
}
int GroupRestriction = GetMapGroupRestriction(mapname, client);
if(GroupRestriction >= 0)
{
CPrintToChat(client, "[NE] %t", "Map Nominate Group Error", GroupRestriction);
return Plugin_Handled;
}
NominateResult result = NominateMap(mapname, false, client);
if(result > Nominate_Replaced)
@@ -726,7 +740,7 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
if((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
return ITEMDRAW_DISABLED;
if(GetMapTimeRestriction(map) || GetMapPlayerRestriction(map))
if(GetMapTimeRestriction(map) || GetMapPlayerRestriction(map) || GetMapGroupRestriction(map, param1) >= 0)
return ITEMDRAW_DISABLED;
return ITEMDRAW_DEFAULT;
@@ -813,6 +827,13 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p
return RedrawMenuItem(display);
}
int GroupRestriction = GetMapGroupRestriction(map, param1);
if(GroupRestriction >= 0)
{
Format(display, sizeof(display), "%s (%T)", buffer, "Map Group Restriction", param1, GroupRestriction);
return RedrawMenuItem(display);
}
if(mark && !official)
return RedrawMenuItem(buffer);
@@ -899,7 +920,7 @@ public int Handler_AdminMapSelectMenu(Menu menu, MenuAction action, int param1,
return ITEMDRAW_DISABLED;
}
if(GetMapTimeRestriction(map) || GetMapPlayerRestriction(map))
if(GetMapTimeRestriction(map) || GetMapPlayerRestriction(map) || GetMapGroupRestriction(map) >= 0)
return ITEMDRAW_DISABLED;
}
@@ -962,6 +983,13 @@ public int Handler_AdminMapSelectMenu(Menu menu, MenuAction action, int param1,
return RedrawMenuItem(display);
}
int GroupRestriction = GetMapGroupRestriction(map);
if(GroupRestriction >= 0)
{
Format(display, sizeof(display), "%s (%T)", buffer, "Map Group Restriction", param1, GroupRestriction);
return RedrawMenuItem(display);
}
}
return 0;