Guest User

Untitled

a guest
Dec 8th, 2018
474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Numerics;
  4. using System.Threading;
  5. using System.Collections.Generic;
  6.  
  7. using strictexternal.Other;
  8. using strictexternal.Managers;
  9.  
  10. using Math = strictexternal.Other.Math;
  11.  
  12. namespace strictexternal.Features
  13. {
  14. internal class Aimbot
  15. {
  16. // TODO LIST:
  17. // -Visibility Check (Not that important)
  18. // -Weapon Check
  19.  
  20. public static void Run()
  21. {
  22. while (true)
  23. {
  24. Thread.Sleep(Settings.Aimbot.Smooth == 0f ? 1 : 45);
  25.  
  26. if (!Convert.ToBoolean((long)Globals.Imports.GetAsyncKeyState(System.Windows.Forms.Keys.LButton) & 0x8000)
  27. || Convert.ToBoolean((long)Globals.Imports.GetAsyncKeyState(Settings.Trigger.Key) & 0x8000)
  28. || !Checks.IsIngame
  29. || !Structs.LocalPlayer.Health.IsAlive()) continue;
  30.  
  31. int maxPlayers = Structs.ClientState.MaxPlayers;
  32.  
  33. byte[] entities = MemoryManager.ReadMemory((int)Structs.Base.Client + Offsets.dwEntityList, maxPlayers * 0x10);
  34.  
  35. Dictionary<float, Vector3> possibleTargets = new Dictionary<float, Vector3> { };
  36.  
  37. for (int i = 0; i < maxPlayers; i++)
  38. {
  39. int cEntity = Math.GetInt(entities, i * 0x10);
  40.  
  41. Structs.Enemy_t entityStruct = MemoryManager.ReadMemory<Structs.Enemy_t>(cEntity);
  42.  
  43. if (!entityStruct.Team.HasTeam()
  44. || entityStruct.Team.IsMyTeam()
  45. || !entityStruct.Health.IsAlive()
  46. || entityStruct.Dormant) continue;
  47.  
  48. Vector3 bonePosition = Extensions.Other.GetBonePos(cEntity, Settings.Aimbot.Bone);
  49.  
  50. if (bonePosition == Vector3.Zero) continue;
  51.  
  52. Vector3 destination = Settings.Aimbot.RecoilControl
  53. ? Math.CalcAngle(Structs.LocalPlayer.Position, bonePosition, Structs.LocalPlayer.AimPunch, Structs.LocalPlayer.VecView, Settings.Aimbot.YawRecoilReductionFactory, Settings.Aimbot.PitchRecoilReductionFactory)
  54. : Math.CalcAngle(Structs.LocalPlayer.Position, bonePosition, Structs.LocalPlayer.AimPunch, Structs.LocalPlayer.VecView, 0f, 0f);
  55.  
  56. if (destination == Vector3.Zero) continue;
  57.  
  58. float distance = Math.GetDistance3D(destination, Structs.ClientState.ViewAngles);
  59.  
  60. if (!(distance <= Settings.Aimbot.Fov)) continue;
  61.  
  62. possibleTargets.Add(distance, destination);
  63. }
  64.  
  65. if (!possibleTargets.Any()) continue;
  66.  
  67. Vector3 aimAngle = possibleTargets.OrderByDescending(x => x.Key).LastOrDefault().Value;
  68.  
  69. if (Settings.Aimbot.Curve)
  70. {
  71. Vector3 qDelta = aimAngle - Structs.ClientState.ViewAngles;
  72. qDelta += new Vector3(qDelta.Y / Settings.Aimbot.CurveY, qDelta.X / Settings.Aimbot.CurveX, qDelta.Z);
  73.  
  74. aimAngle = Structs.ClientState.ViewAngles + qDelta;
  75. }
  76.  
  77. aimAngle = Math.NormalizeAngle(aimAngle);
  78. aimAngle = Math.ClampAngle(aimAngle);
  79.  
  80. MemoryManager.WriteMemory<Vector3>(Structs.ClientState.Base + Offsets.dwClientState_ViewAngles, Settings.Aimbot.Smooth == 0f
  81. ? aimAngle
  82. : Math.SmoothAim(Structs.ClientState.ViewAngles, aimAngle, Settings.Aimbot.Smooth));
  83. }
  84. }
  85. }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment