diff --git a/lua/autorun/server/pointsaving.lua b/lua/autorun/server/pointsaving.lua index ea37882..06d9daa 100644 --- a/lua/autorun/server/pointsaving.lua +++ b/lua/autorun/server/pointsaving.lua @@ -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) diff --git a/lua/autorun/server/pointsaving_mapstats.lua b/lua/autorun/server/pointsaving_mapstats.lua index fd6de63..7d38193 100644 --- a/lua/autorun/server/pointsaving_mapstats.lua +++ b/lua/autorun/server/pointsaving_mapstats.lua @@ -63,6 +63,16 @@ local function postStatistics(mapParams, timesPlayed, freqMult, zombiePercentCal PrintMessage(HUD_PRINTTALK,"Map jackpot is now "..(mapParams.Jackpot)..".") 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,"You lost "..(settings.LosePointReduction * 100).."% of your saved points because you died!") + 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