Fix support for SDKCall returning non-networked entity (#1797)

(cherry picked from commit 625c7a98f2)
This commit is contained in:
42 2022-07-08 15:33:43 +01:00 committed by Your Name
parent cb218a4911
commit cf39d4b820

View File

@ -509,16 +509,7 @@ static cell_t SDKCall(IPluginContext *pContext, const cell_t *params)
|| vc->retinfo->vtype == Valve_CBasePlayer) || vc->retinfo->vtype == Valve_CBasePlayer)
{ {
CBaseEntity *pEntity = *(CBaseEntity **)(vc->retbuf); CBaseEntity *pEntity = *(CBaseEntity **)(vc->retbuf);
if (!pEntity) return gamehelpers->EntityToBCompatRef(pEntity);
{
return -1;
}
edict_t *pEdict = gameents->BaseEntityToEdict(pEntity);
if (!pEdict || pEdict->IsFree())
{
return -1;
}
return IndexOfEdict(pEdict);
} else if (vc->retinfo->vtype == Valve_Edict) { } else if (vc->retinfo->vtype == Valve_Edict) {
edict_t *pEdict = *(edict_t **)(vc->retbuf); edict_t *pEdict = *(edict_t **)(vc->retbuf);
if (!pEdict || pEdict->IsFree()) if (!pEdict || pEdict->IsFree())