fixed percentage bugs and voting bugs when vote finished
This commit is contained in:
parent
8b03595c85
commit
75816b367d
@ -257,6 +257,10 @@ public void OnPluginStart()
|
|||||||
for (int i = 0; i < MaxClients; i++)
|
for (int i = 0; i < MaxClients; i++)
|
||||||
{
|
{
|
||||||
g_NominateList[i] = CreateArray(arraySize);
|
g_NominateList[i] = CreateArray(arraySize);
|
||||||
|
if (IsValidClient(i))
|
||||||
|
{
|
||||||
|
OnClientPostAdminCheck(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGameFolderName(g_GameModName, sizeof(g_GameModName));
|
GetGameFolderName(g_GameModName, sizeof(g_GameModName));
|
||||||
@ -1365,7 +1369,7 @@ void InitiateVote(MapChange when, Handle inputlist=INVALID_HANDLE)
|
|||||||
|
|
||||||
int clients[MAXPLAYERS + 1];
|
int clients[MAXPLAYERS + 1];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 0; i <= MaxClients; i++)
|
for (int i = 0; i < MaxClients; i++)
|
||||||
{
|
{
|
||||||
player_mapvote_worth[i] = 0.0;
|
player_mapvote_worth[i] = 0.0;
|
||||||
Format(player_mapvote[i], 128, "");
|
Format(player_mapvote[i], 128, "");
|
||||||
@ -1403,7 +1407,7 @@ public Action Timer_Countdown(Handle timer)
|
|||||||
char picked_map[PLATFORM_MAX_PATH];
|
char picked_map[PLATFORM_MAX_PATH];
|
||||||
for (int i = 0; i < MaxClients; i++)
|
for (int i = 0; i < MaxClients; i++)
|
||||||
{
|
{
|
||||||
if (IsValidClient(i) && !StrEqual(player_mapvote[i], ""))
|
if (IsValidClient(i) && !StrEqual(player_mapvote[i], "") && !is_bot_player[i] && PM_IsPlayerSteam(i))
|
||||||
{
|
{
|
||||||
if (StrEqual(player_mapvote[i], most_voted_map[0]) || StrEqual(player_mapvote[i], most_voted_map[1]) ||
|
if (StrEqual(player_mapvote[i], most_voted_map[0]) || StrEqual(player_mapvote[i], most_voted_map[1]) ||
|
||||||
StrEqual(player_mapvote[i], most_voted_map[2]))
|
StrEqual(player_mapvote[i], most_voted_map[2]))
|
||||||
@ -1430,9 +1434,10 @@ public Action Timer_Countdown(Handle timer)
|
|||||||
float voted_so_far = 0.0;
|
float voted_so_far = 0.0;
|
||||||
for (int i = 0; i < MaxClients; i++)
|
for (int i = 0; i < MaxClients; i++)
|
||||||
{
|
{
|
||||||
if (IsValidClient(i))
|
if (IsValidClient(i) && !is_bot_player[i] && PM_IsPlayerSteam(i))
|
||||||
{
|
{
|
||||||
total_votes += player_mapvote_worth[i];
|
total_votes += player_mapvote_worth[i];
|
||||||
|
//LogMessage("client: %N player_mapvote_worth i: %f", i, player_mapvote_worth[i]);
|
||||||
if (!StrEqual(player_mapvote[i], ""))
|
if (!StrEqual(player_mapvote[i], ""))
|
||||||
{
|
{
|
||||||
voted_so_far += player_mapvote_worth[i];
|
voted_so_far += player_mapvote_worth[i];
|
||||||
@ -1498,7 +1503,7 @@ public void Handler_VoteFinishedGeneric(char[] map,
|
|||||||
if(fraglimit)
|
if(fraglimit)
|
||||||
SetConVarInt(g_Cvar_Fraglimit, fraglimit + GetConVarInt(g_Cvar_ExtendFragStep));
|
SetConVarInt(g_Cvar_Fraglimit, fraglimit + GetConVarInt(g_Cvar_ExtendFragStep));
|
||||||
|
|
||||||
CPrintToChatAll("[MCE] %t", "Current Map Extended", RoundToFloor(map_votes /num_votes*100.0));
|
CPrintToChatAll("[MCE] %t", "Current Map Extended", RoundToFloor((map_votes /num_votes)*100.0));
|
||||||
LogAction(-1, -1, "Voting for next map has finished. The current map has been extended.");
|
LogAction(-1, -1, "Voting for next map has finished. The current map has been extended.");
|
||||||
CPrintToChatAll("[MCE] Available Extends: %d", GetConVarInt(g_Cvar_Extend) - g_Extends);
|
CPrintToChatAll("[MCE] Available Extends: %d", GetConVarInt(g_Cvar_Extend) - g_Extends);
|
||||||
|
|
||||||
@ -1509,7 +1514,7 @@ public void Handler_VoteFinishedGeneric(char[] map,
|
|||||||
}
|
}
|
||||||
else if(strcmp(map, VOTE_DONTCHANGE, false) == 0)
|
else if(strcmp(map, VOTE_DONTCHANGE, false) == 0)
|
||||||
{
|
{
|
||||||
CPrintToChatAll("[MCE] %t", "Current Map Stays", RoundToFloor(map_votes /num_votes*100.0));
|
CPrintToChatAll("[MCE] %t", "Current Map Stays", RoundToFloor((map_votes /num_votes)*100.0));
|
||||||
LogAction(-1, -1, "Voting for next map has finished. 'No Change' was the winner");
|
LogAction(-1, -1, "Voting for next map has finished. 'No Change' was the winner");
|
||||||
|
|
||||||
g_RunoffCount = 0;
|
g_RunoffCount = 0;
|
||||||
@ -1558,22 +1563,25 @@ public void Handler_MapVoteFinished(Handle menu,
|
|||||||
for (int i = 0; i < num_clients; i++)
|
for (int i = 0; i < num_clients; i++)
|
||||||
{
|
{
|
||||||
int client = client_info[i][0];
|
int client = client_info[i][0];
|
||||||
//default intention is 1-5 votes, just like rtv.
|
if (IsValidClient(client) && !StrEqual(player_mapvote[client], ""))
|
||||||
float vote_ammount = GetPlayerWorthRTV_boost_(client);
|
|
||||||
int item_index = client_info[i][VOTEINFO_CLIENT_ITEM];
|
|
||||||
static char map[PLATFORM_MAX_PATH];
|
|
||||||
for(int j = 0; j < num_items; j++)
|
|
||||||
{
|
{
|
||||||
if (item_info[j][VOTEINFO_ITEM_INDEX] == item_index)
|
//default intention is 1-5 votes, just like rtv.
|
||||||
|
float vote_ammount = GetPlayerWorthRTV_boost_(client);
|
||||||
|
int item_index = client_info[i][VOTEINFO_CLIENT_ITEM];
|
||||||
|
static char map[PLATFORM_MAX_PATH];
|
||||||
|
for(int j = 0; j < num_items; j++)
|
||||||
{
|
{
|
||||||
GetMapItem(menu, item_info[j][VOTEINFO_ITEM_INDEX], map, PLATFORM_MAX_PATH);
|
if (item_info[j][VOTEINFO_ITEM_INDEX] == item_index)
|
||||||
break;
|
{
|
||||||
|
GetMapItem(menu, item_info[j][VOTEINFO_ITEM_INDEX], map, PLATFORM_MAX_PATH);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
float value = 0.0;
|
||||||
|
sm.GetValue(map, value);
|
||||||
|
value += vote_ammount;
|
||||||
|
sm.SetValue(map, value, true);
|
||||||
}
|
}
|
||||||
float value = 0.0;
|
|
||||||
sm.GetValue(map, value);
|
|
||||||
value += vote_ammount;
|
|
||||||
sm.SetValue(map, value, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//ordering stringmap by voteweight
|
//ordering stringmap by voteweight
|
||||||
@ -1609,7 +1617,7 @@ public void Handler_MapVoteFinished(Handle menu,
|
|||||||
float total_votes = 0.0;
|
float total_votes = 0.0;
|
||||||
for (int i = 0; i < MaxClients; i++)
|
for (int i = 0; i < MaxClients; i++)
|
||||||
{
|
{
|
||||||
if (IsValidClient(i))
|
if (IsValidClient(i) && !is_bot_player[i] && PM_IsPlayerSteam(i))
|
||||||
{
|
{
|
||||||
total_votes += player_mapvote_worth[i];
|
total_votes += player_mapvote_worth[i];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user