diff --git a/mapchooser_extended/scripting/mapchooser_extended_avg.sp b/mapchooser_extended/scripting/mapchooser_extended_avg.sp index 53d60406..a614f1c0 100755 --- a/mapchooser_extended/scripting/mapchooser_extended_avg.sp +++ b/mapchooser_extended/scripting/mapchooser_extended_avg.sp @@ -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,22 +1563,25 @@ public void Handler_MapVoteFinished(Handle menu, for (int i = 0; i < num_clients; i++) { int client = client_info[i][0]; - //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++) + if (IsValidClient(client) && !StrEqual(player_mapvote[client], "")) { - 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); - break; + if (item_info[j][VOTEINFO_ITEM_INDEX] == item_index) + { + 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 @@ -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]; }