prevent certain shotguns, and shotgun attachments from being used for no recoil detection

This commit is contained in:
RaidMax 2019-07-27 17:46:48 -05:00
parent f8505781a0
commit 06af995202
2 changed files with 27 additions and 14 deletions

View File

@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace IW4MAdmin.Plugins.Stats.Cheat
{
@ -198,7 +199,10 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
#endregion
#region RECOIL
var hitRecoilAverage = (hit.AnglesList.Sum(_angle => _angle.Z) + hit.ViewAngles.Z) / (hit.AnglesList.Count + 1);
float hitRecoilAverage = 0;
if (!Plugin.Config.Configuration().RecoilessWeapons.Any(_weaponRegex => Regex.IsMatch(hit.Weapon.ToString(), _weaponRegex)))
{
hitRecoilAverage = (hit.AnglesList.Sum(_angle => _angle.Z) + hit.ViewAngles.Z) / (hit.AnglesList.Count + 1);
sessionAverageRecoilAmount = (sessionAverageRecoilAmount * (HitCount - 1) + hitRecoilAverage) / HitCount;
var lifeTimeHits = ClientStats.HitLocations.Sum(_loc => _loc.HitCount);
@ -214,6 +218,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
Type = DetectionType.Recoil
});
}
}
#endregion
#region SESSION_RATIOS

View File

@ -9,6 +9,7 @@ namespace IW4MAdmin.Plugins.Stats.Config
public bool EnableAntiCheat { get; set; }
public List<StreakMessageConfiguration> KillstreakMessages { get; set; }
public List<StreakMessageConfiguration> DeathstreakMessages { get; set; }
public List<string> RecoilessWeapons { get; set; }
public int TopPlayersMinPlayTime { get; set; }
public bool StoreClientKills { get; set; }
public string Name() => "Stats";
@ -49,6 +50,13 @@ namespace IW4MAdmin.Plugins.Stats.Config
},
};
RecoilessWeapons = new List<string>()
{
"ranger.*_mp",
"model1887.*_mp",
".+shotgun.*_mp"
};
TopPlayersMinPlayTime = 3600 * 3;
StoreClientKills = false;