Raised This Month: $ Target: $400
 0% 

Handle damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
grankee
Member
Join Date: Jun 2008
Old 03-05-2009 , 06:27   Handle damage
Reply With Quote #1

I want to change any damage trigger by headshot.

Code:
public  plugin_init() 
{
register_plugin("Real  damage","1.0","grankee")
//RegisterHam(Ham_TakeDamage, "player",  "hook_TakeDamage") 
}

public hook_TakeDamage(Victim, Useless,  Attacker, Float:Damage,  damagebits)
{
//code...
}
But I don't know what part of body is hurt.


How to check on it?

Last edited by grankee; 03-05-2009 at 06:55.
grankee is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 03-05-2009 , 08:24   Re: Handle damage
Reply With Quote #2

http://forums.alliedmods.net/showthr...ght=trace+line
__________________

anakin_cstrike is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 03-05-2009 , 08:37   Re: Handle damage
Reply With Quote #3

check this out
__________________

Last edited by Dr.G; 04-21-2009 at 19:47.
Dr.G is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-05-2009 , 11:13   Re: Handle damage
Reply With Quote #4

const m_LastHitGroup = 75


And in the damage function :

HIT_PLACE = get_pdata_int(Victim, m_LastHitGroup, 5)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 03-05-2009 , 11:27   Re: Handle damage
Reply With Quote #5

Quote:
Originally Posted by anakin_cstrike View Post
I would use TraceAttack before using TraceLine.

Quote:
Originally Posted by Dr.G View Post
check this out
That's the method I've used before, good find.

Quote:
Originally Posted by ConnorMcLeod View Post
const m_LastHitGroup = 75


And in the damage function :

HIT_PLACE = get_pdata_int(Victim, m_LastHitGroup, 5)
Since TakeDamage is hooked "pre", would this work? I'm just curious.
__________________
stupok is offline
grankee
Member
Join Date: Jun 2008
Old 03-05-2009 , 11:28   Re: Handle damage
Reply With Quote #6

that's what I need, simple and useful
+Karma for You, Dr.G
grankee is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-05-2009 , 11:29   Re: Handle damage
Reply With Quote #7

Quote:
Originally Posted by ConnorMcLeod View Post
const m_LastHitGroup = 75


And in the damage function :

HIT_PLACE = get_pdata_int(Victim, m_LastHitGroup, 5)
What is the 5 for connor? In my plugin I am using the below and it is working.

PHP Code:
new iHitzone get_pdata_intidm_LastHitGroup 
stupok, yes it works, I am using that method in the aimbot detection plugin.
__________________

Last edited by Bugsy; 03-05-2009 at 11:31.
Bugsy is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 03-05-2009 , 11:31   Re: Handle damage
Reply With Quote #8

It's the offset for linux. http://www.amxmodx.org/funcwiki.php?..._int&go=search

EDIT: Cool, I might use it, then.
__________________
stupok is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-05-2009 , 11:31   Re: Handle damage
Reply With Quote #9

Linux offset. It defaults to 5, so in this example it is not required to be included
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-05-2009 , 12:26   Re: Handle damage
Reply With Quote #10

Quote:
Originally Posted by stupok View Post
I would use TraceAttack before using TraceLine.



That's the method I've used before, good find.



Since TakeDamage is hooked "pre", would this work? I'm just curious.
TakeDamage is fired from TraceAttack, just after m_LastHitGroup has been set.

PHP Code:
void CBasePlayer :: TraceAttackentvars_t *pevAttackerfloat flDamageVector vecDirTraceResult *ptrint bitsDamageType)
{
    if ( 
pev->takedamage )
    {
        
m_LastHitGroup ptr->iHitgroup;

        switch ( 
ptr->iHitgroup )
        {
        case 
HITGROUP_GENERIC:
            break;
      
// [...]
        
}

        
SpawnBlood(ptr->vecEndPosBloodColor(), flDamage);// a little surface blood.
        
TraceBleedflDamagevecDirptrbitsDamageType );
        
AddMultiDamagepevAttackerthisflDamagebitsDamageType );
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 17:08.


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