Quote:
|
Originally Posted by KCE
Code:
//fakemeta method
public PlayerPreThink( id )
{
//Do whatever checks you need to do and whatnot...
if( !is_user_alive(id) )
return FMRES_IGNORED;
//Remove the attack button from their button mask
set_pev( id, pev_button, pev(id,pev_button) & ~IN_ATTACK );
return FMRES_HANDLED;
}
|
Blocking buttons like IN_ATTACK in PreThink isn't very good. It just works for the knife and not that good.
I recommend the use of FM_CmdStart because it causes a better result than in PretThink and you're able to block all the weapon attacks.
Code:
// Put this in plugin init (yes it's for hooking the forward)
register_forward(FM_CmdStart,"fwd_CmdStart")
// Put this somewhere in the code ;)
public fwd_CmdStart(id, uc_handle, seed) {
if(!is_user_alive(id)) return FMRES_IGNORED
new buttons = get_uc(uc_handle,UC_Buttons)
if(buttons & IN_ATTACK) {
buttons &= ~IN_ATTACK
set_uc(uc_handle,UC_Buttons,buttons)
}
return FMRES_HANDLED
}