Yea I know, but when I do this:
Code:
client_print(owner, print_chat, "m_idealMonsterState = %i", get_pdata_int(ent, m_IdealMonsterState))
It prints either this:
Code:
m_IdealMonsterState = 0
or this:
Code:
m_IdealMonsterState = 19464576
No matter if it is alive or dead.
Mostly prints '0' of the time. But there is a small chance it prints 19464576 also.
EDIT: If it helps, I'm using it with this:
Code:
public M203_Nade_Touch(pToucher, pTouched)
{
new szClassName[32]
entity_get_string(pToucher, EV_SZ_classname, szClassName, 31)
if(equal(szClassName, "m203_nade"))
{
if(!pTouched && 0)
return
new dmgradius = get_cvar_num("amx_m203rad")
new maxdamage = get_cvar_num("amx_m203dmg")
new Float:fl_vExplodeAt[3]
entity_get_vector(pToucher, EV_VEC_origin, fl_vExplodeAt)
new vExplodeAt[3]
vExplodeAt[0] = floatround(fl_vExplodeAt[0])
vExplodeAt[1] = floatround(fl_vExplodeAt[1])
vExplodeAt[2] = floatround(fl_vExplodeAt[2])
new owner = entity_get_edict(pToucher, EV_ENT_owner)
new Float:origin[3], Float:dist, Float:dRatio, damage
new ent = -1
while((ent = find_ent_by_class(ent, "func_wall")))
{
pev(ent, pev_origin, origin)
dist = get_distance_f(origin, fl_vExplodeAt)
if(dist <= dmgradius)
{
dRatio = dist / float(dmgradius)
damage = maxdamage - floatround(float(maxdamage) * dRatio)
if( pev(ent, pev_flags) & FL_MONSTER && can_see_fm(pToucher, ent) )
{
// get monster's health
new Float:health
pev(ent, pev_health, health)
health -= damage
if( pev(ent, pev_takedamage) == DAMAGE_NO )
{
damage = 0
}
// react to the damage
set_pev(ent, pev_dmg_inflictor, owner)
// do the damage
set_pev(ent, pev_health, health)
client_print(owner, print_chat, "m_IdealMonsterState = %i", get_pdata_int(ent, m_IdealMonsterState))
// It's dead, get frag & deal damage to the corpse to gib it
if(health <= 0 && get_pdata_int(ent, m_IdealMonsterState) == 8)
{
kill_monster(ent, owner)
}
}
}
}
remove_entity(pToucher)
}
}