From f06144e6d38e361e3e44f2d167f899c58976e0f9 Mon Sep 17 00:00:00 2001 From: David Vogel Date: Mon, 27 Aug 2018 00:16:47 +0200 Subject: [PATCH] use winner state & possible bug fix --- lua/autorun/server/pointsaving_mapstats.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/autorun/server/pointsaving_mapstats.lua b/lua/autorun/server/pointsaving_mapstats.lua index 2eb1441..23363a2 100644 --- a/lua/autorun/server/pointsaving_mapstats.lua +++ b/lua/autorun/server/pointsaving_mapstats.lua @@ -152,7 +152,7 @@ hook.Add("PostEndRound", "pointsave_givedapoints", function(winner) --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 + if ply:Team() == TEAM_HUMAN and winner == TEAM_HUMAN then points = math.Round(ply:GetPoints()) pointsToGivePly = math.Round(pointsToGive + jackpot) else @@ -163,6 +163,7 @@ hook.Add("PostEndRound", "pointsave_givedapoints", function(winner) -- Set points ply:SetPoints(points + pointsToGivePly) ply:SetSavedPoints(points + pointsToGivePly) + ply.PointSaving_StartPoints = nil -- Display message if pointsToGivePly > 0 then ply:PrintMessage(HUD_PRINTTALK, "In the end, you gained additional "..(pointsToGivePly).." points!")