View Single Post
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 01-23-2018 , 14:17   Re: Disable stab/normal hit with knife?
Reply With Quote #2

Maybe something like this
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

// Integers
int m_flNextSecondaryAttack;

public 
void OnPluginStart()
{
    
// Find
    
m_flNextSecondaryAttack FindSendPropInfo("CBaseCombatWeapon""m_flNextSecondaryAttack");
}

// Set Client Hooks
public void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_PreThinkOnPreThink);
}

public 
Action OnPreThink(int client)
{
    
int iWeapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");

    if (!
IsValidEdict(weapon))
    {
        return;
    }

    
char classname[MAX_NAME_LENGTH];
    if (
GetEdictClassname(weaponclassnamesizeof(classname)) || StrEqual(classname"weapon_knife"))
    {
        
SetEntDataFloat(weaponm_flNextSecondaryAttackGetGameTime() + 1.0); // block secondary attack
    
}

    return 
Plugin_Continue;

__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 01-23-2018 at 14:19.
Franc1sco is offline
Send a message via MSN to Franc1sco