Attemps to fix a crash

master
upsilon 2017-05-24 18:49:10 +02:00
parent 818a4b77c4
commit 028274d1d1
No known key found for this signature in database
GPG Key ID: A80DAE1F266E1C3C
2 changed files with 9 additions and 7 deletions

View File

@ -60,6 +60,9 @@ function pvpplus.get_score(name)
if not pvpplus.is_running_tournament() then
return false, "There is no running tournament."
end
if not pvpplus.is_playing_tournament(name) then
return false, "Player " .. name .. "is not currently playing a tournament."
end
return tournament.sent_damages[name] - tournament.received_damages[name] + tournament.kills[name] * 20
end

View File

@ -11,14 +11,13 @@ function pvpplus.tournament_hud_update_list()
tournament.hud_list = {}
for name, _ in pairs(tournament.sent_damages) do
if not pvpplus.get_score(name) then
return pvpplus.get_score(name)
if pvpplus.get_score(name) then
table.insert(tournament.hud_list, {
name = name,
score = pvpplus.get_score(name),
status = pvpplus.is_playing_tournament(name)
})
end
table.insert(tournament.hud_list, {
name = name,
score = pvpplus.get_score(name),
status = pvpplus.is_playing_tournament(name)
})
end
table.sort(tournament.hud_list, function(a, b) return a.score > b.score end)