Raised This Month: $ Target: $400
 0% 

Blocking Defuse


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
The Specialist
BANNED
Join Date: Nov 2006
Old 11-26-2006 , 14:42   Blocking Defuse
Reply With Quote #1

Ok i need a good way to block a player from defusing the bomb. Without removing buttons. I know how to detect the bomb defuse proccess. But i need to block it after it starts . thank you.
The Specialist is offline
Send a message via AIM to The Specialist
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 11-26-2006 , 14:47   Re: Blocking Defuse
Reply With Quote #2

set_pev( id, pev_buttons, pev(id, pev_buttons ) & ~IN_USE )
same with oldbuttons should do the work
do this in prethink or else it will start again and again and again and again

Last edited by Greenberet; 11-26-2006 at 15:02.
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
The Specialist
BANNED
Join Date: Nov 2006
Old 11-26-2006 , 14:52   Re: Blocking Defuse
Reply With Quote #3

hmmmm. I didnt want to have to remove the buttons . Is that the only way to block this ?? if so it will have to do ++karma for the help
The Specialist is offline
Send a message via AIM to The Specialist
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-26-2006 , 14:53   Re: Blocking Defuse
Reply With Quote #4

You can hook when they start it and force them to execute "-use". This is what I did for one of my very first plugins, VIP Defuser 0.1 for the original AMX mod.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 11-26-2006 , 14:55   Re: Blocking Defuse
Reply With Quote #5

Force them to execute ~IN_USE ?? can you explaine what you meen by this please ?

EDIT : heres my code so far but it crahsed my server .
Code:
#include <amxmodx> #include <fakemeta> new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3; new g_Switch; public plugin_init() {  register_plugin("Cut The Right Wire","0.1","The Speicialist");  g_Switch = register_cvar("ctrw_switch","1");  register_menucmd(register_menuid("menu_show"),1023,"menu_choose");  register_logevent("bomb_defuse_no_kit", 3, "2=Begin_Bomb_Defuse_Without_Kit");  register_logevent("bomb_defuse_kit", 3, "2=Begin_Bomb_Defuse_With_Kit");  register_forward(FM_PlayerPreThink,"menu_choose"); } // detect defusing public bomb_defuse_no_kit() {  new id = get_loguser_index();    if(get_pcvar_num(g_Switch)==0)  {   return PLUGIN_HANDLED;  }else{   new menu[192];   format(menu,191,"Choose The Right Wire Or Die!^n1. Red^n2. Blue^n3. Green^n^n0. Die");   show_menu(id,keys,menu,-1,"menu_show");  }  return 0; } // detect defusing public bomb_defuse_kit() {  new id = get_loguser_index();    if(get_pcvar_num(g_Switch)==0)  {   return PLUGIN_HANDLED;  }else{   new menu[192];   format(menu,191,"Choose The Right Wire Or Die!^n1. Red^n2. Blue^n3. Green^n^n0. Die");   show_menu(id,keys,menu,-1,"menu_show");  }  return 0; } // remove use button and show menu public menu_choose(id,key) {  set_pev( id, pev_button, pev(id,pev_button) & ~IN_USE);  new const Time = get_cvar_num("mp_c4timer")  new wire = random(2);  switch(key)  {   case 0 :   {    if( wire == 0 )    {     set_cvar_num("mp_c4timer",(Time + 10));     return PLUGIN_HANDLED;    }else{     set_cvar_string("mp_c4timer","0");     return PLUGIN_HANDLED;    }   }   case 1:   {    if( wire == 1)    {     set_cvar_num("mp_c4timer",(Time + 10 ));     return PLUGIN_HANDLED;    }else{     set_cvar_string("mp_c4timer","0");     return PLUGIN_HANDLED;    }   }   case 2 :   {    if( wire == 2 )    {     set_cvar_num("mp_c4timer",(Time + 10 ));     return PLUGIN_HANDLED;    }else{     set_cvar_string("mp_c4timer","0");     return PLUGIN_HANDLED;    }   }  }  set_cvar_num("mp_c4timer",Time);  return PLUGIN_HANDLED; } // function to get index from log events stock get_loguser_index() {  new loguser[80], name[32];  read_logargv(0, loguser, 79);  parse_loguser(loguser, name, 31);  return get_user_index(name); }

Last edited by The Specialist; 11-26-2006 at 14:58.
The Specialist is offline
Send a message via AIM to The Specialist
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-26-2006 , 19:09   Re: Blocking Defuse
Reply With Quote #6

Code:
client_cmd(id,"-use");
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-26-2006 , 20:44   Re: Blocking Defuse
Reply With Quote #7

or you could just give them a lil boost into the air (because you have to be on the ground to defuse)
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 11-26-2006 , 21:07   Re: Blocking Defuse
Reply With Quote #8

If you are going to start blocking buttons its best to use CmdStart:
Code:
register_forward(FM_CmdStart, "CmdStart") public CmdStart(id, uc_handle, random_seed) {     if(!is_user_alive(id)) return FMRES_IGNORED     static buttons     buttons = get_uc(uc_handle, UC_Buttons)     if(buttons & IN_USE) buttons &= ~IN_USE     set_uc(uc_handle, UC_Buttons, buttons)     return FMRES_IGNORED }
Reason above method is more efficient is that it handles when buttons etc do something whereas using PreThink it doesn't.
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd
Orangutanz is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 11-27-2006 , 05:05   Re: Blocking Defuse
Reply With Quote #9

Ah, I think i got it now. Thanks for all the help guys ++karma
The Specialist is offline
Send a message via AIM to The Specialist
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 11-30-2006 , 08:44   Re: Blocking Defuse
Reply With Quote #10

you dont need the
Code:
if(buttons & IN_USE)
part.
you can remove this

Code:
register_forward(FM_CmdStart, "CmdStart") public CmdStart(id, uc_handle, random_seed) {     if(!is_user_alive(id)) return FMRES_IGNORED     static buttons     buttons = get_uc(uc_handle, UC_Buttons)     buttons &= ~IN_USE     set_uc(uc_handle, UC_Buttons, buttons)     return FMRES_IGNORED }
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:56.


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