public OverlayForm() { InitializeComponent(); // ANTI BATTLEYE SIG SCAN ;) this.Text = Guid.NewGuid().ToString().Replace("-", ""); // TRANSPARENCY KEY this.BackColor = System.Drawing.Color.Black; // SETTINGS this.FormBorderStyle = FormBorderStyle.None; this.ShowIcon = false; this.ShowInTaskbar = false; this.TopMost = true; this.WindowState = FormWindowState.Maximized; // MAKE WINDOW TRANSPARENT Win32.SetWindowLong(this.Handle, Win32.GWL_EXSTYLE, (IntPtr)(Win32.GetWindowLong(this.Handle, Win32.GWL_EXSTYLE) ^ Win32.WS_EX_LAYERED ^ Win32.WS_EX_TRANSPARENT)); // MAKE WINDOW SOLID Win32.SetLayeredWindowAttributes(this.Handle, 0, 255, Win32.LWA_ALPHA); var targetProperties = new HwndRenderTargetProperties { Hwnd = this.Handle, PixelSize = new Size2(this.Bounds.Right - this.Bounds.Left, this.Bounds.Bottom - this.Bounds.Top), PresentOptions = PresentOptions.Immediately }; var prop = new RenderTargetProperties(RenderTargetType.Hardware, new PixelFormat(Format.B8G8R8A8_UNorm, SharpDX.Direct2D1.AlphaMode.Premultiplied), 0, 0, RenderTargetUsage.None, FeatureLevel.Level_DEFAULT); var d3dFactory = new SharpDX.Direct2D1.Factory(); var device = new WindowRenderTarget(d3dFactory, prop, targetProperties) { TextAntialiasMode = TextAntialiasMode.Cleartype, AntialiasMode = AntialiasMode.Aliased }; var dxthread = new Thread(() => { var brushWhite = new SolidColorBrush(device, RawColorFromColor(Color.White)); var brushBlack = new SolidColorBrush(device, RawColorFromColor(Color.Black)); var brushGreen = new SolidColorBrush(device, RawColorFromColor(Color.Green)); var brushRed = new SolidColorBrush(device, RawColorFromColor(Color.Red)); var brushPurple = new SolidColorBrush(device, RawColorFromColor(Color.Purple)); var fontFactory = new SharpDX.DirectWrite.Factory(); var fontConsolas = new SharpDX.DirectWrite.TextFormat(fontFactory, "Consolas", 15); var fontESP = new SharpDX.DirectWrite.TextFormat(fontFactory, "Consolas", 10); while (true) { device.BeginDraw(); device.Clear(null); if (CheatSettings.Visuals) { var ulocalplayer = G.OwningGameInstance.LocalPlayer; var localplayer = AActor.GetLocalPlayer(); var vecLocalLocation = localplayer.Location; //DrawText($"BodyHitImpact: {localplayer.WeaponProcessor.EquippedWeapons.ReadValue(0, true).WeaponConfig.PhysicalBodyHitImpactPower}", 50, 50, brushWhite, fontFactory, fontESP, device); #region RADAR int radarX = 20; int radarY = 140; int radarSize = 200; int radarBorder = 1; Vector2 centerpoint = new Vector2(radarX + radarSize / 2, radarY + radarSize / 2); // TODO: INTEGRATE INTO MINIMAP if (CheatSettings.RadarESP) { var radarOuterRectangle = new RawRectangleF(radarX, radarY, radarX + radarSize, radarY + radarSize); var radarRectangle = new RawRectangleF(radarX + radarBorder, radarY + radarBorder, radarX + radarSize - radarBorder, radarY + radarSize - radarBorder); var radarCenterRectangle = new RoundedRectangle() { RadiusX = 4, RadiusY = 4, Rect = new RawRectangleF(centerpoint.X, centerpoint.Y, centerpoint.X + 4, centerpoint.Y + 4) }; device.FillRectangle(radarRectangle, brushBlack); device.DrawRectangle(radarRectangle, brushWhite); device.FillRoundedRectangle(radarCenterRectangle, brushGreen); } #endregion #region DEBUG if (CheatSettings.LogIDs) { foreach (var Actor in G.Entities.ToList()) { var vecActorLocation = Actor.Location; var vecRelativePos = vecLocalLocation - vecActorLocation; Vector2 screenlocation; WorldToScreen(vecActorLocation, ulocalplayer.PlayerController.PlayerCameraManager, out screenlocation); DrawText($"[{Actor.Id}] {G.Names[Actor.Id]}", (int)screenlocation.X, (int)screenlocation.Y, brushWhite, fontFactory, fontESP, device); } } #endregion #region VEHICLE ESP if (CheatSettings.VehicleESP) { foreach (var Actor in G.Vehicles.ToList()) { var vecActorLocation = Actor.Location; var vecRelativePos = vecLocalLocation - vecActorLocation; var lDeltaInMeters = vecRelativePos.Length / 100; Vector2 screenlocation; WorldToScreen(vecActorLocation, ulocalplayer.PlayerController.PlayerCameraManager, out screenlocation); /* * UAZ: 76152 - 76156 - 76166 - 76165 * Dacia: 75657 - 75653 - 75665 - 75679 * Buggy: 75371 - 75375 - 75379 * Jeep: 76157 * Motorbike: 75820 * Boat: 75301 */ string szVehicleName = string.Empty; switch (Actor.Id) { /*UAZ*/ case 76152: case 76156: case 76166: case 76165: case 76169: szVehicleName = "UAZ"; break; /*Dacia*/ case 75657: case 75653: case 75665: case 75679: case 75675: szVehicleName = "Dacia"; break; /*Buggy*/ case 75371: case 75375: case 75379: case 75401: szVehicleName = "Buggy"; break; /*Jeep*/ case 76157: szVehicleName = "Jeep"; break; /*Boat*/ case 75301: szVehicleName = "Boat"; break; /*Motorbike*/ case 75820: szVehicleName = "Motorbike"; break; } if (szVehicleName != string.Empty) { DrawText($"[{szVehicleName}] {(int)lDeltaInMeters}m", (int)screenlocation.X, (int)screenlocation.Y, brushRed, fontFactory, fontESP, device); } } } #endregion #region LOOT ESP // Doesnt work if (CheatSettings.LootESP) { foreach (var DroppedItemGroup in G.Entities.ToList().Where(x => x.IsDroppedItemGroup)) { TArray <pADroppedItem> array = DroppedItemGroup.DroppedItemArray; for (int nIndex = 0; nIndex < array.Count; nIndex++) { var item = array.ReadValue(nIndex, false); var actor = M.Read <AActor>(item.pActor); if (actor.IsDroppedItemInteractionComponent) { var vecItemLocation = DroppedItemGroup.RootComponent.RelativeLocation + M.Read <Vector3>(actor.BasePointer + 0x0230); var pUItem = M.Read <IntPtr>(actor.BasePointer + 0x0220); string szName = M.Read <FText>(pUItem + 0x0040).fstring.ToString(); Vector2 screenlocation; WorldToScreen(vecItemLocation, ulocalplayer.PlayerController.PlayerCameraManager, out screenlocation); DrawText(szName, (int)screenlocation.X, (int)screenlocation.Y, brushWhite, fontFactory, fontESP, device); Console.WriteLine($"Drawing {szName}/{G.Names[actor.Id]} at {vecItemLocation}"); } } } } #endregion #region PlAYER LOOP if (CheatSettings.DistanceESP || CheatSettings.RadarESP || CheatSettings.LineESP) { var vecLocalEyeLocation = localplayer.EyeLocation; var myangles = ulocalplayer.PlayerController.ControlRotation; foreach (var player in G.Players.ToList()) { var vecPlayerLocation = player.Location; var vecRelativePos = vecLocalLocation - vecPlayerLocation; var lDeltaInMeters = vecRelativePos.Length / 100; #region Line ESP if (CheatSettings.LineESP) { Vector2 screenlocation; WorldToScreen(vecPlayerLocation, ulocalplayer.PlayerController.PlayerCameraManager, out screenlocation); device.DrawLine(new RawVector2(1920 / 2, 1080), new RawVector2(screenlocation.X, screenlocation.Y), brushWhite); } #endregion #region Distance ESP if (CheatSettings.DistanceESP) { Vector2 screenlocation; WorldToScreen(vecPlayerLocation, ulocalplayer.PlayerController.PlayerCameraManager, out screenlocation); DrawText($"[Player] {(int)lDeltaInMeters}m", (int)screenlocation.X, (int)screenlocation.Y, brushPurple, fontFactory, fontESP, device); } #endregion #region Radar if (CheatSettings.RadarESP) { if (lDeltaInMeters <= radarSize / 2 /*DISTANCE FROM CENTER TO EDGE*/) { Vector2 screenpos = centerpoint + vecRelativePos.To2D() / 100; var radarPlayerRectangle = new RoundedRectangle() { RadiusX = 4, RadiusY = 4, Rect = new RawRectangleF(screenpos.X, screenpos.Y, screenpos.X + 5, screenpos.Y + 5) }; // DRAW ENEMY device.FillRoundedRectangle(radarPlayerRectangle, brushRed); } } #endregion } } #endregion } // DRAW END device.EndDraw(); Thread.Sleep(1000 / 60); } }); dxthread.IsBackground = true; dxthread.Start(); var marg = new Win32.Margins(); marg.Left = 0; marg.Top = 0; marg.Right = this.Width; marg.Bottom = this.Height; Win32.DwmExtendFrameIntoClientArea(this.Handle, ref marg); }
public static void MainLoop() { while (true) { Cheat.Update(); AActor localplayer = AActor.GetLocalPlayer(); #region Weapon Mods if (CheatSettings.InfiniteAmmo || CheatSettings.NoRecoil || CheatSettings.NoSpread || CheatSettings.MagicBullets) { AWeaponProcessor WeaponProcessor = localplayer.WeaponProcessor; TArray <ATslWeapon> EquippedWeapons = WeaponProcessor.EquippedWeapons; for (int nItemSlot = 0; nItemSlot < 3; nItemSlot++) { var Weapon = EquippedWeapons.ReadValue(nItemSlot, true); Weapon.BasePointer = M.Read <IntPtr>(EquippedWeapons[nItemSlot]); if (Weapon.BasePointer == IntPtr.Zero) { continue; } FTrajectoryWeaponData TrajectoryConfig = Weapon.TrajectoryConfig; FWeaponGunData WeaponGunConfig = Weapon.WeaponGunConfig; FWeaponData WeaponConfig = Weapon.WeaponConfig; FRecoilInfo RecoilInfo = Weapon.RecoilInfo; FWeaponGunAnim WeaponGunAnim = Weapon.WeaponGunAnim; FWeaponDeviationData WeaponDeviationConfig = Weapon.WeaponDeviationConfig; if (CheatSettings.InfiniteAmmo) { Weapon.SetAmmoInClip(999); } if (CheatSettings.MagicBullets) { WeaponGunConfig.TimeBetweenShots = 0.03f; } if (CheatSettings.FullAuto) { Weapon.SetFiringMode(0, EFiringMode.FullAuto); } if (CheatSettings.NoMuzzle) { WeaponGunAnim.CharacterFire = IntPtr.Zero; } if (CheatSettings.NoSway) { WeaponConfig.SwayModifier_Crouch = 0; WeaponConfig.SwayModifier_Movement = 0; WeaponConfig.SwayModifier_Pitch = 0; WeaponConfig.SwayModifier_Prone = 0; WeaponConfig.SwayModifier_Stand = 0; WeaponConfig.SwayModifier_YawOffset = 0; } if (CheatSettings.InstantHit) { TrajectoryConfig.InitialSpeed = float.MaxValue; Weapon.SetBulletGravity(0f); } if (CheatSettings.NoRecoil) { // TRAJECTORY CONFIG TrajectoryConfig.RecoilPatternScale = 0; TrajectoryConfig.RecoilRecoverySpeed = 0; TrajectoryConfig.RecoilSpeed = 0; // RECOIL INFO RecoilInfo.VerticalRecoilMin = 0; RecoilInfo.VerticalRecoilMax = 0; RecoilInfo.RecoilValue_Climb = 0; RecoilInfo.RecoilValue_Fall = 0; RecoilInfo.RecoilModifier_Stand = 0; RecoilInfo.RecoilModifier_Crouch = 0; RecoilInfo.RecoilModifier_Prone = 0; RecoilInfo.RecoilSpeed_Horizontal = 0; RecoilInfo.RecoilSpeed_Vertical = 0; RecoilInfo.RecoverySpeed_Vertical = 0; RecoilInfo.VerticalRecoveryModifier = 0; // WEAPON GUN ANIM WeaponGunAnim.ShotCameraShake = IntPtr.Zero; WeaponGunAnim.ShotCameraShakeADS = IntPtr.Zero; WeaponGunAnim.ShotCameraShakeIronsight = IntPtr.Zero; } if (CheatSettings.NoSpread) { // TRAJECTORY CONFIG TrajectoryConfig.WeaponSpread = 0; TrajectoryConfig.AimingSpreadModifier = 0; TrajectoryConfig.FiringSpreadBase = 0; TrajectoryConfig.ProneRecoveryTime = 0; TrajectoryConfig.ScopingSpreadModifier = 0; // WEAPON GUN CONFIG WeaponGunConfig.FiringBulletsSpread = 0; // WEAPON DEVIATION CONFIG WeaponDeviationConfig.DeviationBase = 0; WeaponDeviationConfig.DeviationBaseADS = 0; WeaponDeviationConfig.DeviationBaseAim = 0; WeaponDeviationConfig.DeviationMax = 0; WeaponDeviationConfig.DeviationMaxMove = 0; WeaponDeviationConfig.DeviationMinMove = 0; WeaponDeviationConfig.DeviationMoveMaxReferenceVelocity = 0; WeaponDeviationConfig.DeviationMoveMinReferenceVelocity = 0; WeaponDeviationConfig.DeviationMoveMultiplier = 0; WeaponDeviationConfig.DeviationRecoilGain = 0; WeaponDeviationConfig.DeviationRecoilGainADS = 0; WeaponDeviationConfig.DeviationRecoilGainAim = 0; WeaponDeviationConfig.DeviationStanceCrouch = 0; WeaponDeviationConfig.DeviationStanceJump = 0; WeaponDeviationConfig.DeviationStanceProne = 0; WeaponDeviationConfig.DeviationStanceStand = 0; // ATslWeapon Weapon.SetRecoilSpreadScale(0f); Weapon.SetRunSpread(0f); Weapon.SetWalkSpread(0f); Weapon.SetJumpSpread(0f); } // WRITE WEAPON INFORMATION Weapon.WriteStruct(RecoilInfo); Weapon.WriteStruct(TrajectoryConfig); Weapon.WriteStruct(WeaponGunConfig); Weapon.WriteStruct(WeaponGunAnim); Weapon.WriteStruct(WeaponDeviationConfig); } } #endregion #region Mass TP if (CheatSettings.MassTeleport) { var location = localplayer.RootComponent.RelativeLocation; location.X += 100; location.Y += 100; location.Z += 50; foreach (var player in G.Players.ToList()) { if ((location - player.Location).Length <= 10000) { USceneComponent.SetLocation(player.pRootComponent, location); } } } #endregion #region Miscelanneous if (CheatSettings.Flying) { M.Write <byte>((byte)EMovementMode.MOVE_Flying, localplayer.pCharacterMovement + 0x01B4); // MovementMode } #endregion #region Aimbot if (CheatSettings.Aimbot) { var myplayercontroller = G.OwningGameInstance.LocalPlayer.PlayerController; var vecLocalEyeLocation = myplayercontroller.PlayerCameraManager.CameraCache.POV.Location; var angLocalAngles = myplayercontroller.ControlRotation; float flFov = 90f; FRotator flBestAngDelta = new FRotator(); bool bFoundTarget = false; foreach (var Player in G.Players.ToList()) { var vecTargetCenterOfMass = Player.Location; switch (Player.CharacterMovement.Stance) { case EStanceMode.STANCE_Stand: vecTargetCenterOfMass.Z += 30; break; case EStanceMode.STANCE_Crouch: vecTargetCenterOfMass.Z += 10; break; case EStanceMode.STANCE_Prone: vecTargetCenterOfMass.Z -= 15; break; } var delta = vecTargetCenterOfMass - vecLocalEyeLocation; var angDelta = (delta.ToFRotator() - angLocalAngles).Clamp(); if (angDelta.Length <= flFov) { flFov = (float)angDelta.Length; flBestAngDelta = angDelta; bFoundTarget = true; } } // TODO: Keyboard Hook if (bFoundTarget && (Win32.GetAsyncKeyState(Keys.XButton1) & 0x8000) != 0) // ADD HOLD KEY OR WHATEVER { M.Write <FRotator>(angLocalAngles + flBestAngDelta, G.OwningGameInstance.LocalPlayer.pPlayerController + 0x03B8); } } #endregion // Increase for speed, decrease for performance. Thread.Sleep(5); } }