Raised This Month: $ Target: $400
 0% 

trigger_hurt heal detection


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-09-2009 , 01:09   Re: trigger_hurt heal detection
Reply With Quote #1

Try this :

PHP Code:
/*    Formatright © 2009, ConnorMcLeod

    HurtTouch is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with HurtTouch; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <engine>
#include <hamsandwich>

#define VERSION "0.0.1"

#define    MAX_PLAYERS    32

#define    DAMAGE_NO                       0.0
#define    SF_TRIGGER_HURT_NO_CLIENTS      8

#define    m_bitsDamageInflict        71

new g_GonnaBeHurt[MAX_PLAYERS+1] = {-1, ...}

public 
plugin_init()
{
    
register_plugin("HurtTouch"VERSION"ConnorMcLeod")

    
register_touch("trigger_hurt""player""HurtTouch")
    
RegisterHam(Ham_TakeHealth"player""Player_TakeHealth")
}

public 
HurtTouch(iEntid)
{
    if( 
entity_get_float(iEntEV_FL_dmg) >= 0.0 )
    {
        return
    }

    if( 
entity_get_float(idEV_FL_takedamage) == DAMAGE_NO )
    {
        return
    }

    if( 
entity_get_int(iEntEV_INT_spawnflags) & SF_TRIGGER_HURT_NO_CLIENTS )
    {
        return
    }

    static 
Float:fTime fTime get_gametime()
    if( 
entity_get_float(iEntEV_FL_dmgtime) > fTime )
    {
        if( 
fTime != entity_get_float(iEntEV_FL_pain_finished) )
        {
            if(  !( 
entity_get_int(iEntEV_INT_impulse) & (1<<(id-1)) )  )
            {
                
g_GonnaBeHurt[id] = get_pdata_int(iEntm_bitsDamageInflict4)
            }
        }
    }
    else
    {
        
g_GonnaBeHurt[id] = get_pdata_int(iEntm_bitsDamageInflict4)
    }
}

public 
Player_TakeHealth(idFloat:flHealthbitsDamageType)
{
    if( 
g_GonnaBeHurt[id] = bitsDamageType )
    {
        
g_GonnaBeHurt[id] = -1
        
// player has just been healed
    
}

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-09-2009 at 01:17.
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 23:36.


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