prevent "laggy" angles from being tracked
This commit is contained in:
parent
483b7917ac
commit
082776aca5
@ -106,7 +106,12 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
|
|||||||
lastHit = hit;
|
lastHit = hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastHit == hit || lastHit.VictimId != hit.VictimId || (hit.TimeOffset - lastHit.TimeOffset) >= 1000)
|
bool areAnglesInvalid = hit.AnglesList[0].Equals(hit.AnglesList[1]) && hit.AnglesList[3].Equals(hit.AnglesList[4]);
|
||||||
|
|
||||||
|
if ((lastHit == hit ||
|
||||||
|
lastHit.VictimId != hit.VictimId ||
|
||||||
|
(hit.TimeOffset - lastHit.TimeOffset) >= 1000) &&
|
||||||
|
!areAnglesInvalid)
|
||||||
{
|
{
|
||||||
ClientStats.SnapHitCount++;
|
ClientStats.SnapHitCount++;
|
||||||
sessionSnapHits++;
|
sessionSnapHits++;
|
||||||
@ -147,7 +152,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
|
|||||||
int angleOffsetIndex = totalUsableAngleCount / 2;
|
int angleOffsetIndex = totalUsableAngleCount / 2;
|
||||||
if (hit.AnglesList.Count == 5)
|
if (hit.AnglesList.Count == 5)
|
||||||
{
|
{
|
||||||
|
|
||||||
double realAgainstPredict = Vector3.ViewAngleDistance(hit.AnglesList[angleOffsetIndex - 1], hit.AnglesList[angleOffsetIndex + 1], hit.ViewAngles);
|
double realAgainstPredict = Vector3.ViewAngleDistance(hit.AnglesList[angleOffsetIndex - 1], hit.AnglesList[angleOffsetIndex + 1], hit.ViewAngles);
|
||||||
|
|
||||||
// LIFETIME
|
// LIFETIME
|
||||||
|
@ -34,6 +34,16 @@ namespace SharedLibraryCore.Helpers
|
|||||||
return $"({X}, {Y}, {Z})";
|
return $"({X}, {Y}, {Z})";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
if (obj is Vector3 vec)
|
||||||
|
{
|
||||||
|
return vec.X == X && vec.Y == Y && vec.Z == Z;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static Vector3 Parse(string s)
|
public static Vector3 Parse(string s)
|
||||||
{
|
{
|
||||||
bool valid = Regex.Match(s, @"\((-?[0-9]+\.?[0-9]*|-?[0-9]+\.?[0-9]*e-[0-9]+),\ (-?[0-9]+\.?[0-9]*|-?[0-9]+\.?[0-9]*e-[0-9]+),\ (-?[0-9]+\.?[0-9]*|-?[0-9]+\.?[0-9]*e-[0-9]+)\)").Success;
|
bool valid = Regex.Match(s, @"\((-?[0-9]+\.?[0-9]*|-?[0-9]+\.?[0-9]*e-[0-9]+),\ (-?[0-9]+\.?[0-9]*|-?[0-9]+\.?[0-9]*e-[0-9]+),\ (-?[0-9]+\.?[0-9]*|-?[0-9]+\.?[0-9]*e-[0-9]+)\)").Success;
|
||||||
|
Loading…
Reference in New Issue
Block a user