@ -20,11 +20,10 @@ local function savePoints(ply)
if PointSaving_shouldIgnoreMap ( game.GetMap ( ) ) then return end
if PointSaving_shouldIgnoreMap ( game.GetMap ( ) ) then return end
if ply : Team ( ) == TEAM_HUMAN then
if ply : Team ( ) == TEAM_HUMAN then
--print("### PS Saved: "..ply:GetPoints())
ply : SetSavedPoints ( ply : GetPoints ( ) )
ply : SetSavedPoints ( ply : GetPoints ( ) )
end
end
end
end
--hook.Add("PlayerDeath", "pointsave_death", savePoints )
hook.Add ( " PlayerDeath " , " pointsave_death " , savePoints )
hook.Add ( " PlayerDisconnected " , " pointsave_disconnect " , savePoints )
hook.Add ( " PlayerDisconnected " , " pointsave_disconnect " , savePoints )
hook.Add ( " PostEndRound " , " pointsave_postendround " , function ( winner )
hook.Add ( " PostEndRound " , " pointsave_postendround " , function ( winner )
@ -42,7 +41,6 @@ local function loadPoints(ply)
timer.Simple ( 0 , function ( )
timer.Simple ( 0 , function ( )
if IsValid ( ply ) and ply : Team ( ) == TEAM_HUMAN then
if IsValid ( ply ) and ply : Team ( ) == TEAM_HUMAN then
--print("### Loaded: "..ply:GetSavedPoints())
ply : SetPoints ( ply : GetSavedPoints ( ) )
ply : SetPoints ( ply : GetSavedPoints ( ) )
end
end
end )
end )
@ -60,6 +58,7 @@ function meta:GetSavedPoints()
if SERVER then
if SERVER then
local points = self : GetPData ( " zs_savedpoints " , settings.StartingSavedPoints )
local points = self : GetPData ( " zs_savedpoints " , settings.StartingSavedPoints )
self : SetNWInt ( " zs_savedpoints " , points )
self : SetNWInt ( " zs_savedpoints " , points )
print ( " ### PS Loaded: " .. points )
return points
return points
end
end
@ -72,6 +71,8 @@ if not SERVER then return end
function meta : SetSavedPoints ( amount )
function meta : SetSavedPoints ( amount )
if amount < settings.MinimumPoints then amount = settings.MinimumPoints end
if amount < settings.MinimumPoints then amount = settings.MinimumPoints end
amount = math.Round ( amount )
print ( " ### PS Saved: " .. amount )
self : SetNWInt ( " zs_savedpoints " , amount )
self : SetNWInt ( " zs_savedpoints " , amount )
self : SetPData ( " zs_savedpoints " , amount )
self : SetPData ( " zs_savedpoints " , amount )
end
end