added average hour check for removing maps from nominations and added changed calls to always respect time restriction since initvote does so either way. Also added check to respect restrictions when calling sm_nomlist
This commit is contained in:
parent
ea42dabf92
commit
1cbbeecdb8
@ -602,12 +602,12 @@ public void OnClientPutInServer(int client)
|
|||||||
{
|
{
|
||||||
ClearArray(g_NominateList[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)
|
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)
|
public void OnClientDisconnect(int client)
|
||||||
@ -1783,6 +1783,9 @@ void CreateNextVote()
|
|||||||
if(InternalGetMapPlayerRestriction(map) != 0)
|
if(InternalGetMapPlayerRestriction(map) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (InternalGetAveragePlayerHourRestriction(map) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
bool okay = true;
|
bool okay = true;
|
||||||
|
|
||||||
int groups[32];
|
int groups[32];
|
||||||
@ -2036,6 +2039,7 @@ public int Native_GetExcludeMapList(Handle plugin, int numParams)
|
|||||||
delete OldMapListSnapshot;
|
delete OldMapListSnapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//GetNominatedMapList
|
||||||
public int Native_GetNominatedMapList(Handle plugin, int numParams)
|
public int Native_GetNominatedMapList(Handle plugin, int numParams)
|
||||||
{
|
{
|
||||||
Handle maparray = view_as<Handle>(GetNativeCell(1));
|
Handle maparray = view_as<Handle>(GetNativeCell(1));
|
||||||
@ -2045,7 +2049,11 @@ public int Native_GetNominatedMapList(Handle plugin, int numParams)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
static char map[PLATFORM_MAX_PATH];
|
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 client = 0; client < MaxClients; client++)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < GetArraySize(g_NominateList[client]); i++)
|
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];
|
char[] map = new char[len+1];
|
||||||
GetNativeString(1, map, len+1);
|
GetNativeString(1, map, len+1);
|
||||||
|
return InternalGetAveragePlayerHourRestriction(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
stock int InternalGetAveragePlayerHourRestriction(const char[] map)
|
||||||
|
{
|
||||||
int players_average_hours = GetAveragePlayerTimeOnServer();
|
int players_average_hours = GetAveragePlayerTimeOnServer();
|
||||||
int MinAverageHours = 0;
|
int MinAverageHours = 0;
|
||||||
if(g_Config && g_Config.JumpToKey(map))
|
if(g_Config && g_Config.JumpToKey(map))
|
||||||
@ -2402,7 +2415,6 @@ public int Native_GetAveragePlayerTimeOnServerMapRestriction(Handle plugin, int
|
|||||||
}
|
}
|
||||||
return MinAverageHours - players_average_hours;
|
return MinAverageHours - players_average_hours;
|
||||||
}
|
}
|
||||||
|
|
||||||
//GetMapPlayerRestriction
|
//GetMapPlayerRestriction
|
||||||
public int Native_GetMapPlayerRestriction(Handle plugin, int numParams)
|
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);
|
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)
|
if (remove)
|
||||||
|
Loading…
Reference in New Issue
Block a user