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(client, SDKHook_PreThink, OnPreThink);
}
public Action OnPreThink(int client)
{
int iWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
if (!IsValidEdict(weapon))
{
return;
}
char classname[MAX_NAME_LENGTH];
if (GetEdictClassname(weapon, classname, sizeof(classname)) || StrEqual(classname, "weapon_knife"))
{
SetEntDataFloat(weapon, m_flNextSecondaryAttack, GetGameTime() + 1.0); // block secondary attack
}
return Plugin_Continue;
}
__________________