Raised This Month: $12 Target: $400
 3% 

Solved Check if a player was damaged by a grenade


Post New Thread Reply   
 
Thread Tools Display Modes
joac1144
Senior Member
Join Date: Dec 2012
Location: Copenhagen, Denmark
Old 10-31-2018 , 06:29   Re: Check if a player was damaged by a grenade
Reply With Quote #11

This is how I ended up doing it:
PHP Code:
public Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3])
{
    
char classname[32];
    
GetEdictClassname(inflictorclassnamesizeof(classname));
        
    if(
damagetype == DMG_BLAST && StrEqual(classname"hegrenade_projectile"))
    {    
        
//code
    
}
    
    return 
Plugin_Continue;


Last edited by joac1144; 10-31-2018 at 06:30.
joac1144 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 10-31-2018 , 16:09   Re: Check if a player was damaged by a grenade
Reply With Quote #12

I just check attacker is a valid client index && blast damage.

C4 doesnt have a valid attacker.

Edit:

This avoids dealing with strings and classnames
__________________

Last edited by Neuro Toxin; 10-31-2018 at 16:09.
Neuro Toxin 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 18:24.


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