From 4feb5d172e5397f72e0a33d55887f929ff848684 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 8 Aug 2016 13:42:03 +1000 Subject: [PATCH] Alternative fix: don't modify the player state if it's not owned by the client --- qcsrc/common/state.qc | 4 ++-- qcsrc/server/cl_client.qc | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/qcsrc/common/state.qc b/qcsrc/common/state.qc index eaa96892f..891461c6a 100644 --- a/qcsrc/common/state.qc +++ b/qcsrc/common/state.qc @@ -16,12 +16,12 @@ void PlayerState_detach(entity this) if (!ps) return; // initial connect PS(this) = NULL; + if (ps.m_client != this) return; // don't own state, spectator ps.m_switchweapon = WEP_Null; ps.m_weapon = WEP_Null; ps.m_switchingweapon = WEP_Null; ps.ps_push(ps, this); - - if (ps.m_client != this) return; // don't own state, spectator + FOREACH_CLIENT(PS(it) == ps, { PS(it) = NULL; }); delete(ps); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index a37227d03..c212691db 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -218,8 +218,7 @@ void FixPlayermodel(entity player); void PutObserverInServer(entity this) { bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver, this); - if(IS_PLAYER(this)) // our own state - PlayerState_detach(this); + PlayerState_detach(this); if (IS_PLAYER(this) && this.health >= 1) { // despawn effect -- 2.39.2