Raised This Month: $ Target: $400
 0% 

Solved Get 'Owner' of other third entity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
sursista
Senior Member
Join Date: Jul 2010
Location: Spain
Old 06-28-2021 , 11:11   Re: Get 'Owner' of other third entity
Reply With Quote #7

Quote:
Originally Posted by sursista View Post
It seems silly but it makes sense, now I understand it, thank you very much for everything, now work!
I have removed the [SOLVED] prefix because I have found one last error and that is:

-If the victim is damaged with damage greater than her life, the bug reoccurs, even if other attackers damage the victim and obtain a flag. If the first / third attacker kills the victim with a single hit (only one), the bug occurs, and does not call the other functions.

My Code (Sweet Revenge)

PHP Code:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    
//if (flag_get(g_IsSweetRevenge, victim) && !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))
        {    
            
g_fDamageToSweetRevenge[attacker] += damage;
                
            
set_hudmessage(25525500.030.8806.04.00.10.24)
            
ShowSyncHudMsg(attackerg_hudmsg1"[ESSA] Zombie Hurt Limit:  %.2fHP/%iHP."g_fDamageToSweetRevenge[attacker], get_pcvar_num(g_sr_damage_hp))
                
            if (
g_fDamageToSweetRevenge[attacker] >= get_pcvar_float(g_sr_damage_hp))
            {
                
flag_set(g_IsAttackerattacker)
                
                if (
flag_get(g_IsAttackerattacker))
                {
                    if (
get_pcvar_num(g_sr_glow_victim) > 0)
                        
set_user_rendering(attackerkRenderFxGlowShellget_pcvar_num(g_sr_glow_victim_R), get_pcvar_num(g_sr_glow_victim_G), get_pcvar_num(g_sr_glow_victim_B), kRenderNormal 15)
                    else
                        
set_user_rendering(attacker)
                }
            }
        }    
    
//}
        
return HAM_IGNORED;
}

public 
fw_Killed(victimattackershouldgib)
{
    
//if (flag_get(g_IsSweetRevenge, victim))
    //{
        
if (get_pcvar_num(g_sr_aura))
            
remove_task(victim+TASK_AURA)
            
        if (
is_user_alive(victim) || !zp_core_is_zombie(victim))
            return;
            
        
flag_set(g_IsAttackerattacker)
        
        for( new 
id 1id <= 32id++ )
        {    
            if (
flag_get(g_IsAttackerid))
            {    
                
sr_damage(victimid"sweetrevenge");
                
                
set_user_rendering(id)
                
                
g_fDamageToSweetRevenge[id] = 0.0;
            }
        }
        
        static 
victim_name[33
    
        
get_user_name(victimvictim_namesizeof victim_name -1
        
        
set_hudmessage(015000.350.5006.04.00.10.24)
        
ShowSyncHudMsg(0g_hudmsg2"[ESSA] Zombie %s bought 'Sweet Revenge' and everyone who Hurt Zombie: %iHP also Died!"victim_nameget_pcvar_num(g_sr_damage_hp)) 
        
        
ChatColor(0"!g[ESSA] Zombie %s !tbought '!gSweet Revenge!t' and everyone who !gHurt Zombie!t: !g%iHP !talso !gDied!t!"victim_nameget_pcvar_num(g_sr_damage_hp)) 
    
        if(
get_pcvar_num(g_sr_done_sound))
        {
            new 
sound[SOUND_MAX_LENGTH]
    
            
ArrayGetString(g_sound_sweetrevenge_donerandom_num(0ArraySize(g_sound_sweetrevenge_done) - 1), soundcharsmax(sound))
            
emit_sound(0CHAN_VOICEsound1.0ATTN_NORM0PITCH_NORM)
        }
    
//}

Code Bazooka (Example)

PHP Code:
baz_damage(idattackerdamageweaponDescription[])
{
    if ( 
zp_core_is_zombie(attacker) || !is_user_alive(attacker) || zp_class_nemesis_get(attacker) ) 
    {
        
ChatColor(attacker"!g[ESSA] !tThe '!gbug bazooka!t' is !gFixed!")
        return;
    }

    if ( 
pev(idpev_takedamage) == DAMAGE_NO 
        return;
    if ( 
damage <= 
        return;

    new 
userHealth get_user_health(id);

    if (
userHealth damage <= 
    {
    
dmgcount[attacker] += userHealth damage;
    
set_msg_block(gmsg_deathBLOCK_SET);
    
ExecuteHamB(Ham_Killedidattacker2); 
    
set_msg_block(gmsg_deathBLOCK_NOT);

    
message_begin(MSG_BROADCASTgmsg_death);
    
write_byte(attacker);
    
write_byte(id);
    
write_byte(0);
    
write_string(weaponDescription);
    
message_end();

    
//set_pev(attacker, pev_frags, float(get_user_frags(attacker) + 1));

    
new kname[32], vname[32], kauthid[32], vauthid[32], kteam[10], vteam[10];

    
get_user_name(attackerkname31);
    
get_user_team(attackerkteam9);
    
get_user_authid(attackerkauthid31);

    
get_user_name(idvname31);
    
get_user_team(idvteam9);
    
get_user_authid(idvauthid31);

    
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^""
    
knameget_user_userid(attacker), kauthidkteam
    
vnameget_user_userid(id), vauthidvteamweaponDescription);
    }
    else 
    {
    
dmgcount[attacker] += damage;
    new 
origin[3];
    
get_user_origin(idorigin);

    
message_begin(MSG_ONE,gmsg_damage,{0,0,0},id);
    
write_byte(21);
    
write_byte(20);
    
write_long(DMG_BLAST);
    
write_coord(origin[0]);
    
write_coord(origin[1]);
    
write_coord(origin[2]);
    
message_end();

    
ExecuteHamB(Ham_TakeDamageid2attackerfloat(damage), DMG_GENERIC); 
    
//set_pev(id, pev_health, pev(id, pev_health) - float(damage));
    
}

I insist, if the attacker damages the victim and the first hit is not definitive, everything works fine, but if the attacker or other attackers kill the victim with a single hit of damage, the bug happens.
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