From 7dfb3e4c2ebe553c9616518999e6eef9454604e5 Mon Sep 17 00:00:00 2001 From: Vauff Date: Wed, 13 Nov 2024 01:54:56 -0500 Subject: [PATCH] Change remaining SendNetMessage usages to PostEventAbstract INetChannel is a very unstable interface, frequently breaking in CS2 updates. Since IGameEventSystem::PostEventAbstract can do the same thing and is generally more stable, switching over is a no brainer. --- src/playermanager.cpp | 6 +++++- src/zombiereborn.cpp | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/playermanager.cpp b/src/playermanager.cpp index 79c21944..cc188caa 100644 --- a/src/playermanager.cpp +++ b/src/playermanager.cpp @@ -34,6 +34,7 @@ #include "leader.h" #include "tier0/vprof.h" #include "networksystem/inetworkmessages.h" +#include "engine/igameeventsystem.h" #include "tier0/memdbgon.h" @@ -41,6 +42,7 @@ extern IVEngineServer2 *g_pEngineServer2; extern CGameEntitySystem *g_pEntitySystem; extern CGlobalVars *gpGlobals; +extern IGameEventSystem* g_gameEventSystem; static int g_iAdminImmunityTargetting = 0; static bool g_bEnableMapSteamIds = false; @@ -531,7 +533,9 @@ void ZEPlayer::ReplicateConVar(const char* pszName, const char* pszValue) cvarMsg->set_name(pszName); cvarMsg->set_value(pszValue); - GetClientBySlot(GetPlayerSlot())->GetNetChannel()->SendNetMessage(data, BUF_RELIABLE); + CSingleRecipientFilter filter(GetPlayerSlot()); + g_gameEventSystem->PostEventAbstract(-1, false, &filter, pNetMsg, data, 0); + delete data; } diff --git a/src/zombiereborn.cpp b/src/zombiereborn.cpp index ad79e6cc..d22300c9 100644 --- a/src/zombiereborn.cpp +++ b/src/zombiereborn.cpp @@ -1113,7 +1113,8 @@ void ZR_InfectShake(CCSPlayerController *pController) data->set_amplitude(g_flInfectShakeAmplitude); data->set_command(0); - pController->GetServerSideClient()->GetNetChannel()->SendNetMessage(data, BUF_RELIABLE); + CSingleRecipientFilter filter(pController->GetPlayerSlot()); + g_gameEventSystem->PostEventAbstract(-1, false, &filter, pNetMsg, data, 0); delete data; }