From 5f4b436ec6a5a967a3bac70ca33945fa6a53ab26 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 16 Apr 2023 11:59:56 +0200 Subject: [PATCH] Only attempt to send RCON log if its not from the client --- r5dev/tier0/dbg.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/r5dev/tier0/dbg.cpp b/r5dev/tier0/dbg.cpp index f5d9e500..c18e4ff4 100644 --- a/r5dev/tier0/dbg.cpp +++ b/r5dev/tier0/dbg.cpp @@ -212,6 +212,17 @@ const char* GetContextNameByIndex(eDLL_T context, const bool ansiColor = false) return contextName; } +bool LoggedFromClient(eDLL_T context) +{ +#ifndef DEDICATED + return (context == eDLL_T::CLIENT || context == eDLL_T::SCRIPT_CLIENT + || context == eDLL_T::UI || context == eDLL_T::SCRIPT_UI + || context == eDLL_T::NETCON); +#else + return false; + #endif // !DEDICATED +} + //----------------------------------------------------------------------------- // Purpose: Show logs to all console interfaces (va_list version) // Input : logType - @@ -364,8 +375,11 @@ void CoreMsgV(LogType_t logType, LogLevel_t logLevel, eDLL_T context, if (bToConsole) { #ifndef CLIENT_DLL - RCONServer()->Send(formatted, pszUpTime, sv_rcon::response_t::SERVERDATA_RESPONSE_CONSOLE_LOG, - static_cast(context), static_cast(logType)); + if (!LoggedFromClient(context)) + { + RCONServer()->Send(formatted, pszUpTime, sv_rcon::response_t::SERVERDATA_RESPONSE_CONSOLE_LOG, + static_cast(context), static_cast(logType)); + } #endif // !CLIENT_DLL #ifndef DEDICATED g_ImGuiLogger->debug(message);