-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMain.cs
More file actions
42 lines (30 loc) · 1.33 KB
/
Main.cs
File metadata and controls
42 lines (30 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using Microsoft.Extensions.Logging;
namespace RapidFireFix;
public class RapidFireFix : BasePlugin
{
public override string ModuleName => "Rapid Fire Fix";
public override string ModuleVersion => "1.0.1";
public override string ModuleAuthor => "jon";
[GameEventHandler]
public HookResult OnBulletImpact(EventBulletImpact evt, GameEventInfo info)
{
if (evt.Userid?.Pawn?.Value?.WeaponServices?.ActiveWeapon?.Value == null)
return HookResult.Continue;
CBasePlayerWeapon firedWeapon = evt.Userid.Pawn.Value.WeaponServices.ActiveWeapon.Value!;
CCSWeaponBaseVData? weaponData = firedWeapon.GetVData<CCSWeaponBaseVData>();
if (weaponData == null)
return HookResult.Continue;
int tickBase = (int)evt.Userid.TickBase;
int fixedPrimaryTick = (int)Math.Round(weaponData.CycleTime.Values[0] * 64) - 3;
firedWeapon.NextPrimaryAttackTick = Math.Max(firedWeapon.NextPrimaryAttackTick, tickBase + fixedPrimaryTick);
// R8 force fix
if (firedWeapon.DesignerName == "weapon_revolver")
{
int fixedSecondaryTick = (int)Math.Round(weaponData.CycleTime.Values[1] * 64) - 3;
firedWeapon.NextSecondaryAttackTick = Math.Max(firedWeapon.NextSecondaryAttackTick, tickBase + fixedSecondaryTick);
}
return HookResult.Continue;
}
}