Add team as negative index (-2, -3) to PhysboxToClientMap

This commit is contained in:
BotoX 2019-10-17 11:53:08 +02:00
parent 6d9fa7443c
commit 0d641695df

View File

@ -324,14 +324,24 @@ bool ShouldHitEntity(IHandleEntity *pHandleEntity, int contentsMask)
CBaseHandle hndl = pUnk->GetRefEHandle(); CBaseHandle hndl = pUnk->GetRefEHandle();
int index = hndl.GetEntryIndex(); int index = hndl.GetEntryIndex();
int iTeam = 0;
if(index > SM_MAXPLAYERS && g_pPhysboxToClientMap && index < 2048) if(index > SM_MAXPLAYERS && g_pPhysboxToClientMap && index < 2048)
{ {
index = g_pPhysboxToClientMap[index]; index = g_pPhysboxToClientMap[index];
} }
if(index < 1 || index > SM_MAXPLAYERS) if(index >= -3 && index <= -1)
{
iTeam = -index;
}
else if(index < 1 || index > SM_MAXPLAYERS)
{
RETURN_META_VALUE(MRES_IGNORED, true); RETURN_META_VALUE(MRES_IGNORED, true);
}
if(!iTeam)
{
IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(index); IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(index);
if(!pPlayer || !pPlayer->GetEdict()) if(!pPlayer || !pPlayer->GetEdict())
RETURN_META_VALUE(MRES_IGNORED, true); RETURN_META_VALUE(MRES_IGNORED, true);
@ -340,7 +350,9 @@ bool ShouldHitEntity(IHandleEntity *pHandleEntity, int contentsMask)
if(!pInfo) if(!pInfo)
RETURN_META_VALUE(MRES_IGNORED, true); RETURN_META_VALUE(MRES_IGNORED, true);
int iTeam = pInfo->GetTeamIndex(); iTeam = pInfo->GetTeamIndex();
}
if(iTeam == g_FireBulletPlayerTeam) if(iTeam == g_FireBulletPlayerTeam)
RETURN_META_VALUE(MRES_SUPERCEDE, false); RETURN_META_VALUE(MRES_SUPERCEDE, false);