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(iEnt, id)
{
if( entity_get_float(iEnt, EV_FL_dmg) >= 0.0 )
{
return
}
if( entity_get_float(id, EV_FL_takedamage) == DAMAGE_NO )
{
return
}
if( entity_get_int(iEnt, EV_INT_spawnflags) & SF_TRIGGER_HURT_NO_CLIENTS )
{
return
}
static Float:fTime ; fTime = get_gametime()
if( entity_get_float(iEnt, EV_FL_dmgtime) > fTime )
{
if( fTime != entity_get_float(iEnt, EV_FL_pain_finished) )
{
if( !( entity_get_int(iEnt, EV_INT_impulse) & (1<<(id-1)) ) )
{
g_GonnaBeHurt[id] = get_pdata_int(iEnt, m_bitsDamageInflict, 4)
}
}
}
else
{
g_GonnaBeHurt[id] = get_pdata_int(iEnt, m_bitsDamageInflict, 4)
}
}
public Player_TakeHealth(id, Float:flHealth, bitsDamageType)
{
if( g_GonnaBeHurt[id] = bitsDamageType )
{
g_GonnaBeHurt[id] = -1
// player has just been healed
}
}
__________________