From bdb8b4e845e9626a3d40e45b887a42956ed25bca Mon Sep 17 00:00:00 2001 From: hubdom <26039831+hubdom@users.noreply.github.com> Date: Mon, 3 Aug 2020 13:40:17 +0200 Subject: [PATCH] make ragdolls/ghosts ignore bullets/stabs --- extension.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/extension.cpp b/extension.cpp index 564aa07..2262c4e 100644 --- a/extension.cpp +++ b/extension.cpp @@ -321,6 +321,7 @@ bool ShouldHitEntity(IHandleEntity *pHandleEntity, int contentsMask) RETURN_META_VALUE(MRES_IGNORED, true); } + char lifeState = 0; if(!iTeam) { IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(index); @@ -332,9 +333,21 @@ bool ShouldHitEntity(IHandleEntity *pHandleEntity, int contentsMask) RETURN_META_VALUE(MRES_IGNORED, true); iTeam = pInfo->GetTeamIndex(); + + static int offset = 0; + if(!offset) + { + sm_sendprop_info_t spi; + if (!gamehelpers->FindSendPropInfo("CBasePlayer", "m_lifeState", &spi)) + RETURN_META_VALUE(MRES_IGNORED, true); + + offset = spi.actual_offset; + } + + lifeState = *(char *)((uint8_t *)pHandleEntity + offset); } - if(iTeam == g_FireBulletPlayerTeam) + if(iTeam == g_FireBulletPlayerTeam || lifeState != 0) RETURN_META_VALUE(MRES_SUPERCEDE, false); RETURN_META_VALUE(MRES_IGNORED, true);