View Single Post
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 06-19-2019 , 17:57   Re: Forbidate pressing IN_ATTACK and INT_ATTACK2
Reply With Quote #3

Sorry for late response
PHP Code:

//To block attack
CreateTimer(0.3Timer_BlockAttackclientTIMER_REPEAT);
//
public Action Timer_BlockAttack(Handle tint client)
{
    if(...)
    {
        return 
Plugin_Handled;//allow attack
    
}
    
BlockAttack(client);
    return 
Plugin_Continue;
}

void BlockAttack(int client)
{
    
int weapon GetEntPropEnt(clientProp_Data"m_hActiveWeapon");
            
    if (
IsValidEntity(weapon))
    {
        
char sClass[32];
        
GetEntityClassname(weaponsClasssizeof(sClass));
                
        if (
StrContains(sClass"weapon_"false) > -1)
        {
            
SetEntPropFloat(weaponProp_Send"m_flNextPrimaryAttack"GetGameTime() + 0.5);
            
SetEntPropFloat(weaponProp_Send"m_flNextSecondaryAttack"GetGameTime() + 0.5);
        }
    }    

__________________

Last edited by impossible_cc; 06-24-2019 at 06:51. Reason: SetEntDataFloat instead of SetEntPropFloat
impossible_cc is offline