For both, basically, supercede forward Ham_Use with "grenade" entities should work.
PHP Code:
/* Copyright © 2009, ConnorMcLeod
Bomb Defusion is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bomb Defusion; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "Bomb Defusion"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"
#define MAX_PLAYERS 32
new g_iDefuser
new g_bCantDefuse[MAX_PLAYERS+1]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
if( !engfunc( EngFunc_FindEntityByString , FM_NULLENT , "classname" , "func_bomb_target" )
&& !engfunc( EngFunc_FindEntityByString , FM_NULLENT , "classname" , "info_bomb_target" ) )
{
pause("ad")
return
}
register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0")
RegisterHam(Ham_Use, "grenade", "C4_Use")
register_concmd("stop_defuse", "Command_StopDefuse", ADMIN_KICK)
}
public client_putinserver( id )
{
g_bCantDefuse[ id ] = false
}
public Event_HLTV_New_Round()
{
g_iDefuser = 0
}
public C4_Use(iC4, id, idactivator, use_type, Float:value)
{
if( use_type != 2 || value != 1.0 || get_user_team(id) != 2 )
{
return HAM_IGNORED
}
g_iDefuser = id
if( g_bCantDefuse[g_iDefuser] )
{
return HAM_SUPERCEDE
}
return HAM_IGNORED
}
public Command_StopDefuse(id, level)
{
if( !(get_user_flags(id) & level) )
{
return PLUGIN_HANDLED
}
new plr
if( read_argc() == 2 )
{
new szArg[32]
read_argv(1, szArg, charsmax(szArg))
plr = cmd_target(id, szArg)
}
if( !plr )
{
plr = g_iDefuser
}
if( !plr )
{
return PLUGIN_HANDLED
}
g_bCantDefuse[plr] = true
new szName[32]
get_user_name(plr, szName, charsmax(szName))
client_print(id, print_console, "%s can't defuse the bomb anymore", szName)
return PLUGIN_HANDLED
}
__________________