bool g_bBlock[MAXPLAYERS+1];
int g_iLastButtons[MAXPLAYERS+1];
int g_iLastWeapon[MAXPLAYERS+1];
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])
{
if ( g_bBlock[client] ) {
g_iLastWeapon[client] = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
SetEntPropFloat(client, Prop_Data, "m_flNextAttack", GetGameTime()+600.0);
}
if ( buttons & IN_ATTACK )
{
if ( !(g_iLastButtons[client] & IN_ATTACK) )
{
g_bBlock[client] = true;
}
}
else if ( g_iLastButtons[client] & IN_ATTACK )
{
if ( g_iLastWeapon[client] == GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon") ) {
SetEntPropFloat(client, Prop_Data, "m_flNextAttack", GetGameTime()+0.1);
g_bBlock[client] = false;
}
}
g_iLastButtons[client] = buttons;
}