Raised This Month: $51 Target: $400
 12% 

trying to block +attack2 with no success.. anything imd oing wrong?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
12Toastie
Junior Member
Join Date: Nov 2014
Old 07-08-2023 , 16:19   trying to block +attack2 with no success.. anything imd oing wrong?
Reply With Quote #1

PHP Code:
public plugin_init(){
    
//register_forward( FM_CmdStart, "CmdStart" )
    
register_forward(FM_PlayerPreThink"PlayerPreThink")
    
}

public 
PlayerPreThink(id){
        new 
button pev(id,pev_button)
        if((
button IN_ATTACK2)){
            
client_print(0print_chat"in attack2..");
                        
//set_pev(id,pev_button,(button & ~IN_ATTACK) & ~IN_ATTACK2)
            
set_pev(id,pev_button,(button & ~IN_ATTACK2))
        }
}

/*public CmdStart(const id, const uc_handle, seed)
{
    
    static buttons
    static oldbuttons
    buttons = get_uc(uc_handle, UC_Buttons)
    oldbuttons = pev(id, pev_oldbuttons);
    if((buttons & IN_ATTACK2))
    {
        client_print(0, print_chat, "in attack2..");
    //set_uc(uc_handle,UC_Buttons,(buttons & ~IN_ATTACK2))
    set_uc(uc_handle,UC_Buttons,(buttons & ~IN_ATTACK) & ~IN_ATTACK2)
    }
    if(!(buttons & IN_ATTACK2) && (oldbuttons & IN_ATTACK2)){
    //client_print(0, print_chat, "released attack2..");
    }
    return FMRES_SUPERCEDE; //This does block +attack right?
} */ 
I used both functions with no success.. I am successfully getting the print outs for "in attack2" so im getting that far. I was able to block +attack when I had it in there, just cant quite get attack2

stuff you see commenting out are things ive tried. This is for TFC

edit: solution was using _special for attack2

Last edited by 12Toastie; 07-12-2023 at 04:46.
12Toastie is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 07-11-2023 , 13:45   Re: trying to block +attack2 with no success.. anything imd oing wrong?
Reply With Quote #2

Take a look at this example, this should fix your problem:

PHP Code:
public CmdStart(idHandle) {
    if(
gMode == Mode_NoScope && is_user_alive(id) && get_user_weapon(id) == CSW_SCOUT) {
        static 
button
        button 
get_uc(HandleUC_Buttons)
        
        if (
button IN_ATTACK2) {
            
button &= ~IN_ATTACK2
        
}
        
        
set_uc(HandleUC_Buttonsbutton)
    }

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
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 09:48.


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