AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Handle damage (https://forums.alliedmods.net/showthread.php?t=86976)

grankee 03-05-2009 06:27

Handle damage
 
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?

anakin_cstrike 03-05-2009 08:24

Re: Handle damage
 
http://forums.alliedmods.net/showthr...ght=trace+line

Dr.G 03-05-2009 08:37

Re: Handle damage
 
check this out

ConnorMcLeod 03-05-2009 11:13

Re: Handle damage
 
const m_LastHitGroup = 75


And in the damage function :

HIT_PLACE = get_pdata_int(Victim, m_LastHitGroup, 5)

stupok 03-05-2009 11:27

Re: Handle damage
 
Quote:

Originally Posted by anakin_cstrike (Post 774411)

I would use TraceAttack before using TraceLine.

Quote:

Originally Posted by Dr.G (Post 774420)
check this out

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

Quote:

Originally Posted by ConnorMcLeod (Post 774511)
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.

grankee 03-05-2009 11:28

Re: Handle damage
 
that's what I need, simple and useful
+Karma for You, Dr.G

Bugsy 03-05-2009 11:29

Re: Handle damage
 
Quote:

Originally Posted by ConnorMcLeod (Post 774511)
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.

stupok 03-05-2009 11:31

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

EDIT: Cool, I might use it, then.

YamiKaitou 03-05-2009 11:31

Re: Handle damage
 
Linux offset. It defaults to 5, so in this example it is not required to be included

ConnorMcLeod 03-05-2009 12:26

Re: Handle damage
 
Quote:

Originally Posted by stupok (Post 774520)
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 );
    }




All times are GMT -4. The time now is 17:08.

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