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
This commit is contained in:
parent
7cfb2e6921
commit
a48be11d74
1 changed files with 14 additions and 3 deletions
|
@ -226,12 +226,23 @@ ctf_stats.winner_team = "-"
|
||||||
ctf_stats.winner_player = "-"
|
ctf_stats.winner_player = "-"
|
||||||
|
|
||||||
table.insert(ctf_flag.registered_on_capture, 1, function(name, flag)
|
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)
|
local main, match = ctf_stats.player(name)
|
||||||
if main and match then
|
if main and match then
|
||||||
main.captures = main.captures + 1
|
main.captures = main.captures + 1
|
||||||
main.score = main.score + 50
|
main.score = main.score + capturereward
|
||||||
match.captures = match.captures + 1
|
match.captures = match.captures + 1
|
||||||
match.score = match.score + 50
|
match.score = match.score + capturereward
|
||||||
_needs_save = true
|
_needs_save = true
|
||||||
end
|
end
|
||||||
ctf_stats.winner_player = name
|
ctf_stats.winner_player = name
|
||||||
|
@ -239,7 +250,7 @@ table.insert(ctf_flag.registered_on_capture, 1, function(name, flag)
|
||||||
hud_score.new(name, {
|
hud_score.new(name, {
|
||||||
name = "ctf_stats:flag_capture",
|
name = "ctf_stats:flag_capture",
|
||||||
color = "0xFF00FF",
|
color = "0xFF00FF",
|
||||||
value = 50
|
value = capturereward
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue