AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How do stop defusing bomb[solved] (https://forums.alliedmods.net/showthread.php?t=86213)

zwfgdlc 02-22-2009 13:26

How do stop defusing bomb[solved]
 
How do stop defusing bomb.sorry for my english.
PHP Code:

register_event("BarTime""event_function""be""1=5""1=10")
public 
event_function(id)
{
       
//how do stop?



BOYSplayCS 02-22-2009 21:54

Re: How do stop defusing bomb
 
PHP Code:

 register_forward(FM_PlayerPreThink,"block_buttons"); 

PHP Code:

public block_buttons(id)
{
 if( 
== )
 {
  return 
1;
 }else{
  
set_pevidpev_buttonpev(id,pev_button) & ~IN_USE); }
 return 
1;



Bugsy 02-22-2009 23:27

Re: How do stop defusing bomb
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Block Defuse"
#define VERSION "1.0"
#define AUTHOR "bugsy"


public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_logevent("bomb_defuse"3"2=Begin_Bomb_Defuse_Without_Kit");
    
register_logevent("bomb_defuse"3"2=Begin_Bomb_Defuse_With_Kit");
}

public 
bomb_defuse()
{
    new 
id get_loguser_index();
    
client_cmd(id,"-use");
}

stock get_loguser_index() 
{
    new 
szLoguser[64], szName[32];
    
read_logargv(0szLogusersizeof szLoguser 1);
    
parse_loguser(szLoguserszNamesizeof szName 1);
    
    return 
get_user_index(szName);



ConnorMcLeod 02-23-2009 03:11

Re: How do stop defusing bomb
 
What you want to do, stop a player from defusing or prevent a player from defusing ?

zwfgdlc 02-23-2009 03:25

Re: How do stop defusing bomb
 
@Connor
i want to stop a player from defusing.or set the player don't defuse bomb.
i try this.
PHP Code:

register_event("BarTime""event_function""be""1=5""1=10"
public 
event_function(id

       
client_cmd(id,"-use");


but the method have bug.

zwfgdlc 02-23-2009 03:36

Re: How do stop defusing bomb
 
Quote:

Originally Posted by Bugsy (Post 767069)
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Block Defuse"
#define VERSION "1.0"
#define AUTHOR "bugsy"


public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_logevent("bomb_defuse"3"2=Begin_Bomb_Defuse_Without_Kit");
    
register_logevent("bomb_defuse"3"2=Begin_Bomb_Defuse_With_Kit");
}

public 
bomb_defuse()
{
    new 
id get_loguser_index();
    
client_cmd(id,"-use");
}

stock get_loguser_index() 
{
    new 
szLoguser[64], szName[32];
    
read_logargv(0szLogusersizeof szLoguser 1);
    
parse_loguser(szLoguserszNamesizeof szName 1);
    
    return 
get_user_index(szName);



thanks.but the method have bug,if the player fast double press "E" key,do not stop the player from defuing.

ConnorMcLeod 02-23-2009 04:15

Re: How do stop defusing bomb
 
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(PLUGINVERSIONAUTHOR)

    if( !
engfuncEngFunc_FindEntityByString FM_NULLENT "classname" "func_bomb_target" )
    &&  !
engfuncEngFunc_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_putinserverid )
{
    
g_bCantDefuseid ] = false
}

public 
Event_HLTV_New_Round()
{
    
g_iDefuser 0
}

public 
C4_Use(iC4ididactivatoruse_typeFloat:value)
{
    if( 
use_type != || value != 1.0 || get_user_team(id) != )
    {
        return 
HAM_IGNORED
    
}

    
g_iDefuser id

    
if( g_bCantDefuse[g_iDefuser] )
    {
        return 
HAM_SUPERCEDE
    
}

    return 
HAM_IGNORED
}

public 
Command_StopDefuse(idlevel)
{
    if( !(
get_user_flags(id) & level) )
    {
        return 
PLUGIN_HANDLED
    
}

    new 
plr
    
if( read_argc() == )
    {
        new 
szArg[32]
        
read_argv(1szArgcharsmax(szArg))
        
plr cmd_target(idszArg)
    }

    if( !
plr )
    {
        
plr g_iDefuser
    
}

    if( !
plr )
    {
        return 
PLUGIN_HANDLED
    
}

    
g_bCantDefuse[plr] = true

    
new szName[32]
    
get_user_name(plrszNamecharsmax(szName))

    
client_print(idprint_console"%s can't defuse the bomb anymore"szName)

    return 
PLUGIN_HANDLED



zwfgdlc 02-23-2009 11:07

Re: How do stop defusing bomb
 
work,thanks ConnorMcLeod.+karma


All times are GMT -4. The time now is 17:07.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.