diff --git a/mapchooser_extended/scripting/mapchooser_extended.sp b/mapchooser_extended/scripting/mapchooser_extended.sp index fb7a029b..1f235127 100755 --- a/mapchooser_extended/scripting/mapchooser_extended.sp +++ b/mapchooser_extended/scripting/mapchooser_extended.sp @@ -602,12 +602,12 @@ public void OnClientPutInServer(int client) { ClearArray(g_NominateList[client]); } - CheckMapRestrictions(false, true); + CheckMapRestrictions(true, true); //when creating a mapvote its anyways respecting the time restrictions so we should also just respect them here already } public void OnClientDisconnect_Post(int client) { - CheckMapRestrictions(false, true); + CheckMapRestrictions(true, true); //when creating a mapvote its anyways respecting the time restrictions so we should also just respect them here already } public void OnClientDisconnect(int client) @@ -1783,6 +1783,9 @@ void CreateNextVote() if(InternalGetMapPlayerRestriction(map) != 0) continue; + if (InternalGetAveragePlayerHourRestriction(map) != 0) + continue; + bool okay = true; int groups[32]; @@ -2036,6 +2039,7 @@ public int Native_GetExcludeMapList(Handle plugin, int numParams) delete OldMapListSnapshot; } +//GetNominatedMapList public int Native_GetNominatedMapList(Handle plugin, int numParams) { Handle maparray = view_as(GetNativeCell(1)); @@ -2045,7 +2049,11 @@ public int Native_GetNominatedMapList(Handle plugin, int numParams) return; static char map[PLATFORM_MAX_PATH]; - + CheckMapRestrictions(true, true); + /* + when a guy checks the nomlist the only thing that has changed is the time. + Its not smart to display a map in the nominate list just for InitiateVote() to discard it anyways from the map vote just because of time based restriction + */ for (int client = 0; client < MaxClients; client++) { for(int i = 0; i < GetArraySize(g_NominateList[client]); i++) @@ -2388,6 +2396,11 @@ public int Native_GetAveragePlayerTimeOnServerMapRestriction(Handle plugin, int char[] map = new char[len+1]; GetNativeString(1, map, len+1); + return InternalGetAveragePlayerHourRestriction(map); +} + +stock int InternalGetAveragePlayerHourRestriction(const char[] map) +{ int players_average_hours = GetAveragePlayerTimeOnServer(); int MinAverageHours = 0; if(g_Config && g_Config.JumpToKey(map)) @@ -2402,7 +2415,6 @@ public int Native_GetAveragePlayerTimeOnServerMapRestriction(Handle plugin, int } return MinAverageHours - players_average_hours; } - //GetMapPlayerRestriction public int Native_GetMapPlayerRestriction(Handle plugin, int numParams) { @@ -2645,6 +2657,14 @@ void CheckMapRestrictions(bool time = false, bool players = false) CPrintToChat(client, "[MCE] %t", "Nomination Removed MaxPlayers Error", map); } } + if (InternalGetAveragePlayerHourRestriction(map) > 0 && !remove) + { + remove = true; + if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client)) + { + ReplyToCommand(client, "[MCE] Your nomination %s has been removed because it does not meet the minimum Average hour requirements.", map); + } + } } if (remove)