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)