AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Forbidate pressing IN_ATTACK and INT_ATTACK2 (https://forums.alliedmods.net/showthread.php?t=316900)

Hennesy 06-16-2019 15:01

Forbidate pressing IN_ATTACK and INT_ATTACK2
 
How to prevent pressing IN_ATTACK and INT_ATTACK2 so that it was impossible to shoot even shooting animations so that there was no ... how to implement it? I tried OnPlayerRunCmd but there is still an animation as you strike or shoot! Please help

lizzy 06-16-2019 19:42

Re: Forbidate pressing IN_ATTACK and INT_ATTACK2
 
Quote:

Originally Posted by Hennesy (Post 2655704)
How to prevent pressing IN_ATTACK and INT_ATTACK2 so that it was impossible to shoot even shooting animations so that there was no ... how to implement it? I tried OnPlayerRunCmd but there is still an animation as you strike or shoot! Please help

Perhaps this thread will help: Block shooting - started by Grayscale

impossible_cc 06-19-2019 17:57

Re: Forbidate pressing IN_ATTACK and INT_ATTACK2
 
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);
        }
    }    




All times are GMT -4. The time now is 22:38.

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