Quote:
Originally Posted by xairgeo
I need it to impact only when it hits another play not when it touches other objects.
|
PHP Code:
#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >
#define PLUGIN "Nade explode on touch"
#define VERSION "0.1"
#define AUTHOR "HamletEagle"
const m_usEvent = 228
const SHORT_BYTES = 2
const BYTE_BITS = 8
new m_usHeGrenade
public plugin_precache( )
{
m_usHeGrenade = engfunc( EngFunc_PrecacheEvent, 1, "events/createexplo.sc" )
}
public plugin_init( )
{
register_plugin
(
.plugin_name = PLUGIN,
.version = VERSION,
.author = AUTHOR
)
RegisterHam( Ham_Touch, "grenade", "CGrenade_Touch" )
}
public CGrenade_Touch( iTouched, iToucher )
{
static szClassName[ 20 ]; pev( iTouched, pev_classname, szClassName, charsmax( szClassName ) )
if( equal( szClassName, "grenade" ) && is_user_connected( iToucher ) )
{
static usEvent; usEvent = get_pdata_short( iTouched, m_usEvent )
if( !usEvent || usEvent == m_usHeGrenade )
{
set_pev( iTouched, pev_dmgtime, 0.0 )
}
}
}
stock get_pdata_short(ent, shortbased_offset, intbase_linuxdiff = 5)
{
return ( get_pdata_int(ent, shortbased_offset / SHORT_BYTES, intbase_linuxdiff)>>>((shortbased_offset % SHORT_BYTES) * BYTE_BITS) ) & 0xFFFF
}