fork download
  1. /////////////XTREME HACK////////////////
  2. ///////////unknowncheats.me/////////////
  3.  
  4. using System;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading;
  9. using System.Diagnostics;
  10. using System.Windows.Forms;
  11. using System.ComponentModel;
  12. using System.Collections.Generic;
  13.  
  14. using Factory = SharpDX.Direct2D1.Factory;
  15. using FontFactory = SharpDX.DirectWrite.Factory;
  16. using Format = SharpDX.DXGI.Format;
  17.  
  18. using SharpDX;
  19. using SharpDX.Windows;
  20. using SharpDX.Direct2D1;
  21. using SharpDX.DirectWrite;
  22. using System.Runtime.InteropServices;
  23.  
  24. namespace External_ESP_Base
  25. {
  26. public partial class Overlay : Form
  27. {
  28. // Process
  29. private Process process = null;
  30. private Thread updateStream = null, windowStream = null;
  31.  
  32. // Game Data
  33. private List<Player> players = null;
  34. private Player localPlayer = null;
  35. private Matrix viewProj, m_ViewMatrixInverse;
  36. private int spectatorCount = 0;
  37.  
  38. // Keys Control
  39. private KeysManager manager;
  40. // Handle
  41. private IntPtr handle;
  42.  
  43. // Color
  44. private Color enemyColor = new Color(255, 0, 0, 200),
  45. enemyColorVisible = new Color(255, 255, 0, 220),
  46. enemyColorVehicle = new Color(255, 129, 72, 200),
  47. enemySkeletonColor = new Color(245, 114, 0, 255),
  48. friendlyColor = new Color(0, 255, 0, 200),
  49. friendlyColorVehicle = new Color(64, 154, 200, 255),
  50. friendSkeletonColor = new Color(46, 228, 213, 255);
  51.  
  52. // Settings
  53. private bool ESP_Box = true,
  54. ESP_Bone = true,
  55. ESP_Health = false,
  56. ESP_Distance = false,
  57. ESP_Vehicle = true;
  58.  
  59. // SharpDX
  60. private WindowRenderTarget device;
  61. private HwndRenderTargetProperties renderProperties;
  62. private SolidColorBrush solidColorBrush;
  63. private Factory factory;
  64. private bool IsResize = false;
  65. private bool IsMinimized = false;
  66.  
  67. // SharpDX Font
  68. private TextFormat font, fontSmall;
  69. private FontFactory fontFactory;
  70. private const string fontFamily = "Calibri";
  71. private const float fontSize = 18.0f;
  72. private const float fontSizeSmall = 14.0f;
  73.  
  74. // Screen Size
  75. private Rectangle rect;
  76.  
  77. // Init
  78. public Overlay(Process process)
  79. {
  80. this.process = process;
  81. this.handle = Handle;
  82.  
  83. int initialStyle = Managed.GetWindowLong(this.Handle, -20);
  84. Managed.SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20);
  85.  
  86. IntPtr HWND_TOPMOST = new IntPtr(-1);
  87. const UInt32 SWP_NOSIZE = 0x0001;
  88. const UInt32 SWP_NOMOVE = 0x0002;
  89. const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE;
  90.  
  91. Managed.SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
  92. OnResize(null);
  93.  
  94. InitializeComponent();
  95. }
  96.  
  97. // Set window style
  98. protected override void OnResize(EventArgs e)
  99. {
  100. int[] margins = new int[] { 0, 0, rect.Width, rect.Height };
  101. Managed.DwmExtendFrameIntoClientArea(this.Handle, ref margins);
  102. }
  103.  
  104. // INIT
  105. private void DrawWindow_Load(object sender, EventArgs e)
  106. {
  107. this.TopMost = true;
  108. this.Visible = true;
  109. this.FormBorderStyle = FormBorderStyle.None;
  110. //this.WindowState = FormWindowState.Maximized;
  111. this.Width = rect.Width;
  112. this.Height = rect.Height;
  113.  
  114. // Window name
  115. this.Name = Process.GetCurrentProcess().ProcessName + "~Overlay";
  116. this.Text = Process.GetCurrentProcess().ProcessName + "~Overlay";
  117.  
  118. // Init factory
  119. factory = new Factory();
  120. fontFactory = new FontFactory();
  121.  
  122. // Render settings
  123. renderProperties = new HwndRenderTargetProperties()
  124. {
  125. Hwnd = this.Handle,
  126. PixelSize = new Size2(rect.Width, rect.Height),
  127. PresentOptions = PresentOptions.None
  128. };
  129.  
  130. // Init device
  131. device = new WindowRenderTarget(factory, new RenderTargetProperties(new PixelFormat(Format.B8G8R8A8_UNorm, AlphaMode.Premultiplied)), renderProperties);
  132.  
  133. // Init brush
  134. solidColorBrush = new SolidColorBrush(device, Color.White);
  135.  
  136. // Init font's
  137. font = new TextFormat(fontFactory, fontFamily, fontSize);
  138. fontSmall = new TextFormat(fontFactory, fontFamily, fontSizeSmall);
  139.  
  140. // Open process
  141. RPM.OpenProcess(process.Id);
  142.  
  143. // Init player array
  144. players = new List<Player>();
  145. localPlayer = new Player();
  146.  
  147. // Init update thread
  148. updateStream = new Thread(new ParameterizedThreadStart(Update));
  149. updateStream.Start();
  150.  
  151. // Init window thread (resize / position)
  152. windowStream = new Thread(new ParameterizedThreadStart(SetWindow));
  153. windowStream.Start();
  154.  
  155. // Init Key Listener
  156. manager = new KeysManager();
  157. manager.AddKey(Keys.F5);
  158. manager.AddKey(Keys.F6);
  159. manager.AddKey(Keys.F7);
  160. manager.AddKey(Keys.F8);
  161. manager.AddKey(Keys.F9);
  162. //manager.KeyUpEvent += new KeysManager.KeyHandler(KeyUpEvent);
  163. manager.KeyDownEvent += new KeysManager.KeyHandler(KeyDownEvent);
  164. }
  165.  
  166. // Key Down Event
  167. private void KeyDownEvent(int keyId, string keyName)
  168. {
  169. switch ((Keys)keyId)
  170. {
  171. case Keys.F5:
  172. this.ESP_Box = !this.ESP_Box;
  173. break;
  174. case Keys.F6:
  175. this.ESP_Bone = !this.ESP_Bone;
  176. break;
  177. case Keys.F7:
  178. this.ESP_Health = !this.ESP_Health;
  179. break;
  180. case Keys.F8:
  181. this.ESP_Distance = !this.ESP_Distance;
  182. break;
  183. case Keys.F9:
  184. this.ESP_Vehicle = !this.ESP_Vehicle;
  185. break;
  186. }
  187. }
  188.  
  189. // FPS Stats
  190. private static int lastTick;
  191. private static int lastFrameRate;
  192. private static int frameRate;
  193.  
  194. // Check is Game Run
  195. private bool IsGameRun()
  196. {
  197. foreach (Process p in Process.GetProcesses())
  198. {
  199. if (p.ProcessName == process.ProcessName)
  200. return true;
  201. }
  202. return false;
  203. }
  204.  
  205. // Update Thread
  206. private void Update(object sender)
  207. {
  208. while (IsGameRun())
  209. {
  210. // Resize
  211. if (IsResize)
  212. {
  213. device.Resize(new Size2(rect.Width, rect.Height));
  214. //Console.WriteLine("Resize {0}/{1}", rect.Width, rect.Height);
  215. IsResize = false;
  216. }
  217.  
  218. // Begin Draw
  219. device.BeginDraw();
  220. device.Clear(new Color4(0.0f, 0.0f, 0.0f, 0.0f));
  221.  
  222. // Check Window State
  223. if (!IsMinimized)
  224. {
  225. // Read & Draw Players
  226. Read();
  227.  
  228. // Draw Credits
  229. DrawTextCenter(rect.Width / 2 - 125, 5, 250, (int)font.FontSize, "EXTERNAL ESP BASE BY XTREME2010", new Color(255, 214, 0, 255), true);
  230.  
  231. // Draw Spectator Count
  232. DrawTextCenter(rect.Width / 2 - 100, rect.Height - (int)font.FontSize, 200, (int)font.FontSize, spectatorCount + " SPECTATOR(S) ON A SERVER", new Color(255, 214, 0, 255), true);
  233.  
  234. // Draw Menu
  235. DrawMenu(5, 5);
  236. }
  237.  
  238. // End Draw
  239. device.EndDraw();
  240. CalculateFrameRate();
  241. //Thread.Sleep(Interval);
  242. }
  243.  
  244. // Close Process
  245. RPM.CloseProcess();
  246. // Exit
  247. Environment.Exit(0);
  248. }
  249.  
  250. // Read Game Memorry
  251. private void Read()
  252. {
  253. // Reset Old Data
  254. players.Clear();
  255. localPlayer = new Player();
  256.  
  257. // Read Local
  258. #region Get Local Player
  259. Int64 pGContext = RPM.Read<Int64>(Offsets.ClientGameContext.GetInstance());
  260. if (!RPM.IsValid(pGContext))
  261. return;
  262.  
  263. Int64 pPlayerManager = RPM.Read<Int64>(pGContext + Offsets.ClientGameContext.m_pPlayerManager);
  264. if (!RPM.IsValid(pPlayerManager))
  265. return;
  266.  
  267. Int64 pLocalPlayer = RPM.Read<Int64>(pPlayerManager + Offsets.ClientPlayerManager.m_pLocalPlayer);
  268. if (!RPM.IsValid(pLocalPlayer))
  269. return;
  270.  
  271. //RPM.Read<Int64>(pLocalPlayer + Offsets.ClientPlayer.m_pControlledControllable);
  272. Int64 pLocalSoldier = GetClientSoldierEntity(pLocalPlayer, localPlayer);
  273. if (!RPM.IsValid(pLocalSoldier))
  274. return;
  275.  
  276. Int64 pHealthComponent = RPM.Read<Int64>(pLocalSoldier + Offsets.ClientSoldierEntity.m_pHealthComponent);
  277. if (!RPM.IsValid(pHealthComponent))
  278. return;
  279.  
  280. Int64 m_pPredictedController = RPM.Read<Int64>(pLocalSoldier + Offsets.ClientSoldierEntity.m_pPredictedController);
  281. if (!RPM.IsValid(m_pPredictedController))
  282. return;
  283.  
  284. // Health
  285. localPlayer.Health = RPM.Read<float>(pHealthComponent + Offsets.HealthComponent.m_Health);
  286. localPlayer.MaxHealth = RPM.Read<float>(pHealthComponent + Offsets.HealthComponent.m_MaxHealth);
  287.  
  288. if (localPlayer.Health <= 0.1f) // YOU DEAD :D
  289. return;
  290.  
  291. // Origin
  292. localPlayer.Origin = RPM.Read<Vector3>(m_pPredictedController + Offsets.ClientSoldierPrediction.m_Position);
  293.  
  294. // Other
  295. localPlayer.Team = RPM.Read<Int32>(pLocalPlayer + Offsets.ClientPlayer.m_teamId);
  296. //localPlayer.Name = RPM.ReadString(pLocalPlayer + Offsets.ClientPlayer.szName, 10);
  297. localPlayer.Pose = RPM.Read<Int32>(pLocalSoldier + Offsets.ClientSoldierEntity.m_poseType);
  298. localPlayer.Yaw = RPM.Read<float>(pLocalSoldier + Offsets.ClientSoldierEntity.m_authorativeYaw);
  299. localPlayer.IsOccluded = RPM.Read<Byte>(pLocalSoldier + Offsets.ClientSoldierEntity.m_occluded);
  300.  
  301. // Weapon Ammo
  302. if (localPlayer.InVehicle)
  303. {
  304. Int64 pCurrentWeaponFiring = RPM.Read<Int64>(Offsets.OFFSET_CURRENT_WEAPONFIRING);
  305. if (RPM.IsValid(pCurrentWeaponFiring))
  306. {
  307. // Ammo
  308. localPlayer.Ammo = RPM.Read<Int32>(pCurrentWeaponFiring + Offsets.WeaponFiring.m_projectilesLoaded);
  309. localPlayer.AmmoClip = RPM.Read<Int32>(pCurrentWeaponFiring + Offsets.WeaponFiring.m_projectilesInMagazines);
  310. }
  311. }
  312. else
  313. {
  314. Int64 pClientWeaponComponent = RPM.Read<Int64>(pLocalSoldier + Offsets.ClientSoldierEntity.m_soldierWeaponsComponent);
  315. if (RPM.IsValid(pClientWeaponComponent))
  316. {
  317. Int64 pWeaponHandle = RPM.Read<Int64>(pClientWeaponComponent + Offsets.ClientSoldierWeaponsComponent.m_handler);
  318. Int32 ActiveSlot = RPM.Read<Int32>(pClientWeaponComponent + Offsets.ClientSoldierWeaponsComponent.m_activeSlot);
  319.  
  320. if (RPM.IsValid(pWeaponHandle))
  321. {
  322. Int64 pSoldierWeapon = RPM.Read<Int64>(pWeaponHandle + ActiveSlot * 0x8);
  323. if (RPM.IsValid(pSoldierWeapon))
  324. {
  325. Int64 pCorrectedFiring = RPM.Read<Int64>(pSoldierWeapon + Offsets.ClientSoldierWeapon.m_pPrimary);
  326. if (RPM.IsValid(pCorrectedFiring))
  327. {
  328. // Ammo
  329. localPlayer.Ammo = RPM.Read<Int32>(pCorrectedFiring + Offsets.WeaponFiring.m_projectilesLoaded);
  330. localPlayer.AmmoClip = RPM.Read<Int32>(pCorrectedFiring + Offsets.WeaponFiring.m_projectilesInMagazines);
  331. }
  332. }
  333. }
  334. }
  335. }
  336. #endregion
  337.  
  338. // Render View
  339. Int64 pGameRenderer = RPM.Read<Int64>(Offsets.GameRenderer.GetInstance());
  340. Int64 pRenderView = RPM.Read<Int64>(pGameRenderer + Offsets.GameRenderer.m_pRenderView);
  341.  
  342. // Read Screen Matrix
  343. viewProj = RPM.Read<Matrix>(pRenderView + Offsets.RenderView.m_ViewProj);
  344. m_ViewMatrixInverse = RPM.Read<Matrix>(pRenderView + Offsets.RenderView.m_ViewMatrixInverse);
  345.  
  346. // Pointer to Players Array
  347. Int64 m_ppPlayer = RPM.Read<Int64>(pPlayerManager + Offsets.ClientPlayerManager.m_ppPlayer);
  348. if (!RPM.IsValid(m_ppPlayer))
  349. return;
  350.  
  351. // Reset
  352. spectatorCount = 0;
  353.  
  354. // Get Player by Id
  355. #region Get Player by Id
  356. for (uint i = 0; i < 70; i++)
  357. {
  358. // Create new Player
  359. Player player = new Player();
  360.  
  361. // Pointer to ClientPlayer class (Player Array + (Id * Size of Pointer))
  362. Int64 pEnemyPlayer = RPM.Read<Int64>(m_ppPlayer + (i * sizeof(Int64)));
  363. if (!RPM.IsValid(pEnemyPlayer))
  364. continue;
  365.  
  366. //if (pEnemyPlayer == pLocalPlayer)
  367. // continue;
  368.  
  369. player.IsSpectator = Convert.ToBoolean(RPM.Read<Byte>(pEnemyPlayer + Offsets.ClientPlayer.m_isSpectator));
  370.  
  371. if (player.IsSpectator)
  372. spectatorCount++;
  373.  
  374. // Name
  375. player.Name = RPM.ReadString(pEnemyPlayer + Offsets.ClientPlayer.szName, 10);
  376.  
  377. // RPM.Read<Int64>(pEnemyPlayer + Offsets.ClientPlayer.m_pControlledControllable);
  378. Int64 pEnemySoldier = GetClientSoldierEntity(pEnemyPlayer, player);
  379. if (!RPM.IsValid(pEnemySoldier))
  380. continue;
  381.  
  382. Int64 pEnemyHealthComponent = RPM.Read<Int64>(pEnemySoldier + Offsets.ClientSoldierEntity.m_pHealthComponent);
  383. if (!RPM.IsValid(pEnemyHealthComponent))
  384. continue;
  385.  
  386. Int64 pEnemyPredictedController = RPM.Read<Int64>(pEnemySoldier + Offsets.ClientSoldierEntity.m_pPredictedController);
  387. if (!RPM.IsValid(pEnemyPredictedController))
  388. continue;
  389.  
  390. // Health
  391. player.Health = RPM.Read<float>(pEnemyHealthComponent + Offsets.HealthComponent.m_Health);
  392. player.MaxHealth = RPM.Read<float>(pEnemyHealthComponent + Offsets.HealthComponent.m_MaxHealth);
  393.  
  394. if (player.Health <= 0.1f) // DEAD
  395. continue;
  396.  
  397. // Origin (Position in Game X, Y, Z)
  398. player.Origin = RPM.Read<Vector3>(pEnemyPredictedController + Offsets.ClientSoldierPrediction.m_Position);
  399.  
  400. // Other
  401. player.Team = RPM.Read<Int32>(pEnemyPlayer + Offsets.ClientPlayer.m_teamId);
  402. player.Pose = RPM.Read<Int32>(pEnemySoldier + Offsets.ClientSoldierEntity.m_poseType);
  403. player.Yaw = RPM.Read<float>(pEnemySoldier + Offsets.ClientSoldierEntity.m_authorativeYaw);
  404. player.IsOccluded = RPM.Read<Byte>(pEnemySoldier + Offsets.ClientSoldierEntity.m_occluded);
  405.  
  406. // Distance to You
  407. player.Distance = Vector3.Distance(localPlayer.Origin, player.Origin);
  408.  
  409. if (player.IsValid())
  410. {
  411. #region Bone ESP
  412. if (ESP_Bone)
  413. {
  414. // Player Bone
  415. if (GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_HEAD, out player.Bone.BONE_HEAD)
  416. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTELBOWROLL, out player.Bone.BONE_LEFTELBOWROLL)
  417. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTFOOT, out player.Bone.BONE_LEFTFOOT)
  418. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTHAND, out player.Bone.BONE_LEFTHAND)
  419. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTKNEEROLL, out player.Bone.BONE_LEFTKNEEROLL)
  420. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTSHOULDER, out player.Bone.BONE_LEFTSHOULDER)
  421. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_NECK, out player.Bone.BONE_NECK)
  422. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTELBOWROLL, out player.Bone.BONE_RIGHTELBOWROLL)
  423. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTFOOT, out player.Bone.BONE_RIGHTFOOT)
  424. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTHAND, out player.Bone.BONE_RIGHTHAND)
  425. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTKNEEROLL, out player.Bone.BONE_RIGHTKNEEROLL)
  426. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTSHOULDER, out player.Bone.BONE_RIGHTSHOULDER)
  427. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_SPINE, out player.Bone.BONE_SPINE)
  428. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_SPINE1, out player.Bone.BONE_SPINE1)
  429. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_SPINE2, out player.Bone.BONE_SPINE2))
  430. {
  431. DrawBone(player);
  432. }
  433. }
  434. #endregion
  435.  
  436. Vector3 w2sFoot, w2sHead;
  437. if (WorldToScreen(player.Origin, out w2sFoot) &&
  438. WorldToScreen(player.Origin, player.Pose, out w2sHead))
  439. {
  440. float H = w2sFoot.Y - w2sHead.Y;
  441. float W = H / 2;
  442. float X = w2sHead.X - W / 2;
  443.  
  444. #region ESP Color
  445. Color color;
  446. if (player.Team == localPlayer.Team) {
  447. color = friendlyColor;
  448. }
  449. else {
  450. color = player.IsVisible() ? enemyColorVisible : enemyColor;
  451. }
  452. #endregion
  453.  
  454. #region Draw ESP
  455. // ESP Box
  456. if (ESP_Box)
  457. {
  458. DrawAABB(player.GetAABB(), player.Origin, player.Yaw, color);
  459. //DrawRect((int)X, (int)Head.Y, (int)BoxWidth, (int)HeadToFoot, color);
  460. }
  461.  
  462. // ESP Vehicle
  463. if (ESP_Vehicle)
  464. {
  465. DrawAABB(player.VehicleAABB, player.VehicleTranfsorm, player.Team == localPlayer.Team ? friendlyColorVehicle : enemyColorVehicle);
  466. }
  467.  
  468. // ESP Distance
  469. if (ESP_Distance)
  470. {
  471. DrawText((int)X, (int)w2sFoot.Y, (int)player.Distance + "m", Color.White, true);
  472. }
  473.  
  474. // ESP Health
  475. if (ESP_Health)
  476. {
  477. DrawHealth((int)X, (int)w2sHead.Y - 6, (int)W, 3, (int)player.Health, (int)player.MaxHealth);
  478.  
  479. // Vehicle Health
  480. if (player.InVehicle && player.IsDriver)
  481. {
  482. DrawHealth((int)X, (int)w2sHead.Y - 10, (int)W, 3, (int)player.VehicleHealth, (int)player.VehicleMaxHealth);
  483. }
  484. }
  485. #endregion
  486. }
  487. }
  488.  
  489. // ADD IN ARRAY
  490. players.Add(player);
  491. }
  492. #endregion
  493.  
  494. // Check Spectator Count
  495. if (spectatorCount > 0)
  496. {
  497. DrawWarn(rect.Center.X - 125, 25, 250, 55);
  498. }
  499. }
  500.  
  501. // Get SoldierEntity
  502. private Int64 GetClientSoldierEntity(Int64 pClientPlayer, Player player)
  503. {
  504. Int64 pAttached = RPM.Read<Int64>(pClientPlayer + Offsets.ClientPlayer.m_pAttachedControllable);
  505. if (RPM.IsValid(pAttached))
  506. {
  507. Int64 m_ClientSoldier = RPM.Read<Int64>(RPM.Read<Int64>(pClientPlayer + Offsets.ClientPlayer.m_character)) - sizeof(Int64);
  508. if (RPM.IsValid(m_ClientSoldier))
  509. {
  510. player.InVehicle = true;
  511.  
  512. Int64 pVehicleEntity = RPM.Read<Int64>(pClientPlayer + Offsets.ClientPlayer.m_pAttachedControllable);
  513. if (RPM.IsValid(pVehicleEntity))
  514. {
  515. // Driver
  516. if (RPM.Read<Int32>(pClientPlayer + Offsets.ClientPlayer.m_attachedEntryId) == 0)
  517. {
  518. // Vehicle AABB
  519. if (ESP_Vehicle)
  520. {
  521. Int64 pDynamicPhysicsEntity = RPM.Read<Int64>(pVehicleEntity + Offsets.ClientVehicleEntity.m_pPhysicsEntity);
  522. if (RPM.IsValid(pDynamicPhysicsEntity))
  523. {
  524. Int64 pPhysicsEntity = RPM.Read<Int64>(pDynamicPhysicsEntity + Offsets.DynamicPhysicsEntity.m_EntityTransform);
  525. player.VehicleTranfsorm = RPM.Read<Matrix>(pPhysicsEntity + Offsets.PhysicsEntityTransform.m_Transform);
  526. player.VehicleAABB = RPM.Read<AxisAlignedBox>(pVehicleEntity + Offsets.ClientVehicleEntity.m_childrenAABB);
  527. }
  528. }
  529. Int64 _EntityData = RPM.Read<Int64>(pVehicleEntity + Offsets.ClientSoldierEntity.m_data);
  530. if (RPM.IsValid(_EntityData))
  531. {
  532. Int64 _NameSid = RPM.Read<Int64>(_EntityData + Offsets.VehicleEntityData.m_NameSid);
  533.  
  534. string strName = RPM.ReadName(_NameSid, 20);
  535. if (strName.Length > 11)
  536. {
  537. Int64 pAttachedClient = RPM.Read<Int64>(m_ClientSoldier + Offsets.ClientSoldierEntity.m_pPlayer);
  538. // AttachedControllable Max Health
  539. Int64 p = RPM.Read<Int64>(pAttachedClient + Offsets.ClientPlayer.m_pAttachedControllable);
  540. Int64 p2 = RPM.Read<Int64>(p + Offsets.ClientSoldierEntity.m_pHealthComponent);
  541. player.VehicleHealth = RPM.Read<float>(p2 + Offsets.HealthComponent.m_vehicleHealth);
  542.  
  543. // AttachedControllable Health
  544. player.VehicleMaxHealth = RPM.Read<float>(_EntityData + Offsets.VehicleEntityData.m_FrontMaxHealth);
  545.  
  546. // AttachedControllable Name
  547. player.VehicleName = strName.Remove(0, 11);
  548. player.IsDriver = true;
  549. }
  550. }
  551. }
  552. }
  553. }
  554. return m_ClientSoldier;
  555. }
  556. return RPM.Read<Int64>(pClientPlayer + Offsets.ClientPlayer.m_pControlledControllable);
  557. }
  558.  
  559. // Get Window Rect
  560. private void SetWindow(object sender)
  561. {
  562. while (true)
  563. {
  564. IntPtr targetWnd = IntPtr.Zero;
  565. targetWnd = Managed.FindWindow(null, "Battlefield 4");
  566.  
  567. if (targetWnd != IntPtr.Zero)
  568. {
  569. RECT targetSize = new RECT();
  570. Managed.GetWindowRect(targetWnd, out targetSize);
  571.  
  572. // Game is Minimized
  573. if (targetSize.Left < 0 && targetSize.Top < 0 && targetSize.Right < 0 && targetSize.Bottom < 0)
  574. {
  575. IsMinimized = true;
  576. continue;
  577. }
  578.  
  579. // Reset
  580. IsMinimized = false;
  581.  
  582. RECT borderSize = new RECT();
  583. Managed.GetClientRect(targetWnd, out borderSize);
  584.  
  585. int dwStyle = Managed.GetWindowLong(targetWnd, Managed.GWL_STYLE);
  586.  
  587. int windowheight;
  588. int windowwidth;
  589. int borderheight;
  590. int borderwidth;
  591.  
  592. if (rect.Width != (targetSize.Bottom - targetSize.Top)
  593. && rect.Width != (borderSize.Right - borderSize.Left))
  594. IsResize = true;
  595.  
  596. rect.Width = targetSize.Right - targetSize.Left;
  597. rect.Height = targetSize.Bottom - targetSize.Top;
  598.  
  599. if ((dwStyle & Managed.WS_BORDER) != 0)
  600. {
  601. windowheight = targetSize.Bottom - targetSize.Top;
  602. windowwidth = targetSize.Right - targetSize.Left;
  603.  
  604. rect.Height = borderSize.Bottom - borderSize.Top;
  605. rect.Width = borderSize.Right - borderSize.Left;
  606.  
  607. borderheight = (windowheight - borderSize.Bottom);
  608. borderwidth = (windowwidth - borderSize.Right) / 2; //only want one side
  609. borderheight -= borderwidth; //remove bottom
  610.  
  611. targetSize.Left += borderwidth;
  612. targetSize.Top += borderheight;
  613.  
  614. rect.Left = targetSize.Left;
  615. rect.Top = targetSize.Top;
  616. }
  617. Managed.MoveWindow(handle, targetSize.Left, targetSize.Top, rect.Width, rect.Height, true);
  618. }
  619. Thread.Sleep(300);
  620. }
  621. }
  622.  
  623. // 3D In 2D
  624. private bool WorldToScreen(Vector3 _Enemy, int _Pose, out Vector3 _Screen)
  625. {
  626. _Screen = new Vector3(0, 0, 0);
  627. float HeadHeight = _Enemy.Y;
  628.  
  629. #region HeadHeight
  630. if (_Pose == 0)
  631. {
  632. HeadHeight += 1.7f;
  633. }
  634. if (_Pose == 1)
  635. {
  636. HeadHeight += 1.15f;
  637. }
  638. if (_Pose == 2)
  639. {
  640. HeadHeight += 0.4f;
  641. }
  642. #endregion
  643.  
  644. float ScreenW = (viewProj.M14 * _Enemy.X) + (viewProj.M24 * HeadHeight) + (viewProj.M34 * _Enemy.Z + viewProj.M44);
  645.  
  646. if (ScreenW < 0.0001f)
  647. return false;
  648.  
  649. float ScreenX = (viewProj.M11 * _Enemy.X) + (viewProj.M21 * HeadHeight) + (viewProj.M31 * _Enemy.Z + viewProj.M41);
  650. float ScreenY = (viewProj.M12 * _Enemy.X) + (viewProj.M22 * HeadHeight) + (viewProj.M32 * _Enemy.Z + viewProj.M42);
  651.  
  652. _Screen.X = (rect.Width / 2) + (rect.Width / 2) * ScreenX / ScreenW;
  653. _Screen.Y = (rect.Height / 2) - (rect.Height / 2) * ScreenY / ScreenW;
  654. _Screen.Z = ScreenW;
  655. return true;
  656. }
  657.  
  658. // 3D In 2D
  659. private bool WorldToScreen(Vector3 _Enemy, out Vector3 _Screen)
  660. {
  661. _Screen = new Vector3(0, 0, 0);
  662. float ScreenW = (viewProj.M14 * _Enemy.X) + (viewProj.M24 * _Enemy.Y) + (viewProj.M34 * _Enemy.Z + viewProj.M44);
  663.  
  664. if (ScreenW < 0.0001f)
  665. return false;
  666.  
  667. float ScreenX = (viewProj.M11 * _Enemy.X) + (viewProj.M21 * _Enemy.Y) + (viewProj.M31 * _Enemy.Z + viewProj.M41);
  668. float ScreenY = (viewProj.M12 * _Enemy.X) + (viewProj.M22 * _Enemy.Y) + (viewProj.M32 * _Enemy.Z + viewProj.M42);
  669.  
  670. _Screen.X = (rect.Width / 2) + (rect.Width / 2) * ScreenX / ScreenW;
  671. _Screen.Y = (rect.Height / 2) - (rect.Height / 2) * ScreenY / ScreenW;
  672. _Screen.Z = ScreenW;
  673. return true;
  674. }
  675.  
  676. // Get Roll
  677. private bool GetBonyById(Int64 pEnemySoldier, int Id, out Vector3 _World)
  678. {
  679. _World = new Vector3();
  680.  
  681. Int64 pRagdollComp = RPM.Read<Int64>(pEnemySoldier + Offsets.ClientSoldierEntity.m_ragdollComponent);
  682. if (!RPM.IsValid(pRagdollComp))
  683. return false;
  684.  
  685. byte m_ValidTransforms = RPM.Read<Byte>(pRagdollComp + (Offsets.ClientRagDollComponent.m_ragdollTransforms + Offsets.UpdatePoseResultData.m_ValidTransforms));
  686. if (m_ValidTransforms != 1)
  687. return false;
  688.  
  689. Int64 pQuatTransform = RPM.Read<Int64>(pRagdollComp + (Offsets.ClientRagDollComponent.m_ragdollTransforms + Offsets.UpdatePoseResultData.m_ActiveWorldTransforms));
  690. if (!RPM.IsValid(pQuatTransform))
  691. return false;
  692.  
  693. _World = RPM.Read<Vector3>(pQuatTransform + Id * 0x20);
  694. return true;
  695. }
  696.  
  697. // Get FPS
  698. public int CalculateFrameRate()
  699. {
  700. int tickCount = Environment.TickCount;
  701. if (tickCount - lastTick >= 1000)
  702. {
  703. lastFrameRate = frameRate;
  704. frameRate = 0;
  705. lastTick = tickCount;
  706. }
  707. frameRate++;
  708. return lastFrameRate;
  709. }
  710.  
  711. // Close window event
  712. private void DrawWindow_FormClosing(object sender, FormClosingEventArgs e)
  713. {
  714. updateStream.Abort();
  715. windowStream.Abort();
  716. RPM.CloseProcess();
  717.  
  718. // Close main process
  719. Environment.Exit(0);
  720. }
  721.  
  722. // Multiply Vector's
  723. public Vector3 Multiply(Vector3 vector, Matrix mat)
  724. {
  725. return new Vector3(mat.M11 * vector.X + mat.M21 * vector.Y + mat.M31 * vector.Z,
  726. mat.M12 * vector.X + mat.M22 * vector.Y + mat.M32 * vector.Z,
  727. mat.M13 * vector.X + mat.M23 * vector.Y + mat.M33 * vector.Z);
  728. }
  729.  
  730. // Draw Functions
  731. #region Draw Functions
  732. private void DrawRect(int X, int Y, int W, int H, Color color)
  733. {
  734. solidColorBrush.Color = color;
  735. device.DrawRectangle(new Rectangle(X, Y, W, H), solidColorBrush);
  736. }
  737.  
  738. private void DrawRect(int X, int Y, int W, int H, Color color, float stroke)
  739. {
  740. solidColorBrush.Color = color;
  741. device.DrawRectangle(new Rectangle(X, Y, W, H), solidColorBrush, stroke);
  742. }
  743.  
  744. private void DrawFillRect(int X, int Y, int W, int H, Color color)
  745. {
  746. solidColorBrush.Color = color;
  747. device.FillRectangle(new RectangleF(X, Y, W, H), solidColorBrush);
  748. }
  749.  
  750. private void DrawText(int X, int Y, string text, Color color)
  751. {
  752. solidColorBrush.Color = color;
  753. device.DrawText(text, font, new RectangleF(X, Y, font.FontSize * text.Length, font.FontSize), solidColorBrush);
  754. }
  755.  
  756. private void DrawText(int X, int Y, string text, Color color, bool outline)
  757. {
  758. if (outline)
  759. {
  760. solidColorBrush.Color = Color.Black;
  761. device.DrawText(text, font, new RectangleF(X + 1, Y + 1, font.FontSize * text.Length, font.FontSize), solidColorBrush);
  762. }
  763.  
  764. solidColorBrush.Color = color;
  765. device.DrawText(text, font, new RectangleF(X, Y, font.FontSize * text.Length, font.FontSize), solidColorBrush);
  766. }
  767.  
  768. private void DrawText(int X, int Y, string text, Color color, bool outline, TextFormat format)
  769. {
  770. if (outline)
  771. {
  772. solidColorBrush.Color = Color.Black;
  773. device.DrawText(text, format, new RectangleF(X + 1, Y + 1, format.FontSize * text.Length, format.FontSize), solidColorBrush);
  774. }
  775.  
  776. solidColorBrush.Color = color;
  777. device.DrawText(text, format, new RectangleF(X, Y, format.FontSize * text.Length, format.FontSize), solidColorBrush);
  778. }
  779.  
  780. private void DrawTextCenter(int X, int Y, int W, int H, string text, Color color)
  781. {
  782. solidColorBrush.Color = color;
  783. TextLayout layout = new TextLayout(fontFactory, text, fontSmall, W, H);
  784. layout.TextAlignment = TextAlignment.Center;
  785. device.DrawTextLayout(new Vector2(X, Y), layout, solidColorBrush);
  786. layout.Dispose();
  787. }
  788.  
  789. private void DrawTextCenter(int X, int Y, int W, int H, string text, Color color, bool outline)
  790. {
  791. TextLayout layout = new TextLayout(fontFactory, text, fontSmall, W, H);
  792. layout.TextAlignment = TextAlignment.Center;
  793.  
  794. if (outline)
  795. {
  796. solidColorBrush.Color = Color.Black;
  797. device.DrawTextLayout(new Vector2(X + 1, Y + 1), layout, solidColorBrush);
  798. }
  799.  
  800. solidColorBrush.Color = color;
  801. device.DrawTextLayout(new Vector2(X, Y), layout, solidColorBrush);
  802. layout.Dispose();
  803. }
  804.  
  805. private void DrawLine(int X, int Y, int XX, int YY, Color color)
  806. {
  807. solidColorBrush.Color = color;
  808. device.DrawLine(new Vector2(X, Y), new Vector2(XX, YY), solidColorBrush);
  809. }
  810.  
  811. private void DrawLine(Vector3 w2s, Vector3 _w2s, Color color)
  812. {
  813. solidColorBrush.Color = color;
  814. device.DrawLine(new Vector2(w2s.X, w2s.Y), new Vector2(_w2s.X, _w2s.Y), solidColorBrush);
  815. }
  816.  
  817. private void DrawCircle(int X, int Y, int W, Color color)
  818. {
  819. solidColorBrush.Color = color;
  820. device.DrawEllipse(new Ellipse(new Vector2(X, Y), W, W), solidColorBrush);
  821. }
  822.  
  823. private void DrawFillCircle(int X, int Y, int W, Color color)
  824. {
  825. solidColorBrush.Color = color;
  826. device.FillEllipse(new Ellipse(new Vector2(X, Y), W, W), solidColorBrush);
  827. }
  828.  
  829. private void DrawImage(int X, int Y, int W, int H, Bitmap bitmap)
  830. {
  831. device.DrawBitmap(bitmap, new RectangleF(X, Y, W, H), 1.0f, BitmapInterpolationMode.Linear);
  832. }
  833.  
  834. private void DrawImage(int X, int Y, int W, int H, Bitmap bitmap, float angle)
  835. {
  836. device.Transform = Matrix3x2.Rotation(angle, new Vector2(X + (H / 2), Y + (H / 2)));
  837. device.DrawBitmap(bitmap, new RectangleF(X, Y, W, H), 1.0f, BitmapInterpolationMode.Linear);
  838. device.Transform = Matrix3x2.Rotation(0);
  839. }
  840.  
  841. private void DrawSprite(RectangleF destinationRectangle, Bitmap bitmap, RectangleF sourceRectangle)
  842. {
  843. device.DrawBitmap(bitmap, destinationRectangle, 1.0f, BitmapInterpolationMode.Linear, sourceRectangle);
  844. }
  845.  
  846. private void DrawSprite(RectangleF destinationRectangle, Bitmap bitmap, RectangleF sourceRectangle, float angle)
  847. {
  848. Vector2 center = new Vector2();
  849. center.X = destinationRectangle.X + destinationRectangle.Width / 2;
  850. center.Y = destinationRectangle.Y + destinationRectangle.Height / 2;
  851.  
  852. device.Transform = Matrix3x2.Rotation(angle, center);
  853. device.DrawBitmap(bitmap, destinationRectangle, 1.0f, BitmapInterpolationMode.Linear, sourceRectangle);
  854. device.Transform = Matrix3x2.Rotation(0);
  855. }
  856.  
  857. private void DrawBone(Player player)
  858. {
  859. Vector3 BONE_HEAD,
  860. BONE_NECK,
  861. BONE_SPINE2,
  862. BONE_SPINE1,
  863. BONE_SPINE,
  864. BONE_LEFTSHOULDER,
  865. BONE_RIGHTSHOULDER,
  866. BONE_LEFTELBOWROLL,
  867. BONE_RIGHTELBOWROLL,
  868. BONE_LEFTHAND,
  869. BONE_RIGHTHAND,
  870. BONE_LEFTKNEEROLL,
  871. BONE_RIGHTKNEEROLL,
  872. BONE_LEFTFOOT,
  873. BONE_RIGHTFOOT;
  874.  
  875. if(WorldToScreen(player.Bone.BONE_HEAD, out BONE_HEAD) &&
  876. WorldToScreen(player.Bone.BONE_NECK, out BONE_NECK) &&
  877. WorldToScreen(player.Bone.BONE_SPINE2, out BONE_SPINE2) &&
  878. WorldToScreen(player.Bone.BONE_SPINE1, out BONE_SPINE1) &&
  879. WorldToScreen(player.Bone.BONE_SPINE, out BONE_SPINE) &&
  880. WorldToScreen(player.Bone.BONE_LEFTSHOULDER, out BONE_LEFTSHOULDER) &&
  881. WorldToScreen(player.Bone.BONE_RIGHTSHOULDER, out BONE_RIGHTSHOULDER) &&
  882. WorldToScreen(player.Bone.BONE_LEFTELBOWROLL, out BONE_LEFTELBOWROLL) &&
  883. WorldToScreen(player.Bone.BONE_RIGHTELBOWROLL, out BONE_RIGHTELBOWROLL) &&
  884. WorldToScreen(player.Bone.BONE_LEFTHAND, out BONE_LEFTHAND) &&
  885. WorldToScreen(player.Bone.BONE_RIGHTHAND, out BONE_RIGHTHAND) &&
  886. WorldToScreen(player.Bone.BONE_LEFTKNEEROLL, out BONE_LEFTKNEEROLL) &&
  887. WorldToScreen(player.Bone.BONE_RIGHTKNEEROLL, out BONE_RIGHTKNEEROLL) &&
  888. WorldToScreen(player.Bone.BONE_LEFTFOOT, out BONE_LEFTFOOT) &&
  889. WorldToScreen(player.Bone.BONE_RIGHTFOOT, out BONE_RIGHTFOOT))
  890. {
  891. int stroke = 3;
  892. int strokeW = stroke % 2 == 0 ? stroke / 2 : (stroke - 1) / 2;
  893.  
  894. // Color
  895. Color skeletonColor = player.Team == localPlayer.Team ? friendSkeletonColor : enemySkeletonColor;
  896.  
  897. // RECT's
  898. DrawFillRect((int)BONE_HEAD.X - strokeW, (int)BONE_HEAD.Y - strokeW, stroke, stroke, skeletonColor);
  899. DrawFillRect((int)BONE_NECK.X - strokeW, (int)BONE_NECK.Y - strokeW, stroke, stroke, skeletonColor);
  900. DrawFillRect((int)BONE_LEFTSHOULDER.X - strokeW, (int)BONE_LEFTSHOULDER.Y - strokeW, stroke, stroke, skeletonColor);
  901. DrawFillRect((int)BONE_LEFTELBOWROLL.X - strokeW, (int)BONE_LEFTELBOWROLL.Y - strokeW, stroke, stroke, skeletonColor);
  902. DrawFillRect((int)BONE_LEFTHAND.X - strokeW, (int)BONE_LEFTHAND.Y - strokeW, stroke, stroke, skeletonColor);
  903. DrawFillRect((int)BONE_RIGHTSHOULDER.X - strokeW, (int)BONE_RIGHTSHOULDER.Y - strokeW, stroke, stroke, skeletonColor);
  904. DrawFillRect((int)BONE_RIGHTELBOWROLL.X - strokeW, (int)BONE_RIGHTELBOWROLL.Y - strokeW, stroke, stroke, skeletonColor);
  905. DrawFillRect((int)BONE_RIGHTHAND.X - strokeW, (int)BONE_RIGHTHAND.Y - strokeW, stroke, stroke, skeletonColor);
  906. DrawFillRect((int)BONE_SPINE2.X - strokeW, (int)BONE_SPINE2.Y - strokeW, stroke, stroke, skeletonColor);
  907. DrawFillRect((int)BONE_SPINE1.X - strokeW, (int)BONE_SPINE1.Y - strokeW, stroke, stroke, skeletonColor);
  908. DrawFillRect((int)BONE_SPINE.X - strokeW, (int)BONE_SPINE.Y - strokeW, stroke, stroke, skeletonColor);
  909. DrawFillRect((int)BONE_LEFTKNEEROLL.X - strokeW, (int)BONE_LEFTKNEEROLL.Y - strokeW, stroke, stroke, skeletonColor);
  910. DrawFillRect((int)BONE_RIGHTKNEEROLL.X - strokeW, (int)BONE_RIGHTKNEEROLL.Y - strokeW, 2, 2, skeletonColor);
  911. DrawFillRect((int)BONE_LEFTFOOT.X - strokeW, (int)BONE_LEFTFOOT.Y - strokeW, 2, 2, skeletonColor);
  912. DrawFillRect((int)BONE_RIGHTFOOT.X - strokeW, (int)BONE_RIGHTFOOT.Y - strokeW, 2, 2, skeletonColor);
  913.  
  914. // Head -> Neck
  915. DrawLine((int)BONE_HEAD.X, (int)BONE_HEAD.Y, (int)BONE_NECK.X, (int)BONE_NECK.Y, skeletonColor);
  916.  
  917. // Neck -> Left
  918. DrawLine((int)BONE_NECK.X, (int)BONE_NECK.Y, (int)BONE_LEFTSHOULDER.X, (int)BONE_LEFTSHOULDER.Y, skeletonColor);
  919. DrawLine((int)BONE_LEFTSHOULDER.X, (int)BONE_LEFTSHOULDER.Y,(int) BONE_LEFTELBOWROLL.X, (int)BONE_LEFTELBOWROLL.Y, skeletonColor);
  920. DrawLine((int)BONE_LEFTELBOWROLL.X, (int)BONE_LEFTELBOWROLL.Y, (int)BONE_LEFTHAND.X, (int)BONE_LEFTHAND.Y, skeletonColor);
  921.  
  922. // Neck -> Right
  923. DrawLine((int)BONE_NECK.X, (int)BONE_NECK.Y, (int)BONE_RIGHTSHOULDER.X, (int)BONE_RIGHTSHOULDER.Y, skeletonColor);
  924. DrawLine((int)BONE_RIGHTSHOULDER.X, (int)BONE_RIGHTSHOULDER.Y, (int)BONE_RIGHTELBOWROLL.X, (int)BONE_RIGHTELBOWROLL.Y, skeletonColor);
  925. DrawLine((int)BONE_RIGHTELBOWROLL.X, (int)BONE_RIGHTELBOWROLL.Y, (int)BONE_RIGHTHAND.X, (int)BONE_RIGHTHAND.Y, skeletonColor);
  926.  
  927. // Neck -> Center
  928. DrawLine((int)BONE_NECK.X, (int)BONE_NECK.Y, (int)BONE_SPINE2.X, (int)BONE_SPINE2.Y, skeletonColor);
  929. DrawLine((int)BONE_SPINE2.X, (int)BONE_SPINE2.Y, (int)BONE_SPINE1.X, (int)BONE_SPINE1.Y, skeletonColor);
  930. DrawLine((int)BONE_SPINE1.X, (int)BONE_SPINE1.Y, (int)BONE_SPINE.X, (int)BONE_SPINE.Y, skeletonColor);
  931.  
  932. // Spine -> Left
  933. DrawLine((int)BONE_SPINE.X, (int)BONE_SPINE.Y, (int)BONE_LEFTKNEEROLL.X, (int)BONE_LEFTKNEEROLL.Y, skeletonColor);
  934. DrawLine((int)BONE_LEFTKNEEROLL.X, (int)BONE_LEFTKNEEROLL.Y, (int)BONE_LEFTFOOT.X, (int)BONE_LEFTFOOT.Y, skeletonColor);
  935.  
  936. // Spine -> Right
  937. DrawLine((int)BONE_SPINE.X, (int)BONE_SPINE.Y, (int)BONE_RIGHTKNEEROLL.X, (int)BONE_RIGHTKNEEROLL.Y, skeletonColor);
  938. DrawLine((int)BONE_RIGHTKNEEROLL.X, (int)BONE_RIGHTKNEEROLL.Y, (int)BONE_RIGHTFOOT.X, (int)BONE_RIGHTFOOT.Y, skeletonColor);
  939. }
  940. }
  941.  
  942. private void DrawHealth(int X, int Y, int W, int H, int Health, int MaxHealth)
  943. {
  944. if (Health <= 0)
  945. Health = 1;
  946.  
  947. if (MaxHealth < Health)
  948. MaxHealth = 100;
  949.  
  950. int progress = (int)((float)Health / ((float)MaxHealth / 100));
  951. int w = (int)((float)W / 100 * progress);
  952.  
  953. if (w <= 2)
  954. w = 3;
  955.  
  956. Color color = new Color(255, 0, 0, 255);
  957. if (progress >= 20) color = new Color(255, 165, 0, 255);
  958. if (progress >= 40) color = new Color(255, 255, 0, 255);
  959. if (progress >= 60) color = new Color(173, 255, 47, 255);
  960. if (progress >= 80) color = new Color(0, 255, 0, 255);
  961.  
  962. DrawFillRect(X, Y - 1, W + 1, H + 2, Color.Black);
  963. DrawFillRect(X + 1, Y, w - 1, H, color);
  964. }
  965.  
  966. private void DrawProgress(int X, int Y, int W, int H, int Value, int MaxValue)
  967. {
  968. int progress = (int)((float)Value / ((float)MaxValue / 100));
  969. int w = (int)((float)W / 100 * progress);
  970.  
  971. Color color = new Color(0, 255, 0, 255);
  972. if (progress >= 20) color = new Color(173, 255, 47, 255);
  973. if (progress >= 40) color = new Color(255, 255, 0, 255);
  974. if (progress >= 60) color = new Color(255, 165, 0, 255);
  975. if (progress >= 80) color = new Color(255, 0, 0, 255);
  976.  
  977. DrawFillRect(X, Y - 1, W + 1, H + 2, Color.Black);
  978. if (w >= 2)
  979. {
  980. DrawFillRect(X + 1, Y, w - 1, H, color);
  981. }
  982. }
  983.  
  984. private void DrawAABB(AxisAlignedBox aabb, Matrix tranform, Color color)
  985. {
  986. Vector3 m_Position = new Vector3(tranform.M41, tranform.M42, tranform.M43);
  987. Vector3 fld = Multiply(new Vector3(aabb.Min.X, aabb.Min.Y, aabb.Min.Z), tranform) + m_Position;
  988. Vector3 brt = Multiply(new Vector3(aabb.Max.X, aabb.Max.Y, aabb.Max.Z), tranform) + m_Position;
  989. Vector3 bld = Multiply(new Vector3(aabb.Min.X, aabb.Min.Y, aabb.Max.Z), tranform) + m_Position;
  990. Vector3 frt = Multiply(new Vector3(aabb.Max.X, aabb.Max.Y, aabb.Min.Z), tranform) + m_Position;
  991. Vector3 frd = Multiply(new Vector3(aabb.Max.X, aabb.Min.Y, aabb.Min.Z), tranform) + m_Position;
  992. Vector3 brb = Multiply(new Vector3(aabb.Max.X, aabb.Min.Y, aabb.Max.Z), tranform) + m_Position;
  993. Vector3 blt = Multiply(new Vector3(aabb.Min.X, aabb.Max.Y, aabb.Max.Z), tranform) + m_Position;
  994. Vector3 flt = Multiply(new Vector3(aabb.Min.X, aabb.Max.Y, aabb.Min.Z), tranform) + m_Position;
  995.  
  996. #region WorldToScreen
  997. if (!WorldToScreen(fld, out fld) || !WorldToScreen(brt, out brt)
  998. || !WorldToScreen(bld, out bld) || !WorldToScreen(frt, out frt)
  999. || !WorldToScreen(frd, out frd) || !WorldToScreen(brb, out brb)
  1000. || !WorldToScreen(blt, out blt) || !WorldToScreen(flt, out flt))
  1001. return;
  1002. #endregion
  1003.  
  1004. #region DrawLines
  1005. DrawLine(fld, flt, color);
  1006. DrawLine(flt, frt, color);
  1007. DrawLine(frt, frd, color);
  1008. DrawLine(frd, fld, color);
  1009. DrawLine(bld, blt, color);
  1010. DrawLine(blt, brt, color);
  1011. DrawLine(brt, brb, color);
  1012. DrawLine(brb, bld, color);
  1013. DrawLine(fld, bld, color);
  1014. DrawLine(frd, brb, color);
  1015. DrawLine(flt, blt, color);
  1016. DrawLine(frt, brt, color);
  1017. #endregion
  1018. }
  1019.  
  1020. private void DrawAABB(AxisAlignedBox aabb, Vector3 m_Position, float Yaw, Color color)
  1021. {
  1022. float cosY = (float)Math.Cos(Yaw);
  1023. float sinY = (float)Math.Sin(Yaw);
  1024.  
  1025. Vector3 fld = new Vector3(aabb.Min.Z * cosY - aabb.Min.X * sinY, aabb.Min.Y, aabb.Min.X * cosY + aabb.Min.Z * sinY) + m_Position; // 0
  1026. Vector3 brt = new Vector3(aabb.Min.Z * cosY - aabb.Max.X * sinY, aabb.Min.Y, aabb.Max.X * cosY + aabb.Min.Z * sinY) + m_Position; // 1
  1027. Vector3 bld = new Vector3(aabb.Max.Z * cosY - aabb.Max.X * sinY, aabb.Min.Y, aabb.Max.X * cosY + aabb.Max.Z * sinY) + m_Position; // 2
  1028. Vector3 frt = new Vector3(aabb.Max.Z * cosY - aabb.Min.X * sinY, aabb.Min.Y, aabb.Min.X * cosY + aabb.Max.Z * sinY) + m_Position; // 3
  1029. Vector3 frd = new Vector3(aabb.Max.Z * cosY - aabb.Min.X * sinY, aabb.Max.Y, aabb.Min.X * cosY + aabb.Max.Z * sinY) + m_Position; // 4
  1030. Vector3 brb = new Vector3(aabb.Min.Z * cosY - aabb.Min.X * sinY, aabb.Max.Y, aabb.Min.X * cosY + aabb.Min.Z * sinY) + m_Position; // 5
  1031. Vector3 blt = new Vector3(aabb.Min.Z * cosY - aabb.Max.X * sinY, aabb.Max.Y, aabb.Max.X * cosY + aabb.Min.Z * sinY) + m_Position; // 6
  1032. Vector3 flt = new Vector3(aabb.Max.Z * cosY - aabb.Max.X * sinY, aabb.Max.Y, aabb.Max.X * cosY + aabb.Max.Z * sinY) + m_Position; // 7
  1033.  
  1034. #region WorldToScreen
  1035. if (!WorldToScreen(fld, out fld) || !WorldToScreen(brt, out brt)
  1036. || !WorldToScreen(bld, out bld) || !WorldToScreen(frt, out frt)
  1037. || !WorldToScreen(frd, out frd) || !WorldToScreen(brb, out brb)
  1038. || !WorldToScreen(blt, out blt) || !WorldToScreen(flt, out flt))
  1039. return;
  1040. #endregion
  1041.  
  1042. #region DrawLines
  1043. DrawLine(fld, brt, color);
  1044. DrawLine(brb, blt, color);
  1045. DrawLine(fld, brb, color);
  1046. DrawLine(brt, blt, color);
  1047.  
  1048. DrawLine(frt, bld, color);
  1049. DrawLine(frd, flt, color);
  1050. DrawLine(frt, frd, color);
  1051. DrawLine(bld, flt, color);
  1052.  
  1053. DrawLine(frt, fld, color);
  1054. DrawLine(frd, brb, color);
  1055. DrawLine(brt, bld, color);
  1056. DrawLine(blt, flt, color);
  1057. #endregion
  1058. }
  1059.  
  1060. private void DrawMenu(int X, int Y)
  1061. {
  1062. Color selectedColor = new Color(255, 214, 0, 255);
  1063. DrawText(X, Y, "F5: ESP Box", ESP_Box ? selectedColor : Color.White, true, fontSmall);
  1064. DrawText(X + 100, Y, "F6: ESP Bone", ESP_Bone ? selectedColor : Color.White, true, fontSmall);
  1065. DrawText(X + 200, Y, "F7: ESP Health", ESP_Health ? selectedColor : Color.White, true, fontSmall);
  1066. DrawText(X + 310, Y, "F8: ESP Distance", ESP_Distance ? selectedColor : Color.White, true, fontSmall);
  1067. DrawText(X + 430, Y, "F9: ESP Vehicle", ESP_Vehicle ? selectedColor : Color.White, true, fontSmall);
  1068. }
  1069.  
  1070. private void DrawWarn(int X, int Y, int W, int H)
  1071. {
  1072. RoundedRectangle rect = new RoundedRectangle();
  1073. rect.RadiusX = 4;
  1074. rect.RadiusY = 4;
  1075. rect.Rect = new RectangleF(X, Y, W, H);
  1076.  
  1077. solidColorBrush.Color = new Color(196, 26, 31, 210);
  1078. device.FillRoundedRectangle(ref rect, solidColorBrush);
  1079.  
  1080. DrawText(X + 20, Y + 5, "Spectator on the server.", Color.White, true);
  1081. DrawText(X + 20, Y + 25, "Watching You!", Color.White, true);
  1082. }
  1083. #endregion
  1084. }
  1085. }
  1086.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:4: error: class, interface, or enum expected
using System;
^
Main.java:5: error: class, interface, or enum expected
using System.Data;
^
Main.java:6: error: class, interface, or enum expected
using System.Linq;
^
Main.java:7: error: class, interface, or enum expected
using System.Text;
^
Main.java:8: error: class, interface, or enum expected
using System.Threading;
^
Main.java:9: error: class, interface, or enum expected
using System.Diagnostics;
^
Main.java:10: error: class, interface, or enum expected
using System.Windows.Forms;
^
Main.java:11: error: class, interface, or enum expected
using System.ComponentModel;
^
Main.java:12: error: class, interface, or enum expected
using System.Collections.Generic;
^
Main.java:14: error: class, interface, or enum expected
using Factory = SharpDX.Direct2D1.Factory;
^
Main.java:15: error: class, interface, or enum expected
using FontFactory = SharpDX.DirectWrite.Factory;
^
Main.java:16: error: class, interface, or enum expected
using Format = SharpDX.DXGI.Format;
^
Main.java:18: error: class, interface, or enum expected
using SharpDX;
^
Main.java:19: error: class, interface, or enum expected
using SharpDX.Windows;
^
Main.java:20: error: class, interface, or enum expected
using SharpDX.Direct2D1;
^
Main.java:21: error: class, interface, or enum expected
using SharpDX.DirectWrite;
^
Main.java:22: error: class, interface, or enum expected
using System.Runtime.InteropServices;
^
Main.java:24: error: class, interface, or enum expected
namespace External_ESP_Base
^
Main.java:26: error: class, interface, or enum expected
    public partial class Overlay : Form
           ^
Main.java:26: error: '{' expected
    public partial class Overlay : Form
                                ^
Main.java:70: error: illegal start of type
        private const string fontFamily = "Calibri";
                ^
Main.java:70: error: ';' expected
        private const string fontFamily = "Calibri";
                     ^
Main.java:70: error: <identifier> expected
        private const string fontFamily = "Calibri";
                                       ^
Main.java:71: error: illegal start of type
        private const float fontSize = 18.0f;
                ^
Main.java:71: error: ';' expected
        private const float fontSize = 18.0f;
                     ^
Main.java:71: error: <identifier> expected
        private const float fontSize = 18.0f;
                                    ^
Main.java:72: error: illegal start of type
        private const float fontSizeSmall = 14.0f;
                ^
Main.java:72: error: ';' expected
        private const float fontSizeSmall = 14.0f;
                     ^
Main.java:72: error: <identifier> expected
        private const float fontSizeSmall = 14.0f;
                                         ^
Main.java:87: error: illegal start of expression
            const UInt32 SWP_NOSIZE = 0x0001;
            ^
Main.java:88: error: illegal start of expression
            const UInt32 SWP_NOMOVE = 0x0002;
            ^
Main.java:89: error: illegal start of expression
            const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE;
            ^
Main.java:98: error: <identifier> expected
        protected override void OnResize(EventArgs e)
                          ^
Main.java:98: error: invalid method declaration; return type required
        protected override void OnResize(EventArgs e)
                                ^
Main.java:101: error: ')' expected
            Managed.DwmExtendFrameIntoClientArea(this.Handle, ref margins);
                                                                 ^
Main.java:101: error: illegal start of expression
            Managed.DwmExtendFrameIntoClientArea(this.Handle, ref margins);
                                                                         ^
Main.java:125: error: <identifier> expected
                Hwnd = this.Handle,
                    ^
Main.java:127: error: ';' expected
                PresentOptions = PresentOptions.None
                                                    ^
Main.java:197: error: ')' expected
            foreach (Process p in Process.GetProcesses())
                            ^
Main.java:197: error: ';' expected
            foreach (Process p in Process.GetProcesses())
                                         ^
Main.java:197: error: ';' expected
            foreach (Process p in Process.GetProcesses())
                                                        ^
Main.java:258: error: illegal character: '#'
            #region Get Local Player
            ^
Main.java:258: error: ';' expected
            #region Get Local Player
                       ^
Main.java:258: error: ';' expected
            #region Get Local Player
                                    ^
Main.java:285: error: '.class' expected
            localPlayer.Health = RPM.Read<float>(pHealthComponent + Offsets.HealthComponent.m_Health);
                                               ^
Main.java:286: error: '.class' expected
            localPlayer.MaxHealth = RPM.Read<float>(pHealthComponent + Offsets.HealthComponent.m_MaxHealth);
                                                  ^
Main.java:298: error: '.class' expected
            localPlayer.Yaw = RPM.Read<float>(pLocalSoldier + Offsets.ClientSoldierEntity.m_authorativeYaw);
                                            ^
Main.java:336: error: illegal character: '#'
            #endregion
            ^
Main.java:339: error: ';' expected
            Int64 pGameRenderer = RPM.Read<Int64>(Offsets.GameRenderer.GetInstance());
                 ^
Main.java:355: error: illegal character: '#'
            #region Get Player by Id
            ^
Main.java:355: error: ';' expected
            #region Get Player by Id
                       ^
Main.java:355: error: ';' expected
            #region Get Player by Id
                                 ^
Main.java:355: error: not a statement
            #region Get Player by Id
                                  ^
Main.java:355: error: ';' expected
            #region Get Player by Id
                                    ^
Main.java:391: error: '.class' expected
                player.Health = RPM.Read<float>(pEnemyHealthComponent + Offsets.HealthComponent.m_Health);
                                              ^
Main.java:392: error: '.class' expected
                player.MaxHealth = RPM.Read<float>(pEnemyHealthComponent + Offsets.HealthComponent.m_MaxHealth);
                                                 ^
Main.java:403: error: '.class' expected
                player.Yaw = RPM.Read<float>(pEnemySoldier + Offsets.ClientSoldierEntity.m_authorativeYaw);
                                           ^
Main.java:411: error: illegal character: '#'
                    #region Bone ESP
                    ^
Main.java:411: error: ';' expected
                    #region Bone ESP
                                ^
Main.java:411: error: not a statement
                    #region Bone ESP
                                 ^
Main.java:411: error: ';' expected
                    #region Bone ESP
                                    ^
Main.java:415: error: ')' expected
                        if (GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_HEAD, out player.Bone.BONE_HEAD)
                                                                                                             ^
Main.java:415: error: illegal start of expression
                        if (GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_HEAD, out player.Bone.BONE_HEAD)
                                                                                                                    ^
Main.java:415: error: ';' expected
                        if (GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_HEAD, out player.Bone.BONE_HEAD)
                                                                                                                         ^
Main.java:415: error: variable declaration not allowed here
                        if (GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_HEAD, out player.Bone.BONE_HEAD)
                                                                                                                     ^
Main.java:415: error: not a statement
                        if (GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_HEAD, out player.Bone.BONE_HEAD)
                                                                                                                          ^
Main.java:415: error: ';' expected
                        if (GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_HEAD, out player.Bone.BONE_HEAD)
                                                                                                                                   ^
Main.java:416: error: ')' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTELBOWROLL, out player.Bone.BONE_LEFTELBOWROLL)
                                                                                                                         ^
Main.java:416: error: illegal start of expression
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTELBOWROLL, out player.Bone.BONE_LEFTELBOWROLL)
                                                                                                                                ^
Main.java:416: error: ';' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTELBOWROLL, out player.Bone.BONE_LEFTELBOWROLL)
                                                                                                                                     ^
Main.java:416: error: not a statement
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTELBOWROLL, out player.Bone.BONE_LEFTELBOWROLL)
                                                                                                                                      ^
Main.java:416: error: ';' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTELBOWROLL, out player.Bone.BONE_LEFTELBOWROLL)
                                                                                                                                                        ^
Main.java:417: error: ')' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTFOOT, out player.Bone.BONE_LEFTFOOT)
                                                                                                                    ^
Main.java:417: error: illegal start of expression
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTFOOT, out player.Bone.BONE_LEFTFOOT)
                                                                                                                           ^
Main.java:417: error: ';' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTFOOT, out player.Bone.BONE_LEFTFOOT)
                                                                                                                                ^
Main.java:417: error: not a statement
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTFOOT, out player.Bone.BONE_LEFTFOOT)
                                                                                                                                 ^
Main.java:417: error: ';' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTFOOT, out player.Bone.BONE_LEFTFOOT)
                                                                                                                                              ^
Main.java:418: error: ')' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTHAND, out player.Bone.BONE_LEFTHAND)
                                                                                                                    ^
Main.java:418: error: illegal start of expression
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTHAND, out player.Bone.BONE_LEFTHAND)
                                                                                                                           ^
Main.java:418: error: ';' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTHAND, out player.Bone.BONE_LEFTHAND)
                                                                                                                                ^
Main.java:418: error: not a statement
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTHAND, out player.Bone.BONE_LEFTHAND)
                                                                                                                                 ^
Main.java:418: error: ';' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTHAND, out player.Bone.BONE_LEFTHAND)
                                                                                                                                              ^
Main.java:419: error: ')' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTKNEEROLL, out player.Bone.BONE_LEFTKNEEROLL)
                                                                                                                        ^
Main.java:419: error: illegal start of expression
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTKNEEROLL, out player.Bone.BONE_LEFTKNEEROLL)
                                                                                                                               ^
Main.java:419: error: ';' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTKNEEROLL, out player.Bone.BONE_LEFTKNEEROLL)
                                                                                                                                    ^
Main.java:419: error: not a statement
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTKNEEROLL, out player.Bone.BONE_LEFTKNEEROLL)
                                                                                                                                     ^
Main.java:419: error: ';' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTKNEEROLL, out player.Bone.BONE_LEFTKNEEROLL)
                                                                                                                                                      ^
Main.java:420: error: ')' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTSHOULDER, out player.Bone.BONE_LEFTSHOULDER)
                                                                                                                        ^
Main.java:420: error: illegal start of expression
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTSHOULDER, out player.Bone.BONE_LEFTSHOULDER)
                                                                                                                               ^
Main.java:420: error: ';' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTSHOULDER, out player.Bone.BONE_LEFTSHOULDER)
                                                                                                                                    ^
Main.java:420: error: not a statement
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTSHOULDER, out player.Bone.BONE_LEFTSHOULDER)
                                                                                                                                     ^
Main.java:420: error: ';' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTSHOULDER, out player.Bone.BONE_LEFTSHOULDER)
                                                                                                                                                      ^
Main.java:421: error: ')' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_NECK, out player.Bone.BONE_NECK)
                                                                                                                ^
Main.java:421: error: illegal start of expression
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_NECK, out player.Bone.BONE_NECK)
                                                                                                                       ^
Main.java:421: error: ';' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_NECK, out player.Bone.BONE_NECK)
                                                                                                                            ^
Main.java:421: error: not a statement
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_NECK, out player.Bone.BONE_NECK)
                                                                                                                             ^
Main.java:421: error: ';' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_NECK, out player.Bone.BONE_NECK)
                                                                                                                                      ^
Main.java:422: error: ')' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTELBOWROLL, out player.Bone.BONE_RIGHTELBOWROLL)
                                                                                                                          ^
Main.java:422: error: illegal start of expression
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTELBOWROLL, out player.Bone.BONE_RIGHTELBOWROLL)
                                                                                                                                 ^
Main.java:422: error: ';' expected
                            && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTELBOWROLL, out player.Bone.BONE_RIGHTELBOWROLL)
                                                                                                                                      ^
100 errors
stdout
Standard output is empty