Raised This Month: $ Target: $400
 0% 

TraceAttack & TakeDamage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 07-15-2012 , 13:32   TraceAttack & TakeDamage
Reply With Quote #1

PHP Code:
    RegisterHam(Ham_TraceAttack"player""player_attack")
    
RegisterHam(Ham_TakeDamage"player""hook_TakeDamage"
What's the difference between these two?

I understand that "Ham_TraceAttack" activates when some player attack other player and "Ham_TakeDamage" is when the damage is deal.

Lets say i want to prevent ct's from any damage if "catch" variable is true so what's the difference between these codes?

PHP Code:
public player_attack(victimattackerFloat:damageFloat:direction[3], tracehandledamagebits)
{
    static 
vteam,ateam
    
if(!is_user_connected(victim) || !is_user_connected(attacker) || victim == attacker)
        return 
HAM_IGNORED
   
    vteam 
get_user_team(victim)
    
ateam get_user_team(attacker)

    if(catch)
    {  
        if(
ateam == && vteam == 2)
            return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED
}


public 
hook_TakeDamage(victimattackeruselessFloat:damagedamagebits) {
 
    static 
vteam,ateam
    
if(!is_user_connected(victim) || !is_user_connected(attacker) || victim == attacker)
        return 
HAM_IGNORED
   
    vteam 
get_user_team(victim)
    
ateam get_user_team(attacker)

    if(catch)
    {  
        if(
ateam == && vteam == 2)
            return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED

GhostMan is offline
Old 07-15-2012, 13:45
fysiks
This message has been deleted by fysiks. Reason: nvm, I don't want to get into this.
GhostMan
Senior Member
Join Date: Jun 2012
Old 07-15-2012 , 13:52   Re: TraceAttack & TakeDamage
Reply With Quote #2

Got what i needed :O
http://forums.alliedmods.net/showthr...am_TraceAttack
GhostMan is offline
DJHD!
Veteran Member
Join Date: Dec 2009
Location: Santiago, Chile
Old 07-15-2012 , 18:23   Re: TraceAttack & TakeDamage
Reply With Quote #3

In Ham_TraceAttack the attack is bloqued
In Ham_TakeDamage the damage is bloqued
__________________
Quote:
Originally Posted by XINLEI View Post
Porque rocccos trata de ser el metalicross que nunca va a poder ser.
DJHD! is offline
Send a message via MSN to DJHD!
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-16-2012 , 15:51   Re: TraceAttack & TakeDamage
Reply With Quote #4

So basicly if you block it using traceattack, you wont get these "attack"-effekts like screenshake elc, because it is executed before. And (but Im not sure) I somewhere read that wih takedamage you cant block grenade damage (correct me if Im wrong)
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers

Last edited by mottzi; 07-16-2012 at 15:52.
mottzi is offline
Send a message via MSN to mottzi
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 15:17.


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