Skip to content

Commit 1b58096

Browse files
committed
Save "last seen" player data on shutdown
1 parent a4bde7b commit 1b58096

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lua/custom_chat/server/player_spawn.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,15 @@ hook.Add( "PlayerInitialSpawn", "CustomChat.BroadcastInitialSpawn", function( pl
2626
net.Broadcast()
2727
end )
2828
end, HOOK_LOW )
29+
30+
hook.Add( "ShutDown", "CustomChat.SaveLastSeen", function()
31+
local time = os.time()
32+
33+
for _, ply in ipairs( player.GetHumans() ) do
34+
local steamId = ply:SteamID()
35+
36+
if steamId then -- Could be nil on the listen server host
37+
CustomChat:SetLastSeen( steamId, time )
38+
end
39+
end
40+
end )

0 commit comments

Comments
 (0)