PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
const MAX_PLAYERS = 32
#define m_pActiveItem 373
#define XO_CBASEPLAYERWEAPON 4
#define m_flNextPrimaryAttack 46
const NOFIRE_WEAPS_BITSUM = (1<<CSW_KNIFE) | (1<<CSW_HEGRENADE) | (1<<CSW_FLASHBANG) | (1 << CSW_SMOKEGRENADE) | (1<<CSW_C4)
new P_Cvars[CSW_P90 + 1], amx_speed_mode, amx_speed_all
new g_iCurWeapon[ MAX_PLAYERS + 1 char ]
new g_iCurAmmo[ MAX_PLAYERS + 1 char ]
// This is not used is this plugin
stock Float:g_flDefaultDelays[ CSW_P90 + 1 ] =
{
-1.0,
0.2, // CSW_P228
-1.0,
1.25, // CSW_SCOUT
-1.0, // CSW_HEGRENADE
0.25, // CSW_XM1014
-1.0, // CSW_C4
0.07, // CSW_MAC10
0.135, // CSW_AUG
-1.0, // CSW_SMOKEGRENADE
0.2, // CSW_ELITE
0.2, // CSW_FIVESEVEN
0.1, // CSW_UMP45
0.25, // CSW_SG550
0.0875, // CSW_GALIL
0.0825, // CSW_FAMAS
0.225, // CSW_USP
0.2, // CSW_GLOCK18
1.45, // CSW_AWP
0.075, // CSW_MP5NAVY
0.1, // CSW_M249
0.875, // CSW_M3
0.0875, // CSW_M4A1
0.07, // CSW_TMP
0.25, // CSW_G3SG1
-1.0, // CSW_FLASHBANG
0.3, // CSW_DEAGLE
0.135, // CSW_SG552
0.0955, // CSW_AK47
-1.0, // CSW_KNIFE
0.066, // CSW_P90
}
public plugin_init()
{
register_plugin("Fire Rate Control", "1.10", "Fxfighter") // version 1.10 by ConnorMcLeod, find version 1.08 here : http://forums.alliedmods.net/showthread.php?t=68382
register_event("CurWeapon","Event_CurWeapon", "be", "1=1", "3!-1")
amx_speed_mode = register_cvar("amx_speed_mode", "1")
amx_speed_all = register_cvar("amx_speed_all", "1.0")
new szCvarName[32] = "amx_speed_", szWeaponName[32]
for(new iId = CSW_P90; iId <= CSW_P90; iId++)
{
if( ~NOFIRE_WEAPS_BITSUM & (1<<iId) && get_weaponname(iId, szWeaponName, charsmax(szWeaponName)) )
{
copy(szCvarName[10], charsmax(szCvarName)-10, szWeaponName[7])
P_Cvars[ iId ] = register_cvar(szCvarName, "1.0")
}
}
}
public Event_CurWeapon(id)
{
new iSpeedMode = get_pcvar_num(amx_speed_mode)
if( ! iSpeedMode )
{
return
}
new Gun = read_data(2)
if( NOFIRE_WEAPS_BITSUM & 1<<Gun )
{
return
}
if(g_iCurWeapon{id} != Gun)
{
g_iCurWeapon{id} = Gun
return
}
new Ammo = read_data(3)
if( g_iCurAmmo{id} == Ammo )
{
return
}
g_iCurAmmo{id} = Ammo
static Float:N_Speed
if(iSpeedMode == 1)
{
N_Speed = get_pcvar_float( amx_speed_all )
}
else
{
N_Speed = get_pcvar_float(P_Cvars[Gun])
}
if(N_Speed != 1.0 && N_Speed > 0.0)
{
new Ent = get_pdata_cbase(id, m_pActiveItem)
if(Ent > 0)
{
set_pdata_float( Ent, m_flNextPrimaryAttack, get_pdata_float( Ent, m_flNextPrimaryAttack, XO_CBASEPLAYERWEAPON) * N_Speed, XO_CBASEPLAYERWEAPON)
}
}
}