mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
44
lua/sam/modules/utime.lua
Normal file
44
lua/sam/modules/utime.lua
Normal 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
|
||||
Reference in New Issue
Block a user