Quote:
Originally Posted by Crasher_3637
The WeaponHandling API is already pretty direct with what you want. It hooks all the functions of the player's weapon and allows users to change the speed of those functions.
You can do something like this:
PHP Code:
#include <sourcemod>
#include <WeaponHandling>
public void WH_OnReloadModifier(int client, int weapon, L4D2WeaponType weapontype, float &speedmodifier)
{
switch (weapontype)
{
case L4D2WeaponType_Pumpshotgun, L4D2WeaponType_PumpshotgunChrome: speedmodifier = speedmodifier * 1.25; // 25% faster reload
case L4D2WeaponType_Autoshotgun, L4D2WeaponType_AutoshotgunSpas: speedmodifier = speedmodifier * 1.25; // 25% faster reload
case L4D2WeaponType_HuntingRifle: speedmodifier = speedmodifier * 1.5; // 50% faster reload
case L4D2WeaponType_SniperMilitary, L4D2WeaponType_SniperAwp, L4D2WeaponType_SniperScout: speedmodifier = speedmodifier * 1.5; // 50% faster reload
}
}
public void WH_OnGetRateOfFire(int client, int weapon, L4D2WeaponType weapontype, float &speedmodifier)
{
switch (weapontype)
{
case L4D2WeaponType_HuntingRifle: speedmodifier = speedmodifier * 1.25; // 25% faster fire rate
case L4D2WeaponType_SniperMilitary, L4D2WeaponType_SniperAwp, L4D2WeaponType_SniperScout: speedmodifier = speedmodifier * 1.25; // 25% faster fire rate
}
}
The speed modifier is automatically applied for those two specific situations (reloading and rate of fire) so you don't have to remove the modifier "whenever anything else happens" because the WeaponHandling API takes care of all that.
|
You have no idea how thankful I am. I've been looking for a plugin that does exactly this (on and off, half-assedly) since 2017. I was literally writing up a request about this until I decided to take yet another look at previous post mentioning shotguns reload before submitting. The fact this this was never made before baffles me.