Raised This Month: $ Target: $400
 0% 

Solved Get 'Owner' of other third entity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
sursista
Senior Member
Join Date: Jul 2010
Location: Spain
Old 06-27-2021 , 17:19   Get 'Owner' of other third entity
Reply With Quote #1

Hi, I haven't touched anything Pawn in many years and I'm a little green.

I want to get the owner of a third entity such as a bazooka.

The plugin works like this:

1-You buy the Item, you receive a flag.
2-If the victim receives 500HP of damage from a Player (the player receives another flag).
3-If the victim dies, all the attackers that inflicted a damage of 500HP, will also die.

So far everything works fine, the problem comes when we handle third entities, such as the famous plugins of:

1-ZP Bazooka.
2-ZP Taun Cannon.
3-ZP Plasma Rifle.
4-Other entities that cause harm to the victim "Player".

I have tried everything and searched but without success, I do not handle the issue of entities well.

PHP Code:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if (
flag_get(g_IsSweetRevengevictim) && !zp_core_is_zombie(attacker))
    {
        if (
victim == attacker || !is_user_alive(attacker))
            return 
HAM_IGNORED;
    
        if(
is_user_alive(victim) && !zp_core_is_zombie(attacker) || is_user_alive(victim) && !zp_core_is_zombie(inflictor))
        {        
            
g_fDamage[attacker] += damage;
                
            
set_hudmessage(25525500.030.8806.04.00.10.24)
            
ShowSyncHudMsg(attackerg_hudmsg1"Zombie Hurt Limit:  %.2fHP/%iHP."g_fDamage[attacker], 500// Example damage
                
            
if (g_fDamage[attacker] >= 500// Example damage
            
{
                
flag_set(g_IsAttackerattacker)
                
                if (
flag_get(g_IsAttackerattacker))
                    
set_user_rendering(attackerkRenderFxGlowShell2552550kRenderNormal 15)
    
            }
        }
    }
    return 
HAM_IGNORED;
}

public 
fw_PlayerKilled(victimattackershouldgib)
{
    if (
flag_get(g_IsSweetRevengevictim))
    {    
        if (
is_user_alive(victim) || !zp_core_is_zombie(victim))
            return;
        
        static 
victim_name[33
        
        
get_user_name(victimvictim_namesizeof victim_name -1
        
        
ChatColor(0"!gZombie %s !tbought '!gSweet Revenge!t' and everyone who !gHurt Zombie!t: !g500HP !talso !gDied!t!"victim_name
        
        for( new 
id 1id <= 32id++ )
        {
            if (
flag_get(g_IsAttackerid))
            {    
                
set_user_rendering(id)
                
                
user_kill(id);
                
                
g_fDamage[id] = 0.0;
            }
        }
        
flag_unset(g_IsSweetRevengevictim)
    }


Last edited by sursista; 06-30-2021 at 15:46. Reason: edit description (bad english)
sursista is offline
Send a message via MSN to sursista Send a message via Skype™ to sursista
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode