PHP Code:
#include <left4dhooks>
bool IsWeaponReadyToFire(int weapon)
{
float game_time = GetGameTime();
float atk_time = GetEntPropFloat(weapon, Prop_Send, "m_flNextPrimaryAttack");
float interval = atk_time - game_time;
static char weapon_name[32];
GetEntityClassname(weapon, weapon_name, sizeof(weapon_name));
float cycle = L4D2_GetFloatWeaponAttribute(weapon_name, L4D2FWA_CycleTime);
bool is_ready_to_fire = interval <= cycle;
// PrintToChatAll("%.2f %.2f %.2f %.2f %d", game_time, atk_time, interval, cycle, is_ready_to_fire);
return is_ready_to_fire;
}
If you just need to check whether a weapon is able to fire, this should work.
__________________