View Single Post
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 06-28-2021 , 00:03   Re: Get 'Owner' of other third entity
Reply With Quote #3

I think as long as the entity deal damage via ExecuteHamB TakeDamge with correct attacker and victim input, it should work.

The attacker from those entity should be get from pev_owner

PHP Code:
public ShootEntity(id)
{
    new 
ent;
    
//Do usual create entity stuff ()
    //...
    
set_pev(entpev_ownerid)
    
//...
}

public 
ShootEntityTouch(entid_touched)
{
    
//Do the usual check stuff like valid, alive,...
    
static iOwneriOwner pev(entpev_owner)
    static 
iVictimiVitcim FM_NULLENT;
    static 
FloatfOrigin[3]; pev(entpev_originfOrigin);

    
//In loop-for or loop-while to check AoE damage
    
while((iVictim engfunc(EngFunc_FindEntityInSphereiVictimfOriginEXP_RADIUS)) > 0)
    {
        if(
is_user_alive(iVictim) && zp_get_user_zombie(iVictim))
        {
            
ExecuteHamB(Ham_TakeDamageiVictimentiOwnerDAMAGEDMG_GENERIC); //ent or iOwner is fine.
        
}
    }
    
//finish up

Some plugin used ent as attacker so that would lead to not passing though "player takedamage" forward
ExecuteHam also won't pass though takedamage forward, must be ExecuteHamB
__________________
My plugin:

Last edited by Celena Luna; 06-28-2021 at 00:12. Reason: more specific
Celena Luna is offline