Raised This Month: $2 Target: $400
 0% 

[HELP]CSGO Block the attack on flashbang


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PeaceJS
New Member
Join Date: Jun 2020
Old 06-01-2020 , 08:04   [HELP]CSGO Block the attack on flashbang
Reply With Quote #1

Hey guys,
so im trying to block the +attack etc on flashbang, basically i want the flash just to be hold.
when switching back to usp or other guns you can normally shoot.

atm i got this code which works perfectly


Code:
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
{
    char sWeaponName[32];
    
    if (IsPlayerAlive(client))
    {
    GetEntityClassname(GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"), sWeaponName, sizeof(sWeaponName));
    
    if (StrEqual(sWeaponName, "weapon_flashbang"))
     {
       if (buttons & IN_ATTACK)
    SetEntPropFloat(weapon, Prop_Send, "m_flNextPrimaryAttack", 999999.0)
    SetEntPropFloat(client, Prop_Send, "m_flNextAttack", 9999.0)
    
        return Plugin_Changed;
     }
    }
    return Plugin_Continue;
}
The only problem is it spams my server with error

Code:
L 06/01/2020 - 11:14:47: [SM] [0] SetEntPropFloat
L 06/01/2020 - 11:14:47: [SM] [1] Line 55, plugin.sp::OnPlayerRunCmd
L 06/01/2020 - 11:14:47: [SM] Exception reported: Property "m_flNextPrimaryAttack" not found (entity 1/player)
L 06/01/2020 - 11:14:47: [SM] Blaming: Flashfix.smx
Anyone got a clue how i could fix that?

Last edited by PeaceJS; 06-01-2020 at 08:04.
PeaceJS is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 06-01-2020 , 09:10   Re: [HELP]CSGO Block the attack on flashbang
Reply With Quote #2

PHP Code:
public Action OnPlayerRunCmd(int clientint &buttonsint &impulsefloat vel[3], float angles[3], int &weaponint &subtypeint &cmdnumint &tickcountint &seedint mouse[2])
{
    
char sWeaponName[32];
    if (
IsPlayerAlive(client))
    {
        
int weapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
        if (
weapon != -1)
        {
            
GetEntityClassname(weaponsWeaponNamesizeof(sWeaponName));
            if (
StrEqual(sWeaponName"weapon_flashbang"))
            {
                if (
buttons IN_ATTACK)
                {
                    
buttons &= ~IN_ATTACK;
                    return 
Plugin_Changed;
                }
            }
        }
    }
    
    return 
Plugin_Continue;


Last edited by Ilusion9; 06-01-2020 at 09:11.
Ilusion9 is offline
PeaceJS
New Member
Join Date: Jun 2020
Old 06-01-2020 , 09:16   Re: [HELP]CSGO Block the attack on flashbang
Reply With Quote #3

Quote:
Originally Posted by Ilusion9 View Post
PHP Code:
public Action OnPlayerRunCmd(int clientint &buttonsint &impulsefloat vel[3], float angles[3], int &weaponint &subtypeint &cmdnumint &tickcountint &seedint mouse[2])
{
    
char sWeaponName[32];
    if (
IsPlayerAlive(client))
    {
        
int weapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
        if (
weapon != -1)
        {
            
GetEntityClassname(weaponsWeaponNamesizeof(sWeaponName));
            if (
StrEqual(sWeaponName"weapon_flashbang"))
            {
                if (
buttons IN_ATTACK)
                {
                    
buttons &= ~IN_ATTACK;
                    return 
Plugin_Changed;
                }
            }
        }
    }
    
    return 
Plugin_Continue;

Thanks for your answer, sadly i tried that method already and i didnt like the glitch which happens if you press attack.
PeaceJS is offline
Reply


Thread Tools
Display Modes

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 11:06.


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