Raised This Month: $27 Target: $400
 6% 

Solved [TF2] How to catch Granade in TraceAttack?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AzulFlamaWallon
Junior Member
Join Date: Jan 2017
Location: Korea
Old 03-20-2020 , 12:22   [TF2] How to catch Granade in TraceAttack?
Reply With Quote #1

Hello!
I'm working on the boss' reflexes.
However, the explosion damage does not reflect, and the rest reflect well.

Originally, "Player_Hurt" was used, but when the summoner and boss hit at the same time,
the server crashes.
Changed to "TrackAttack" and remade.

using the code below, and for some reason the explosion damage is not reflecting. How can I reflect the explosion damage?

PHP Code:
public Action Spell_CounterAttack(int _Victimint_Attackerint_Inflictorfloat_Damageint_Damagetypeint_Ammotypeint _Hitboxint _Hitgroup)
{
    if (
IsValidUser(_Attackertrue))
    {
        if (
IsValidUser(_Victimtrue))
        {
            if (
TF2_GetClientTeam(_Victim) == TFTeam_Blue && TF2_GetClientTeam(_Attacker) == TFTeam_Red && _Attacker != _Victim// _Attacker have "curse" and _Attacker is not _Victim
            
{
                
int health GetClientHealth(_Attacker); // Get _Attacker health
                //int dmg = RoundFloat(_Damage); // How much _Damage _Attacker did
                
                
if (health 0// Health left and more health than _Damage
                
{
                    
SDKHooks_TakeDamage(_Attacker_Victim_Victim_Damage_Damagetype);
                    
//SetEntityHealth(_Attacker, health - dmg); // Set health
                    
_Damage *= 0.0// Prevent _Damage to _Victim
                    
return Plugin_Changed;
                }
                else
                {
                    
GetEdictClassname(_Inflictorg_Weaponsizeof(g_Weapon)); // Attacking weapon
                    
                    
if (StrContains(g_Weapon"_projectile") > 0// weapon was hegrenade_projectile, flashbang_projectile, smokegrenade_projectile
                    
{
                        
ReplaceString(g_Weaponsizeof(g_Weapon), "_projectile"""false); // Erase _projectile from weapon name
                        
ForcePlayerSuicide(_Attacker); // Force _Attacker suicide
                        
_Damage *= 0.0// Prevent _Damage to _Victim
                        
return Plugin_Changed;
                    }
                    else 
// Any other weapon
                    
{
                        
GetClientWeapon(_Attackerg_Weaponsizeof(g_Weapon)); // Get _Attacker weapon
                        
ReplaceString(g_Weaponsizeof(g_Weapon), "weapon_"""false); // Erase weapon_ from weapon name
                        
                        
ForcePlayerSuicide(_Attacker); // Force _Attacker suicide
                        
_Damage *= 0.0// Prevent _Damage to _Victim
                        
return Plugin_Changed;
                    }
                }
            }
        }
    }
    
    return 
Plugin_Continue;


Last edited by AzulFlamaWallon; 03-21-2020 at 09:50.
AzulFlamaWallon is offline
PC Gamer
Senior Member
Join Date: Mar 2014
Old 03-20-2020 , 17:01   Re: [TF2] How to catch Granade in TraceAttack?
Reply With Quote #2

Maybe check damage type first to see if damagetype == 6 (DMG_BLAST) with SDKHook_OnTakeDamage?

SDK Hooks include: https://github.com/alliedmodders/sou...e/sdkhooks.inc
PC Gamer is offline
AzulFlamaWallon
Junior Member
Join Date: Jan 2017
Location: Korea
Old 03-21-2020 , 09:49   Re: [TF2] How to catch Granade in TraceAttack?
Reply With Quote #3

Quote:
Originally Posted by PC Gamer View Post
Maybe check damage type first to see if damagetype == 6 (DMG_BLAST) with SDKHook_OnTakeDamage?

SDK Hooks include: https://github.com/alliedmodders/sou...e/sdkhooks.inc
Solved! Thank you for your help. Bless you.
AzulFlamaWallon is offline
Reply


Thread Tools
Display Modes

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 12:07.


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