Skip to content

Commit 9da6109

Browse files
committed
Add custom_chat_absence_mintime convar
1 parent c650578 commit 9da6109

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lua/autorun/sh_custom_chat.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ CreateConVar( "custom_chat_max_lines", "6", bit.bor( FCVAR_ARCHIVE, FCVAR_REPLIC
6464
CreateConVar( "custom_chat_enable_absence_messages", "1", bit.bor( FCVAR_ARCHIVE, FCVAR_REPLICATED, FCVAR_NOTIFY ),
6565
"On first spawn, show messages about when a player was last present on the server.", 0, 1 )
6666

67+
CreateConVar( "custom_chat_absence_mintime", "300", bit.bor( FCVAR_ARCHIVE, FCVAR_REPLICATED, FCVAR_NOTIFY ),
68+
"Minimum time in seconds to show absence messages. Set to 0 to disable.", 0 )
69+
6770
CreateConVar( "custom_chat_enable_friend_messages", "1", bit.bor( FCVAR_ARCHIVE, FCVAR_REPLICATED, FCVAR_NOTIFY ),
6871
"Show messages to players when their friends spawn on the server.", 0, 1 )
6972

lua/custom_chat/client/join_leave.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ hook.Add( "player_disconnect", "CustomChat.ShowDisconnectMessages", function( da
8282
end, HOOK_LOW )
8383

8484
local function OnPlayerActivated( ply, steamId, name, color, absenceLength )
85-
if ply:IsBot() and not JoinLeave.botConnectDisconnect then return end
85+
--if ply:IsBot() and not JoinLeave.botConnectDisconnect then return end
8686

8787
-- Only use a player block if Custom Chat is enabled
8888
if CustomChat.IsEnabled() then
@@ -113,6 +113,9 @@ local function OnPlayerActivated( ply, steamId, name, color, absenceLength )
113113
if absenceLength < 1 then return end
114114
if CustomChat.GetConVarInt( "enable_absence_messages", 0 ) == 0 then return end
115115

116+
local minTime = CustomChat.GetConVarInt( "absence_mintime", 0 )
117+
if minTime > 0 and absenceLength < minTime then return end
118+
116119
-- Show the last time the server saw this player
117120
local lastSeenTime = CustomChat.NiceTime( math.Round( absenceLength ) )
118121

0 commit comments

Comments
 (0)