#include #include #include #include new gMaxPlayers, gPcvar_ps_explode_delay public plugin_init() { register_plugin("Panic Satchel", "1.2", "DaTa") RegisterHam(Ham_Touch, "monster_satchel", "monster_satchel_Touch_Post", 1) RegisterHam(Ham_Use, "monster_satchel", "monster_satchel_Use_Post", 1) gPcvar_ps_explode_delay = register_cvar("ps_explode_delay", "0.3") gMaxPlayers = get_maxplayers() } public monster_satchel_Use_Post(this, idcaller, idactivator, use_type, Float:value) { remove_task(this) return HAM_HANDLED } public monster_satchel_Touch_Post(this, idother) { if( !( 1 <= idother <= gMaxPlayers ) || !is_user_alive(idother) ) //not a valid player return HAM_IGNORED if( task_exists(this) )//already in exploding delay return HAM_IGNORED /* static Float:vel[3] pev(this, pev_velocity, vel) //don't touch the owner, while in a move if( pev(this, pev_owner) == idother && ( !(pev(this, pev_flags)&FL_ONGROUND) || xs_vec_len(vel) > 10.0 ) ) return HAM_IGNORED */ set_task(get_pcvar_float(gPcvar_ps_explode_delay), "task_delayed_explode", this) return HAM_HANDLED } public task_delayed_explode(ent) { if( !pev_valid(ent) )//was removed by unknown routine? return static class[32] pev(ent, pev_classname, class, sizeof(class)-1) if( !equal(class, "monster_satchel") )//superceded by other allocated ent? return //still it can be other satchel, don't know other way to check it if( pev(ent, pev_flags)&FL_KILLME ) return dllfunc(DLLFunc_Use, ent, 0)//da boom }