Sorry for late response
PHP Code:
//To block attack
CreateTimer(0.3, Timer_BlockAttack, client, TIMER_REPEAT);
//
public Action Timer_BlockAttack(Handle t, int client)
{
if(...)
{
return Plugin_Handled;//allow attack
}
BlockAttack(client);
return Plugin_Continue;
}
void BlockAttack(int client)
{
int weapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon");
if (IsValidEntity(weapon))
{
char sClass[32];
GetEntityClassname(weapon, sClass, sizeof(sClass));
if (StrContains(sClass, "weapon_", false) > -1)
{
SetEntPropFloat(weapon, Prop_Send, "m_flNextPrimaryAttack", GetGameTime() + 0.5);
SetEntPropFloat(weapon, Prop_Send, "m_flNextSecondaryAttack", GetGameTime() + 0.5);
}
}
}
__________________