Take points away on death, not round end

master
David Vogel 6 years ago
parent e90128431b
commit b279d2e639

@ -24,7 +24,7 @@ local function savePoints(ply)
ply:SetSavedPoints(ply:GetPoints())
end
end
hook.Add("PlayerDeath", "pointsave_death", savePoints)
--hook.Add("PlayerDeath", "pointsave_death", savePoints)
hook.Add("PlayerDisconnected", "pointsave_disconnect", savePoints)
hook.Add("PostEndRound", "pointsave_postendround", function(winner)

@ -63,6 +63,16 @@ local function postStatistics(mapParams, timesPlayed, freqMult, zombiePercentCal
PrintMessage(HUD_PRINTTALK,"<c=204,204,0>Map jackpot is now "..(mapParams.Jackpot)..".</c>")
end
hook.Add("PlayerDeath", "pointsave_death", function(ply)
if PointSaving_shouldIgnoreMap(game.GetMap()) then return end
if ply:Team() == TEAM_HUMAN then
--print("### PS Saved: "..ply:GetPoints())
ply:SetSavedPoints(ply:GetPoints() * settings.LosePointReduction)
ply:PrintMessage(HUD_PRINTTALK,"<c=255,0,0>You lost "..(settings.LosePointReduction * 100).."% of your saved points because you died!</c>")
end
end)
hook.Add("PostEndRound", "pointsave_givedapoints", function(winner)
timer.Destroy("pointsave_zombieintervalcounter")
@ -132,7 +142,7 @@ hook.Add("PostEndRound", "pointsave_givedapoints", function(winner)
if ply:Team() == TEAM_HUMAN then
pointsToGivePly = math.Round(pointsToGive)
else
pointsToGivePly = math.Round(pointsToGive * settings.ZombiePointsFactor) - points * settings.LosePointReduction -- TODO: Reduce points on death, not round end to avoid cheating
pointsToGivePly = math.Round(pointsToGive * settings.ZombiePointsFactor)
end
-- Limit pointsToGivePly
if points + pointsToGivePly < 0 then pointsToGivePly = -points end

Loading…
Cancel
Save