Raised This Month: $ Target: $400
 0% 

Hooking OnTakeDamage or OnTakeDamage_Alive ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sn4k3
Senior Member
Join Date: Nov 2005
Old 03-10-2008 , 18:38   Hooking OnTakeDamage or OnTakeDamage_Alive ?
Reply With Quote #1

what should i hook ?

OnTakeDamage
or
OnTakeDamage_Alive

all i want to do is return new params with more damage


thanks
sn4k3 is offline
Send a message via MSN to sn4k3
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 03-11-2008 , 10:31   Re: Hooking OnTakeDamage or OnTakeDamage_Alive ?
Reply With Quote #2

Hook TraceAttack.

Code:
void SamplePlugin::TraceAttack_handler( CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr )
{
    // adjust damage for ALL players 
    float damage = info.GetDamage();
    damage = damage * mc_damage_mult.GetFloat() + mc_damage_add.GetFloat();
    info.SetDamage(damage);

    // use modified damage info
    RETURN_META(MRES_HANDLED);  
}
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
sn4k3
Senior Member
Join Date: Nov 2005
Old 03-11-2008 , 12:55   Re: Hooking OnTakeDamage or OnTakeDamage_Alive ?
Reply With Quote #3

Quote:
Originally Posted by L. Duke View Post
Hook TraceAttack.

Code:
void SamplePlugin::TraceAttack_handler( CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr )
{
    // adjust damage for ALL players 
    float damage = info.GetDamage();
    damage = damage * mc_damage_mult.GetFloat() + mc_damage_add.GetFloat();
    info.SetDamage(damage);

    // use modified damage info
    RETURN_META(MRES_HANDLED);  
}

thanks
sn4k3 is offline
Send a message via MSN to sn4k3
sn4k3
Senior Member
Join Date: Nov 2005
Old 03-11-2008 , 14:10   Re: Hooking OnTakeDamage or OnTakeDamage_Alive ?
Reply With Quote #4

CBaseEntity* pThis = META_IFACEPTR(CBaseEntity);

this represent the Attacker or the victim?
probaly victim?
sn4k3 is offline
Send a message via MSN to sn4k3
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 03-11-2008 , 18:55   Re: Hooking OnTakeDamage or OnTakeDamage_Alive ?
Reply With Quote #5

It represents the player you hooked for TraceAttack, so yes the victim.

Code:
    CBaseEntity *pVictim = META_IFACEPTR(CBaseEntity);
    CBaseEntity *pAttacker = info.GetAttacker();
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
Reply



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 22:28.


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