Raised This Month: $ Target: $400
 0% 

ham_takedamage or ham_traceattack?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Isaac999
Senior Member
Join Date: Nov 2011
Location: Home
Old 11-26-2011 , 06:54   ham_takedamage or ham_traceattack?
Reply With Quote #1

whats the difference?

ham_TakeDamage

ham_TraceAttack

and what should be use?
Isaac999 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-26-2011 , 07:28   Re: ham_takedamage or ham_traceattack?
Reply With Quote #2

Depends on what you want to do.

Ham_TakeDamage is called when damage is done
Ham_TraceAttack is called when a player shoots for example. (Not sure what it does for other entities)
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Snaker beatter
Veteran Member
Join Date: Sep 2011
Location: Manila, Philippines
Old 11-26-2011 , 07:45   Re: ham_takedamage or ham_traceattack?
Reply With Quote #3

Ham_TraceAttack - even when a player did not have damage (example: shoot team mate but disabled freindlyfire)

Not sure.
__________________

Last edited by Snaker beatter; 11-26-2011 at 07:45.
Snaker beatter is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-26-2011 , 09:32   Re: ham_takedamage or ham_traceattack?
Reply With Quote #4

From ham_const.inc
PHP Code:
/**
     * Description:        Usually called whenever an entity gets attacked by a hitscan (such as a gun) weapon.
     *                    Use the get/set tr2 natives in fakemeta to handle the traceresult data.
     *                    Do not use a handle of 0 as a traceresult in execution, use create_tr2() from Fakemeta
     *                    to pass a custom handle instead.  (Don't forget to free the handle when you're done.)
     * Forward params:    function(this, idattacker, Float:damage, Float:direction[3], traceresult, damagebits)
     * Return type:        None.
     * Execute params:    ExecuteHam(Ham_TraceAttack, this, idattacker, Float:damage, Float:direction[3], tracehandle, damagebits);
     */
    
Ham_TraceAttack 
PHP Code:
    /**
     * Description:        Usually called whenever an entity takes any kind of damage.
     *                    Inflictor is the entity that caused the damage (such as a gun).
     *                    Attacker is the entity that tirggered the damage (such as the gun's owner).
     * Forward params:    function(this, idinflictor, idattacker, Float:damage, damagebits);
     * Return type:        Integer.
     * Execute params:    ExecuteHam(Ham_TakeDamage, this, idinflictor, idattacker, Float:damage, damagebits);
     */
    
Ham_TakeDamage
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 11-26-2011 , 09:58   Re: ham_takedamage or ham_traceattack?
Reply With Quote #5

Ham_TraceAttack is the traceline of the attack/bullet/damage whatever, you can use it with entities or even with worldspawn to detect bullets hitting walls, use this if you need something complicated like seeing if the shot was near a something else... this would be excelent for exploding ammo =)

If you just want to check when someone was damaged by something/someone, use Ham_TakeDamage.
__________________

Last edited by Hunter-Digital; 11-26-2011 at 10:00.
Hunter-Digital is offline
Isaac999
Senior Member
Join Date: Nov 2011
Location: Home
Old 11-26-2011 , 10:01   Re: ham_takedamage or ham_traceattack?
Reply With Quote #6

Thanks every one.

One last question:

Ham_TraceAttack can trace a attack from teammate (even if no friendlyfire)
Isaac999 is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 11-26-2011 , 10:01   Re: ham_takedamage or ham_traceattack?
Reply With Quote #7

Yes but you can use Ham_TakeDamage for that too, it triggers regardless of mp_friendlyfire when you shoot teammates.
__________________

Last edited by Hunter-Digital; 11-26-2011 at 10:02.
Hunter-Digital is offline
Isaac999
Senior Member
Join Date: Nov 2011
Location: Home
Old 11-26-2011 , 10:04   Re: ham_takedamage or ham_traceattack?
Reply With Quote #8

Thanks
Isaac999 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 08:23.


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