This commit is contained in:
lifestorm
2024-08-04 23:54:45 +03:00
parent 8064ba84d8
commit 6a58f406b1
7522 changed files with 4011896 additions and 15 deletions

44
lua/sam/modules/utime.lua Normal file
View File

@@ -0,0 +1,44 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
if SAM_LOADED then return end
local PLAYER = FindMetaTable("Player")
function PLAYER:GetUTime()
return self:sam_get_nwvar("TotalUTime")
end
function PLAYER:SetUTime(time)
self:sam_set_nwvar("TotalUTime", time)
end
function PLAYER:GetUTimeStart()
return self:sam_get_nwvar("UTimeStart")
end
function PLAYER:SetUTimeStart(time)
self:sam_set_nwvar("UTimeStart", time)
end
function PLAYER:GetUTimeSessionTime()
return CurTime() - self:GetUTimeStart()
end
function PLAYER:GetUTimeTotalTime()
return self:GetUTime() + CurTime() - self:GetUTimeStart()
end
if SERVER then
hook.Add("SAM.AuthedPlayer", "SAM.UTime", function(ply)
ply:SetUTime(ply:sam_get_play_time())
ply:SetUTimeStart(CurTime())
end)
end