Allow -1/null for attacker and inflictor for OTD (bug 6494).

This commit is contained in:
Nick Hastings 2018-03-28 21:10:32 -04:00
parent 08fe840bfd
commit 9b8d28de56

View File

@ -1122,13 +1122,13 @@ int SDKHooks::HandleOnTakeDamageHook(CTakeDamageInfoHack &info, SDKHookType hook
if (ret == Pl_Changed) if (ret == Pl_Changed)
{ {
CBaseEntity *pEntAttacker = gamehelpers->ReferenceToEntity(attacker); CBaseEntity *pEntAttacker = gamehelpers->ReferenceToEntity(attacker);
if (!pEntAttacker) if (!pEntAttacker && attacker != -1)
{ {
callback->GetParentContext()->BlamePluginError(callback, "Callback-provided entity %d for attacker is invalid", attacker); callback->GetParentContext()->BlamePluginError(callback, "Callback-provided entity %d for attacker is invalid", attacker);
RETURN_META_VALUE(MRES_IGNORED, 0); RETURN_META_VALUE(MRES_IGNORED, 0);
} }
CBaseEntity *pEntInflictor = gamehelpers->ReferenceToEntity(inflictor); CBaseEntity *pEntInflictor = gamehelpers->ReferenceToEntity(inflictor);
if (!pEntInflictor) if (!pEntInflictor && inflictor != -1)
{ {
callback->GetParentContext()->BlamePluginError(callback, "Callback-provided entity %d for inflictor is invalid", inflictor); callback->GetParentContext()->BlamePluginError(callback, "Callback-provided entity %d for inflictor is invalid", inflictor);
RETURN_META_VALUE(MRES_IGNORED, 0); RETURN_META_VALUE(MRES_IGNORED, 0);