diff --git a/lua/autorun/server/pointsaving.lua b/lua/autorun/server/pointsaving.lua index 06d9daa..e854361 100644 --- a/lua/autorun/server/pointsaving.lua +++ b/lua/autorun/server/pointsaving.lua @@ -20,11 +20,10 @@ local function savePoints(ply) if PointSaving_shouldIgnoreMap(game.GetMap()) then return end if ply:Team() == TEAM_HUMAN then - --print("### PS Saved: "..ply:GetPoints()) 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) @@ -42,7 +41,6 @@ local function loadPoints(ply) timer.Simple(0, function() if IsValid(ply) and ply:Team() == TEAM_HUMAN then - --print("### Loaded: "..ply:GetSavedPoints()) ply:SetPoints(ply:GetSavedPoints()) end end) @@ -60,6 +58,7 @@ function meta:GetSavedPoints() if SERVER then local points = self:GetPData("zs_savedpoints", settings.StartingSavedPoints) self:SetNWInt("zs_savedpoints", points) + print("### PS Loaded: "..points) return points end @@ -72,6 +71,8 @@ if not SERVER then return end function meta:SetSavedPoints(amount) if amount < settings.MinimumPoints then amount = settings.MinimumPoints end + amount = math.Round(amount) + print("### PS Saved: "..amount) self:SetNWInt("zs_savedpoints", amount) self:SetPData("zs_savedpoints", amount) end diff --git a/lua/autorun/server/pointsaving_mapstats.lua b/lua/autorun/server/pointsaving_mapstats.lua index 65d5b62..323995c 100644 --- a/lua/autorun/server/pointsaving_mapstats.lua +++ b/lua/autorun/server/pointsaving_mapstats.lua @@ -63,17 +63,7 @@ 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) - --- TODO: When round is lost, take away points from recently disconnected human team players +-- TODO: When round is lost, take away points from human players that were there at the beginning of the game (All Human players that were there at the end of round 1, when late joiners join as zombies) hook.Add("PostEndRound", "pointsave_givedapoints", function(winner) timer.Destroy("pointsave_zombieintervalcounter") @@ -144,7 +134,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) + pointsToGivePly = math.Round(pointsToGive * settings.ZombiePointsFactor) - points * settings.LosePointReduction end -- Limit pointsToGivePly if points + pointsToGivePly < 0 then pointsToGivePly = -points end