#include <sdktools_functions>
#include <sdkhooks>
#pragma newdecls required
#pragma semicolon 1
public Plugin myinfo =
{
name = "Fast Weapon Reload",
author = "asdf",
version = "1.0"
}
public void OnEntityCreated(int entity, const char[] classname)
{
if(strncmp(classname, "weapon_", 7) == 0)
SDKHook(entity, SDKHook_ReloadPost, WeaponReloadPost);
}
public void WeaponReloadPost(int weapon, bool bSuccess)
{
if(!bSuccess)
return;
int client = GetEntPropEnt(weapon, Prop_Data, "m_hOwner");
if(client == -1)
return;
int viewmodel = GetEntPropEnt(client, Prop_Data, "m_hViewModel");
if(viewmodel != -1)
SetEntPropFloat(viewmodel, Prop_Data, "m_flPlaybackRate", 10.0);
SetEntPropFloat(weapon, Prop_Data, "m_flPlaybackRate", 10.0);
float nextattack = GetEntPropFloat(weapon, Prop_Data, "m_flNextPrimaryAttack")-GetGameTime();
SetEntPropFloat(weapon, Prop_Data, "m_flNextPrimaryAttack", (nextattack/10.0)+GetGameTime());
nextattack = GetEntPropFloat(client, Prop_Data, "m_flNextAttack")-GetGameTime();
SetEntPropFloat(client, Prop_Data, "m_flNextAttack", (nextattack/10.0)+GetGameTime());
}