use winner state & possible bug fix

This commit is contained in:
David Vogel 2018-08-27 00:16:47 +02:00
parent cfc4ba44f7
commit f06144e6d3

View File

@ -152,7 +152,7 @@ hook.Add("PostEndRound", "pointsave_givedapoints", function(winner)
--print("GAINED: "..gainedPoints) --print("GAINED: "..gainedPoints)
if gainedPoints < 0 or not ply.PointSaving_StartPoints then gainedPoints = 0 end 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) -- 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()) points = math.Round(ply:GetPoints())
pointsToGivePly = math.Round(pointsToGive + jackpot) pointsToGivePly = math.Round(pointsToGive + jackpot)
else else
@ -163,6 +163,7 @@ hook.Add("PostEndRound", "pointsave_givedapoints", function(winner)
-- Set points -- Set points
ply:SetPoints(points + pointsToGivePly) ply:SetPoints(points + pointsToGivePly)
ply:SetSavedPoints(points + pointsToGivePly) ply:SetSavedPoints(points + pointsToGivePly)
ply.PointSaving_StartPoints = nil
-- Display message -- Display message
if pointsToGivePly > 0 then if pointsToGivePly > 0 then
ply:PrintMessage(HUD_PRINTTALK, "In the end, you gained additional "..(pointsToGivePly).." points!") ply:PrintMessage(HUD_PRINTTALK, "In the end, you gained additional "..(pointsToGivePly).." points!")