You can try this, not really efficient as forward gonna be called each time a grenade is thinking, but for obscur reasons you don't want to use orpheu, which would be an strongly efficient way.
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#pragma semicolon 1
#define PLUGIN ""
#define VERSION "0.0.1"
#define cm(%0) ( sizeof(%0) - 1 )
// const XO_CGRENADE = 5;
const m_bStartDefuse = 384;
const m_bIsC4 = 385;
const m_flDefuseCountDown = 99;
const m_flC4Blow = 100;
const m_pBombDefuser_pent = 388;
public plugin_init()
{
register_plugin( PLUGIN, VERSION, "ConnorMcLeod" );
RegisterHam(Ham_Think, "grenade", "OnCGrenade_C4Think");
}
public OnCGrenade_C4Think( c4 )
{
if( !get_pdata_bool(c4, m_bIsC4) )
{
return HAM_IGNORED;
}
new Float:flTime = get_gametime();
if( get_pdata_float(c4, m_flC4Blow) <= flTime )
{
set_pev(c4, pev_flags, FL_KILLME);
// C4 should have blown here
// Execute the code you want
return HAM_SUPERCEDE;
}
if( get_pdata_bool(c4, m_bStartDefuse) )
{
new iDefuser = get_pdata_ent(c4, m_pBombDefuser_pent);
if( iDefuser && get_pdata_float(c4, m_flDefuseCountDown) <= flTime )
{
set_pev(c4, pev_flags, FL_KILLME);
ExecuteHamB(Ham_CS_Player_ResetMaxSpeed, iDefuser);
// C4 should have been defused here
// Execute the code you want
return HAM_SUPERCEDE;
}
}
return HAM_IGNORED;
}
__________________