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++)
|
||||
{
|
||||
g_NominateList[i] = CreateArray(arraySize);
|
||||
if (IsValidClient(i))
|
||||
{
|
||||
OnClientPostAdminCheck(i);
|
||||
}
|
||||
}
|
||||
|
||||
GetGameFolderName(g_GameModName, sizeof(g_GameModName));
|
||||
@ -1365,7 +1369,7 @@ void InitiateVote(MapChange when, Handle inputlist=INVALID_HANDLE)
|
||||
|
||||
int clients[MAXPLAYERS + 1];
|
||||
int count = 0;
|
||||
for (int i = 0; i <= MaxClients; i++)
|
||||
for (int i = 0; i < MaxClients; i++)
|
||||
{
|
||||
player_mapvote_worth[i] = 0.0;
|
||||
Format(player_mapvote[i], 128, "");
|
||||
@ -1403,7 +1407,7 @@ public Action Timer_Countdown(Handle timer)
|
||||
char picked_map[PLATFORM_MAX_PATH];
|
||||
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]) ||
|
||||
StrEqual(player_mapvote[i], most_voted_map[2]))
|
||||
@ -1430,9 +1434,10 @@ public Action Timer_Countdown(Handle timer)
|
||||
float voted_so_far = 0.0;
|
||||
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];
|
||||
//LogMessage("client: %N player_mapvote_worth i: %f", i, player_mapvote_worth[i]);
|
||||
if (!StrEqual(player_mapvote[i], ""))
|
||||
{
|
||||
voted_so_far += player_mapvote_worth[i];
|
||||
@ -1498,7 +1503,7 @@ public void Handler_VoteFinishedGeneric(char[] map,
|
||||
if(fraglimit)
|
||||
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.");
|
||||
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)
|
||||
{
|
||||
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");
|
||||
|
||||
g_RunoffCount = 0;
|
||||
@ -1558,6 +1563,8 @@ public void Handler_MapVoteFinished(Handle menu,
|
||||
for (int i = 0; i < num_clients; i++)
|
||||
{
|
||||
int client = client_info[i][0];
|
||||
if (IsValidClient(client) && !StrEqual(player_mapvote[client], ""))
|
||||
{
|
||||
//default intention is 1-5 votes, just like rtv.
|
||||
float vote_ammount = GetPlayerWorthRTV_boost_(client);
|
||||
int item_index = client_info[i][VOTEINFO_CLIENT_ITEM];
|
||||
@ -1575,6 +1582,7 @@ public void Handler_MapVoteFinished(Handle menu,
|
||||
value += vote_ammount;
|
||||
sm.SetValue(map, value, true);
|
||||
}
|
||||
}
|
||||
|
||||
//ordering stringmap by voteweight
|
||||
float[] weighted_votes = new float[num_items];
|
||||
@ -1609,7 +1617,7 @@ public void Handler_MapVoteFinished(Handle menu,
|
||||
float total_votes = 0.0;
|
||||
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];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user