Fix late-joiners loss of points at round end
This commit is contained in:
parent
34d35ea711
commit
cfc4ba44f7
@ -69,7 +69,7 @@ function meta:GetSavedPoints()
|
||||
if SERVER then
|
||||
local points = self:GetPData("zs_savedpoints", settings.StartingSavedPoints)
|
||||
self:SetNWInt("zs_savedpoints", points)
|
||||
--print("### PS Loaded: "..points)
|
||||
--print("### PS Loaded:", points, "for", tostring(self))
|
||||
return points
|
||||
end
|
||||
|
||||
@ -83,7 +83,7 @@ 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)
|
||||
--print("### PS Saved: ", amount, "for", tostring(self))
|
||||
self:SetNWInt("zs_savedpoints", amount)
|
||||
self:SetPData("zs_savedpoints", amount)
|
||||
end
|
||||
|
@ -80,7 +80,7 @@ hook.Add("PostEndRound", "pointsave_givedapoints", function(winner)
|
||||
if PointSaving_shouldIgnoreMap(game.GetMap()) then return end
|
||||
|
||||
timer.Simple(0, function()
|
||||
print("point bonus hook")
|
||||
--print("point bonus hook")
|
||||
local zombiePercentCalcMap = 1
|
||||
if totalIntervalCounter > 0 then
|
||||
zombiePercentCalcMap = (zombieIntervalCounter / totalIntervalCounter)
|
||||
@ -149,8 +149,8 @@ hook.Add("PostEndRound", "pointsave_givedapoints", function(winner)
|
||||
local pointsToGivePly
|
||||
local points = math.Round(ply:GetSavedPoints())
|
||||
local gainedPoints = points - (ply.PointSaving_StartPoints or 0)
|
||||
print("GAINED: "..gainedPoints)
|
||||
if gainedPoints < 0 then gainedPoints = 0 end
|
||||
--print("GAINED: "..gainedPoints)
|
||||
if gainedPoints < 0 or not ply.PointSaving_StartPoints then gainedPoints = 0 end
|
||||
-- Calculate points to give for each player (Depending on if the round was lost or won)
|
||||
if ply:Team() == TEAM_HUMAN then
|
||||
points = math.Round(ply:GetPoints())
|
||||
|
Loading…
Reference in New Issue
Block a user