From 47085dcacf8473f68763c4253d2ee9018774c570 Mon Sep 17 00:00:00 2001 From: jenz Date: Sat, 30 Sep 2023 10:05:40 +0200 Subject: [PATCH] set cap to 100% --- .../scripting/rockthevote_extended_avg.sp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/mapchooser_extended/scripting/rockthevote_extended_avg.sp b/mapchooser_extended/scripting/rockthevote_extended_avg.sp index 0588a512..6fa9cbf4 100755 --- a/mapchooser_extended/scripting/rockthevote_extended_avg.sp +++ b/mapchooser_extended/scripting/rockthevote_extended_avg.sp @@ -297,8 +297,12 @@ void AttemptRTV(int client) { rtv_percentage_reached = 100; } - ReplyToCommand(client, "[RTVE] %t", "Already Voted", rtv_percentage_reached, rtv_worth, - RoundToFloor((GetPlayerWorthRTV_(client) / float(g_VotesNeeded)) * 100)); + int clients_percentage = RoundToFloor((GetPlayerWorthRTV_(client) / float(g_VotesNeeded)) * 100); + if (clients_percentage > 100) + { + clients_percentage = 100; + } + ReplyToCommand(client, "[RTVE] %t", "Already Voted", rtv_percentage_reached, rtv_worth, clients_percentage); return; } @@ -324,8 +328,12 @@ void AttemptRTV(int client) { rtv_percentage_reached = 100; } - PrintToChatAll("[RTVE] %t", "RTV Requested", name, rtv_percentage_reached, rtv_worth, - RoundToFloor((GetPlayerWorthRTV_(client) / float(g_VotesNeeded)) * 100)); + int clients_percentage = RoundToFloor((GetPlayerWorthRTV_(client) / float(g_VotesNeeded)) * 100); + if (clients_percentage > 100) + { + clients_percentage = 100; + } + PrintToChatAll("[RTVE] %t", "RTV Requested", name, rtv_percentage_reached, rtv_worth, clients_percentage); if (Votes >= g_VotesNeeded) {