From 731b8b6395de5fff017bb990a89dbb883902fb8e Mon Sep 17 00:00:00 2001 From: Sabian Roberts <31491602+sabianroberts@users.noreply.github.com> Date: Sat, 7 Sep 2024 11:26:52 +0100 Subject: [PATCH] Register msg --- binary/dlls/player.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/binary/dlls/player.cpp b/binary/dlls/player.cpp index 2353886a..2ed0ec2b 100644 --- a/binary/dlls/player.cpp +++ b/binary/dlls/player.cpp @@ -185,6 +185,7 @@ int gmsgShake = 0; int gmsgFade = 0; int gmsgSelAmmo = 0; int gmsgFlashlight = 0; +int gmsgStopSound = 0; int gmsgFlashBattery = 0; int gmsgResetHUD = 0; int gmsgInitHUD = 0; @@ -274,6 +275,7 @@ void LinkUserMessages( void ) gmsgHealth = REG_USER_MSG( "Health", 1 ); gmsgDamage = REG_USER_MSG( "Damage", 12 ); gmsgBattery = REG_USER_MSG( "Battery", 2); + gmsgStopSound = REG_USER_MSG("StopSound", -1); gmsgTrain = REG_USER_MSG( "Train", 1); //gmsgHudText = REG_USER_MSG( "HudTextPro", -1 ); gmsgHudText = REG_USER_MSG( "HudText", -1 ); // we don't use the message but 3rd party addons may! @@ -4676,8 +4678,15 @@ void CBasePlayer :: UpdateClientData( void ) m_fRegenOn = true; EMIT_SOUND(ENT(pev), CHAN_AUTO, "items/suitchargeok1.wav", 0.85, ATTN_NORM); STOP_SOUND(ENT(pev), CHAN_AUTO, "player/shield_empty.wav"); - MESSAGE_BEGIN(MSG_ONE, MSG_STOP_SOUND, NULL); - MESSAGE_END(); + if (pev && pev->flags & FL_CLIENT) + { + MESSAGE_BEGIN(MSG_ONE, gmsgStopSound, NULL, edict()); + MESSAGE_END(); + } + else + { + ALERT(at_console, "Invalid player entity at StopSound msg\n"); + } } else // as it's recharging {