From a48be11d747c604dbe4832fa0d554f7f447ca242 Mon Sep 17 00:00:00 2001 From: KaylebJay <44441970+KaylebJay@users.noreply.github.com> Date: Tue, 24 Nov 2020 13:32:18 -0700 Subject: [PATCH] Give capturers 10% of the match score (Limited 50-750) (#700) * Give capturers 10% of the match.score or 50 points * limit max capturing score to 750 * fix my commit * OKAY OKAY I'll make it i * missed the most important part --- mods/ctf/ctf_stats/init.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/mods/ctf/ctf_stats/init.lua b/mods/ctf/ctf_stats/init.lua index 3a40d5a..321a0b3 100644 --- a/mods/ctf/ctf_stats/init.lua +++ b/mods/ctf/ctf_stats/init.lua @@ -226,12 +226,23 @@ ctf_stats.winner_team = "-" ctf_stats.winner_player = "-" table.insert(ctf_flag.registered_on_capture, 1, function(name, flag) + local score = 0 + for i, pstat in pairs(ctf_stats.current.red) do + score = score + pstat.score + end + for i, pstat in pairs(ctf_stats.current.blue) do + score = score + pstat.score + end + local capturereward = math.floor(score * 10) / 100 + if capturereward < 50 then capturereward = 50 end + if capturereward > 750 then capturereward = 750 end + local main, match = ctf_stats.player(name) if main and match then main.captures = main.captures + 1 - main.score = main.score + 50 + main.score = main.score + capturereward match.captures = match.captures + 1 - match.score = match.score + 50 + match.score = match.score + capturereward _needs_save = true end ctf_stats.winner_player = name @@ -239,7 +250,7 @@ table.insert(ctf_flag.registered_on_capture, 1, function(name, flag) hud_score.new(name, { name = "ctf_stats:flag_capture", color = "0xFF00FF", - value = 50 + value = capturereward }) end)