Quote:
Originally Posted by OciXCrom
PS: I was wondering if there's a way to get the C4's integer after it has been planted? I'm currently using an invisible entity at the c4's position.
|
There are multiple ways, but a nice one would be:
PHP Code:
#if AMXX_VERSION_NUM < 183
const INT_BYTES = 4
const BYTE_BITS = 8
stock bool:get_pdata_bool(ent, charbased_offset, intbase_linuxdiff = 5)
{
return !!(get_pdata_int(ent, charbased_offset / INT_BYTES, intbase_linuxdiff) & (0xFF<<((charbased_offset % INT_BYTES) * BYTE_BITS)))
}
#endif
const m_bIsC4 = 385
new GrenadeEntity = FM_NULLENT
while((GrenadeEntity = engfunc(EngFunc_FindEntityByString, GrenadeEntity, "classname", "grenade")))
{
if(pev_valid(GrenadeEntity) && get_pdata_bool(GrenadeEntity, m_bIsC4))
{
//do your stuff
break
}
}
After it's planted the classname is "grenade" and
m_bIsC4 is set to true.
__________________