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
1 changed files with 20 additions and 8 deletions

View File

@ -324,23 +324,35 @@ bool ShouldHitEntity(IHandleEntity *pHandleEntity, int contentsMask)
CBaseHandle hndl = pUnk->GetRefEHandle();
int index = hndl.GetEntryIndex();
int iTeam = 0;
if(index > SM_MAXPLAYERS && g_pPhysboxToClientMap && index < 2048)
{
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);
}
IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(index);
if(!pPlayer || !pPlayer->GetEdict())
RETURN_META_VALUE(MRES_IGNORED, true);
if(!iTeam)
{
IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(index);
if(!pPlayer || !pPlayer->GetEdict())
RETURN_META_VALUE(MRES_IGNORED, true);
IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
if(!pInfo)
RETURN_META_VALUE(MRES_IGNORED, true);
IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
if(!pInfo)
RETURN_META_VALUE(MRES_IGNORED, true);
iTeam = pInfo->GetTeamIndex();
}
int iTeam = pInfo->GetTeamIndex();
if(iTeam == g_FireBulletPlayerTeam)
RETURN_META_VALUE(MRES_SUPERCEDE, false);