I cant see rader.
But Other Function is all work.
What happend ?
My Main.cs
My Setting.cs
My Program.cs
Thanks Read.BRO.
http://ift.tt/1NOXG7V
But Other Function is all work.
What happend ?
My Main.cs
Quote:
using System; using System.Text; using System.Data; using System.Drawing; using System.Threading; using System.Reflection; using System.Windows.Forms; using System.Collections.Generic; using System.Runtime.InteropServices; using System.ComponentModel; using System.Diagnostics; using SlimDX.Direct3D9; using SlimDX; using System.Linq; namespace H1Z1ESP { public partial class Main : Form { private delegate void AsyncWrite(String Text); private delegate void AsyncClear(); public static Boolean IsRunning = false; private Int64 CGameOffset = 0x142ADA390; private Int64 GraphicsOffset = 0x142ADA0E8; private Hotkey HotKey; private Settings Settings; private IntPtr GameWindowHandle; private MARGIN GameWindowMargin; private FastMemory GameMemory = new FastMemory(); private RECT GameWindowRect; private POINT GameWindowSize; private POINT GameWindowCenter; public static IniHandler Ini; public static Boolean Aiming = true; private static Boolean Aimed = true; private static ENTITY AimedEntity; private static DateTime AimedUpdate; public static Boolean ShowESP = true; public static Boolean ShowPlayers = true; public static Boolean ShowAggressive = true; public static Boolean ShowAnimals = false; public static Boolean ShowContainers = false; public static Boolean ShowWeapons = true; public static Boolean ShowAmmo = true; public static Boolean ShowItems = true; public static Boolean ShowVehicles = true; public static Boolean HideESPWhenAiming = false; public static Boolean HideDead = true; public static Boolean BoxedPlayers = true; public static Boolean BoxedAggressive = true; public static Boolean BoxedAnimals = false; public static Boolean BoxedItems = false; public static Boolean BoxedVehicles = false; public static Boolean Boxed3D = true; public static Boolean ShowMap = false; public static Boolean ShowRadar = true; public static int RadarTransparency = 210; public static Boolean RadarPlayers = true; public static Boolean RadarAggressive = true; public static Boolean RadarAnimals = false; public static Boolean RadarVehicles = true; public static Boolean ShowEntityLists = true; private static Vector2 RadarCenter; public static Boolean ShowMapLarge = false; public static int MapTransparency = 210; private static float map_pos_x; private static float map_pos_z; public static Boolean ShowPosition = false; public static Boolean ShowCities = true; public static Boolean TextShadow = true; public static POINT TextRegion; public static List<ENTITY> Entity = new List<ENTITY>(); public static Vector3 PlayerPosition = Vector3.Zero; public static float player_X; public static float player_Y; public static float player_Z; public static float player_D; private static SlimDX.Direct3D9.Device DXDevice; private static SlimDX.Direct3D9.Sprite DXSprite; private static SlimDX.Direct3D9.Texture DXTextrureMap; private static SlimDX.Direct3D9.Texture DXTextrureMapLarge; private static SlimDX.Direct3D9.Line DXLine; private static SlimDX.Direct3D9.Font DXFont; [DllImport("shlwapi.dll")] public static extern int ColorHLSToRGB(int H, int L, int S); public Main() { String iniPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Replace(@"file:\", ""); Ini = new IniHandler(iniPath + @"\Settings.ini"); // if (Ini.IniReadValue("Offsets", "CGame") != String.Empty) CGameOffset = Convert.ToInt64(Ini.IniReadValue("Offsets", "CGame"), 16); if (Ini.IniReadValue("Offsets", "Graphics") != String.Empty) GraphicsOffset = Convert.ToInt64(Ini.IniReadValue("Offsets", "Graphics"), 16); // if (Ini.IniReadValue("ESP", "ShowPlayers") != String.Empty) ShowPlayers = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowPlayers")); if (Ini.IniReadValue("ESP", "ShowAggressive") != String.Empty) ShowAggressive = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowAggressive")); if (Ini.IniReadValue("ESP", "ShowAnimals") != String.Empty) ShowAnimals = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowAnimals")); if (Ini.IniReadValue("ESP", "ShowContainers") != String.Empty) ShowContainers = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowContainers")); if (Ini.IniReadValue("ESP", "ShowWeapons") != String.Empty) ShowWeapons = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowWeapons")); if (Ini.IniReadValue("ESP", "ShowAmmo") != String.Empty) ShowAmmo = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowAmmo")); if (Ini.IniReadValue("ESP", "ShowItems") != String.Empty) ShowItems = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowItems")); if (Ini.IniReadValue("ESP", "ShowVehicles") != String.Empty) ShowVehicles = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowVehicles")); // if (Ini.IniReadValue("Boxed", "Players") != String.Empty) BoxedPlayers = Convert.ToBoolean(Ini.IniReadValue("Boxed", "Players")); if (Ini.IniReadValue("Boxed", "Aggressive") != String.Empty) BoxedAggressive = Convert.ToBoolean(Ini.IniReadValue("Boxed", "Aggressive")); if (Ini.IniReadValue("Boxed", "Animals") != String.Empty) BoxedAnimals = Convert.ToBoolean(Ini.IniReadValue("Boxed", "Animals")); if (Ini.IniReadValue("Boxed", "Items") != String.Empty) BoxedItems = Convert.ToBoolean(Ini.IniReadValue("Boxed", "Items")); if (Ini.IniReadValue("Boxed", "Vehicles") != String.Empty) BoxedVehicles = Convert.ToBoolean(Ini.IniReadValue("Boxed", "Vehicles")); if (Ini.IniReadValue("Boxed", "3D") != String.Empty) Boxed3D = Convert.ToBoolean(Ini.IniReadValue("Boxed", "3D")); // if (Ini.IniReadValue("Misc", "ShowPosition") != String.Empty) ShowPosition = Convert.ToBoolean(Ini.IniReadValue("Misc", "ShowPosition")); if (Ini.IniReadValue("Misc", "ShowCities") != String.Empty) ShowCities = Convert.ToBoolean(Ini.IniReadValue("Misc", "ShowCities")); // if (Ini.IniReadValue("Misc", "HideDead") != String.Empty) HideDead = Convert.ToBoolean(Ini.IniReadValue("Misc", "HideDead")); if (Ini.IniReadValue("Misc", "HideESPAiming") != String.Empty) HideESPAiming = Convert.ToBoolean(Ini.IniReadValue("Misc", "HideESPAiming")); // if (Ini.IniReadValue("Map", "LargeMap") != String.Empty) ShowMapLarge = Convert.ToBoolean(Ini.IniReadValue("Map", "LargeMap")); if (Ini.IniReadValue("Map", "Transparency") != String.Empty) MapTransparency = Int32.Parse(Ini.IniReadValue("Map", "Transparency")); // if (Ini.IniReadValue("Radar", "Show") != String.Empty) ShowRadar = Convert.ToBoolean(Ini.IniReadValue("Radar", "Show")); if (Ini.IniReadValue("Radar", "Transparency") != String.Empty) RadarTransparency = Int32.Parse(Ini.IniReadValue("Radar", "Transparency")); if (Ini.IniReadValue("Radar", "Players") != String.Empty) RadarPlayers = Convert.ToBoolean(Ini.IniReadValue("Radar", "Players")); if (Ini.IniReadValue("Radar", "Aggressive") != String.Empty) RadarAggressive = Convert.ToBoolean(Ini.IniReadValue("Radar", "Aggressive")); if (Ini.IniReadValue("Radar", "Animals") != String.Empty) RadarAnimals = Convert.ToBoolean(Ini.IniReadValue("Radar", "Animals")); if (Ini.IniReadValue("Radar", "Vehicles") != String.Empty) RadarVehicles = Convert.ToBoolean(Ini.IniReadValue("Radar", "Vehicles")); if (Ini.IniReadValue("Misc", "ShowEntityLists") != String.Empty) ShowEntityLists = Convert.ToBoolean(Ini.IniReadValue("Misc", "ShowEntityLists")); InitializeComponent(); } public static RECT GetWindowRect(IntPtr hWnd) { RECT lpRect = new RECT(); Native.GetWindowRect(hWnd, out lpRect); return lpRect; } private void Main_Load(object sender, EventArgs e) { HotKey = new Hotkey(); HotKey.enable(this.Handle, Hotkey.Modifiers.None, Keys.Insert); HotKey.enable(this.Handle, Hotkey.Modifiers.Alt, Keys.F1); HotKey.enable(this.Handle, Hotkey.Modifiers.Alt, Keys.F2); HotKey.enable(this.Handle, Hotkey.Modifiers.Alt, Keys.F3); HotKey.enable(this.Handle, Hotkey.Modifiers.Alt, Keys.F5); Native.SetWindowLong(this.Handle, -20, (IntPtr)((Native.GetWindowLong(this.Handle, -20) ^ 0x80000) ^ 0x20)); Native.SetLayeredWindowAttributes(this.Handle, 0, 0xff, 2); PresentParameters parameters = new SlimDX.Direct3D9.PresentParameters(); parameters.Windowed = true; parameters.SwapEffect = SwapEffect.Discard; parameters.BackBufferFormat = Format.A8R8G8B8; parameters.BackBufferHeight = this.Height; parameters.BackBufferWidth = this.Width; parameters.PresentationInterval = PresentInterval.One; DXDevice = new SlimDX.Direct3D9.Device(new Direct3D(), 0, DeviceType.Hardware, this.Handle, CreateFlags.HardwareVertexProcessing, new PresentParameters[] { parameters }); if (System.IO.File.Exists("map_large.png")) DXTextrureMapLarge = SlimDX.Direct3D9.Texture.FromFile(DXDevice, "map_large.png"); if (System.IO.File.Exists("map.png")) DXTextrureMap = SlimDX.Direct3D9.Texture.FromFile(DXDevice, "map.png"); DXSprite = new SlimDX.Direct3D9.Sprite(DXDevice); DXLine = new SlimDX.Direct3D9.Line(DXDevice); DXFont = new SlimDX.Direct3D9.Font(DXDevice, new System.Drawing.Font("Tahoma", 8f)); if (this.GameMemory.Attach("H1Z1 PlayClient (Live)") == false) { Application.Exit(); return; } Thread dxThread = new Thread(new ThreadStart(DoProcess)); dxThread.IsBackground = true; dxThread.Start(); //Thread aimThread = new Thread(new ThreadStart(DoAiming)); //aimThread.IsBackground = true; //aimThread.Start(); } private void Main_Paint(object sender, PaintEventArgs e) { this.GameWindowMargin.Top = 0; this.GameWindowMargin.Left = 0; this.GameWindowMargin.Right = this.Width; this.GameWindowMargin.Bottom = this.Height; Native.DwmExtendFrameIntoClientArea(this.Handle, ref this.GameWindowMargin); } #region RemapValue public static float RemapValue(float value, float from1, float to1, float from2, float to2) { return ((((value - from1) / (to1 - from1)) * (to2 - from2)) + from2); } #endregion #region DrawFilledBox public static void DrawFilledBox(float x, float y, float w, float h, Color Color, int alpha = 255) { Vector2[] vertexList = new Vector2[2]; DXLine.GLLines = true; DXLine.Antialias = false; DXLine.Width = w; vertexList[0].X = x + (w / 2f); vertexList[0].Y = y; vertexList[1].X = x + (w / 2f); vertexList[1].Y = y + h; DXLine.Begin(); DXLine.Draw(vertexList, Color.FromArgb(alpha, Color.R, Color.G, Color.B)); DXLine.End(); } #endregion #region RotatePoint private static Vector2 RotatePoint(Vector2 pointToRotate, Vector2 centerPoint, float angle, bool angleInRadians = false) { if (!angleInRadians) angle = (float)(angle * 0.017453292519943295); float num = (float)Math.Cos((double)angle); float num2 = (float)Math.Sin((double)angle); Vector2 vector = new Vector2((num * (pointToRotate.X - centerPoint.X)) - (num2 * (pointToRotate.Y - centerPoint.Y)), (num2 * (pointToRotate.X - centerPoint.X)) + (num * (pointToRotate.Y - centerPoint.Y))); return (vector + centerPoint); } #endregion #region GetMatrixAxis private static Vector3 GetMatrixAxis(Matrix matrix, int i) { switch (i) { case 0: return new Vector3(matrix.M11, matrix.M12, matrix.M13); case 1: return new Vector3(matrix.M21, matrix.M22, matrix.M23); case 2: return new Vector3(matrix.M31, matrix.M32, matrix.M33); case 3: return new Vector3(matrix.M41, matrix.M42, matrix.M43); } return Vector3.Zero; } #endregion #region WorldToScreen private bool WorldToScreen(Vector3 vector, out Vector3 screen) { screen = Vector3.Zero; long num = this.GameMemory.ReadInt64(GraphicsOffset); long num2 = this.GameMemory.ReadInt64(num + 0x48L); long num3 = this.GameMemory.ReadInt64(num2 + 0x20L) + 0x10L; Matrix4 matrix = this.GameMemory.ReadMatrix(num3 + 0x1a0L); Matrix matrix2 = new Matrix(); matrix2.M11 = matrix.M11; matrix2.M12 = matrix.M12; matrix2.M13 = matrix.M13; matrix2.M14 = matrix.M14; matrix2.M21 = matrix.M21; matrix2.M22 = matrix.M22; matrix2.M23 = matrix.M23; matrix2.M24 = matrix.M24; matrix2.M31 = matrix.M31; matrix2.M32 = matrix.M32; matrix2.M33 = matrix.M33; matrix2.M34 = matrix.M34; matrix2.M41 = matrix.M41; matrix2.M42 = matrix.M42; matrix2.M43 = matrix.M43; matrix2.M44 = matrix.M44; Matrix.Transpose(ref matrix2, out matrix2); matrix2.M21 *= -1f; matrix2.M22 *= -1f; matrix2.M23 *= -1f; matrix2.M24 *= -1f; float introduced8 = Vector3.Dot(GetMatrixAxis(matrix2, 3), vector); float num4 = introduced8 + matrix2.M44; if (num4 < 0.098f) return false; float introduced9 = Vector3.Dot(GetMatrixAxis(matrix2, 0), vector); float num5 = introduced9 + matrix2.M14; float introduced10 = Vector3.Dot(GetMatrixAxis(matrix2, 1), vector); float num6 = introduced10 + matrix2.M24; screen.X = ((((this.GameWindowSize.X - 0x10) / 2) * (1f + (num5 / num4))) + this.GameWindowRect.Left) + 8f; screen.Y = ((((this.GameWindowSize.Y - 0x26) / 2) * (1f - (num6 / num4))) + this.GameWindowRect.Top) + 30f; return true; } #endregion #region DrawLine public static void DrawLine(float x1, float y1, float x2, float y2, float w, Color Color) { Vector2[] vertexList = new Vector2[] { new Vector2(x1, y1), new Vector2(x2, y2) }; DXLine.GLLines = true; DXLine.Width = w; DXLine.Antialias = true; DXLine.Begin(); DXLine.Draw(vertexList, Color); DXLine.End(); } #endregion #region DrawText public static void DrawText(string text, int x, int y, Color color, bool center = false) { int offset = center ? (text.Length * 5) / 2 : 0; if (TextShadow) DXFont.DrawString(null, text, x - offset + 1, y + 1, (Color4)Color.Black); DXFont.DrawString(null, text, x - offset, y, (Color4)color); } public static void DrawText(string text, ref POINT point, Color color) { if (TextShadow) DXFont.DrawString(null, text, point.X + 1, point.Y + 1, (Color4)Color.Black); DXFont.DrawString(null, text, point.X, point.Y, (Color4)color); point.Y += 15; } #endregion #region DrawBox public static void DrawBox(float x, float y, float w, float h, float px, Color Color) { DrawFilledBox(x - (w / 2f), (y + h) - (h / 2f), w, px, Color); DrawFilledBox((x - (w / 2f)) - px, y - (h / 2f), px, h, Color); DrawFilledBox(x - (w / 2f), (y - px) - (h / 2f), w, px, Color); DrawFilledBox((x - (w / 2f)) + w, y - (h / 2f), px, h, Color); } #endregion #region DrawBoxAbs public static void DrawBoxAbs(float x, float y, float w, float h, float px, Color Color) { DrawFilledBox(x, y + h, w, px, Color); DrawFilledBox(x - px, y, px, h, Color); DrawFilledBox(x, y - px, w, px, Color); DrawFilledBox(x + w, y, px, h, Color); } #endregion #region EntityToScreen public void EntityToScreen(Vector3 pos, string name, Color color, bool dist, bool line, bool bounds, float boxHeight, float yaw, float pitch) { string text = name; Vector3 dest = Vector3.Zero; this.WorldToScreen(pos, out dest); double distX = pos.X - player_X; double distY = pos.Z - player_Z; double distZ = pos.Y - player_Y; double a = Math.Sqrt(((distX * distX) + (distY * distY)) + (distZ * distZ)); if (dest.Y > 0f && dest.X > 0f && dest.Y >= this.GameWindowRect.Top + 20 && dest.X >= this.GameWindowRect.Left && dest.X <= this.GameWindowRect.Right && dest.Y <= this.GameWindowRect.Bottom) { if (dist) { text = text + " [" + Math.Round(a).ToString() + "m]"; } if (line) { DrawLine(dest.X, dest.Y, this.GameWindowCenter.X, this.GameWindowCenter.Y, 1f, color); } if (bounds) { if (!Boxed3D || a >= 100.0) { DrawBox(dest.X, dest.Y, 65f / Math.Max((float)(((float)a) / 10f), (float)0.2f), 150f / Math.Max((float)(((float)a) / 10f), (float)0.2f), 1f, color); } else if (a < 100.0) { float wOffset = (boxHeight < 1f) ? boxHeight : 1f; float zOffset = (boxHeight > 1f) ? boxHeight / 2 : 0f; double num5 = pos.Z + ((1.0 * Math.Cos((double)pitch)) * Math.Cos((double)yaw)); double num6 = pos.X + ((1.0 * Math.Cos((double)pitch)) * Math.Sin((double)yaw)); double num7 = pos.Y + (1.0 * Math.Sin((double)pitch)); Vector3 vector = new Vector3((float)num6, (float)num7, (float)num5); Vector3 zero = Vector3.Zero; this.WorldToScreen(vector, out zero); DrawLine(dest.X, dest.Y, zero.X, zero.Y, 1f, color); num5 = pos.Z + (0.5 * Math.Cos(yaw + 0.78539816339744828)); num6 = pos.X + (0.5 * Math.Sin(yaw + 0.78539816339744828)); Vector3 vector4 = new Vector3((float)num6, pos.Y - zOffset, (float)num5); Vector3 screen = Vector3.Zero; this.WorldToScreen(vector4, out screen); num5 = pos.Z + (0.5 * Math.Cos(yaw + 5.497787143782138)); num6 = pos.X + (0.5 * Math.Sin(yaw + 5.497787143782138)); Vector3 vector6 = new Vector3((float)num6, pos.Y - zOffset, (float)num5); Vector3 vector7 = Vector3.Zero; this.WorldToScreen(vector6, out vector7); DrawLine(screen.X, screen.Y, vector7.X, vector7.Y, 1f, color); num5 = pos.Z + (0.5 * Math.Cos(yaw + 3.9269908169872414)); num6 = pos.X + (0.5 * Math.Sin(yaw + 3.9269908169872414)); Vector3 vector8 = new Vector3((float)num6, pos.Y - zOffset, (float)num5); Vector3 vector9 = Vector3.Zero; this.WorldToScreen(vector8, out vector9); DrawLine(vector7.X, vector7.Y, vector9.X, vector9.Y, 1f, color); num5 = pos.Z + (0.5 * Math.Cos(yaw + 2.3561944901923448)); num6 = pos.X + (0.5 * Math.Sin(yaw + 2.3561944901923448)); Vector3 vector10 = new Vector3((float)num6, pos.Y - zOffset, (float)num5); Vector3 vector11 = Vector3.Zero; this.WorldToScreen(vector10, out vector11); DrawLine(vector9.X, vector9.Y, vector11.X, vector11.Y, 1f, color); DrawLine(vector11.X, vector11.Y, screen.X, screen.Y, 1f, color); Vector3 vector12 = new Vector3(vector4.X, vector4.Y + boxHeight, vector4.Z); Vector3 vector13 = Vector3.Zero; this.WorldToScreen(vector12, out vector13); DrawLine(screen.X, screen.Y, vector13.X, vector13.Y, 1f, color); Vector3 vector14 = new Vector3(vector6.X, vector6.Y + boxHeight, vector6.Z); Vector3 vector15 = Vector3.Zero; this.WorldToScreen(vector14, out vector15); DrawLine(vector13.X, vector13.Y, vector15.X, vector15.Y, 1f, color); DrawLine(vector7.X, vector7.Y, vector15.X, vector15.Y, 1f, color); Vector3 vector16 = new Vector3(vector8.X, vector8.Y + boxHeight, vector8.Z); Vector3 vector17 = Vector3.Zero; this.WorldToScreen(vector16, out vector17); DrawLine(vector15.X, vector15.Y, vector17.X, vector17.Y, 1f, color); DrawLine(vector9.X, vector9.Y, vector17.X, vector17.Y, 1f, color); Vector3 vector18 = new Vector3(vector10.X, vector10.Y + boxHeight, vector10.Z); Vector3 vector19 = Vector3.Zero; this.WorldToScreen(vector18, out vector19); DrawLine(vector17.X, vector17.Y, vector19.X, vector19.Y, 1f, color); DrawLine(vector11.X, vector11.Y, vector19.X, vector19.Y, 1f, color); DrawLine(vector19.X, vector19.Y, vector13.X, vector13.Y, 1f, color); } } DrawText(text, (int)dest.X, (int)dest.Y - 20, color, true); } } #endregion public void DoProcess() { Main.IsRunning = true; this.GameWindowHandle = this.GameMemory.Process.MainWindowHandle; Native.SetForegroundWindow(this.GameWindowHandle); while (this.GameWindowHandle != IntPtr.Zero && Main.IsRunning && this.GameMemory.IsOpen) { this.GameWindowRect = GetWindowRect(this.GameWindowHandle); this.GameWindowSize.X = this.GameWindowRect.Right - this.GameWindowRect.Left; this.GameWindowSize.Y = this.GameWindowRect.Bottom - this.GameWindowRect.Top; this.GameWindowCenter.X = this.GameWindowRect.Left + (this.GameWindowSize.X / 2); this.GameWindowCenter.Y = this.GameWindowRect.Top + (this.GameWindowSize.Y / 2) + 11; DXDevice.Clear(ClearFlags.Target, Color.FromArgb(0, 0, 0, 0), 1f, 0); DXDevice.SetRenderState(RenderState.ZEnable, false); DXDevice.SetRenderState(RenderState.Lighting, false); DXDevice.SetRenderState<Cull>(RenderState.CullMode, Cull.None); DXDevice.BeginScene(); long entityOffset = this.GameMemory.ReadInt64(CGameOffset); long playerOffset = this.GameMemory.ReadInt64(entityOffset + 0x11D8); player_X = this.GameMemory.ReadFloat(playerOffset + 0x210); player_Y = this.GameMemory.ReadFloat(playerOffset + 0x214); player_Z = this.GameMemory.ReadFloat(playerOffset + 0x218); player_D = this.GameMemory.ReadFloat(playerOffset + 0x240); long posOffset = this.GameMemory.ReadInt64(playerOffset + 0x198); player_X = this.GameMemory.ReadFloat(posOffset + 0x110); player_Y = this.GameMemory.ReadFloat(posOffset + 0x114); player_Z = this.GameMemory.ReadFloat(posOffset + 0x118); PlayerPosition.X = player_X; PlayerPosition.Y = player_Y; PlayerPosition.Z = player_Z; TextRegion = new POINT(this.GameWindowRect.Left + 15, this.GameWindowRect.Top + 35); if (ShowPosition) { DrawText("X: " + player_X.ToString("F1"), ref TextRegion, Color.White); DrawText("Y: " + player_Y.ToString("F1"), ref TextRegion, Color.White); DrawText("Z: " + player_Z.ToString("F1"), ref TextRegion, Color.White); } ShowESP = (!HideESPWhenAiming || Convert.ToBoolean(Native.GetAsyncKeyState(2) & 0x8000) == false); Entity.Clear(); Aimed = false; int entityCount = this.GameMemory.ReadInt32(entityOffset + 0x688); long entityEntry = this.GameMemory.ReadInt64(playerOffset + 0x410); for (int i = 1; i < entityCount; i++) { float EntityX = 0; float EntityY = 0; float EntityZ = 0; float EntityYaw = 0; float EntityPitch = 0; float EntitySpeed = 0; int EntityType = this.GameMemory.ReadInt32(entityEntry + 0x5C8); if (EntityType == 0) continue; int EntityId = this.GameMemory.ReadInt32(entityEntry + 0x620); long _nameEntry = this.GameMemory.ReadInt64(entityEntry + 0x4E0); String EntityName = this.GameMemory.ReadString(_nameEntry, this.GameMemory.ReadInt32(entityEntry + 0x4E8)); // Player Position // if (EntityType == 0x04) { posOffset = this.GameMemory.ReadInt64(entityEntry + 0x198); EntityX = this.GameMemory.ReadFloat(posOffset + 0x110); EntityY = this.GameMemory.ReadFloat(posOffset + 0x114); EntityZ = this.GameMemory.ReadFloat(posOffset + 0x118); EntitySpeed = this.GameMemory.ReadFloat(entityEntry + 0x2C8); EntityYaw = this.GameMemory.ReadFloat(entityEntry + 0x2E0); } // Vechicle Position // else if (EntityType == 0x11 || EntityType == 0x72 || EntityType == 0x76) { EntityX = this.GameMemory.ReadFloat(entityEntry + 0x250); EntityY = this.GameMemory.ReadFloat(entityEntry + 0x254); EntityZ = this.GameMemory.ReadFloat(entityEntry + 0x258); EntitySpeed = this.GameMemory.ReadFloat(entityEntry + 0x2C8); } else { // Try Get NPC Position // EntityX = this.GameMemory.ReadFloat(entityEntry + 0x198); if (EntityX == 0) { // Item Position // EntityX = this.GameMemory.ReadFloat(entityEntry + 0x13F0); EntityY = this.GameMemory.ReadFloat(entityEntry + 0x13F4); EntityZ = this.GameMemory.ReadFloat(entityEntry + 0x13F8); } else { // NPC Position // posOffset = this.GameMemory.ReadInt64(entityEntry + 0x198); EntityX = this.GameMemory.ReadFloat(posOffset + 0x110); EntityY = this.GameMemory.ReadFloat(posOffset + 0x114); EntityZ = this.GameMemory.ReadFloat(posOffset + 0x118); EntitySpeed = this.GameMemory.ReadFloat(entityEntry + 0x2C8); EntityYaw = this.GameMemory.ReadFloat(entityEntry + 0x2E0); } } // Create New Entity // ENTITY currentEntity = new ENTITY() { Id = EntityId, Type = EntityType, Name = EntityName, Pos = new Vector3(EntityX, EntityY, EntityZ), Distance = Vector3.Distance(new Vector3(EntityX, EntityY, EntityZ), PlayerPosition), Yaw = EntityYaw, Pitch = EntityPitch, Speed = EntitySpeed }; // Append New Entity // Entity.Add(currentEntity); switch (EntityType) { case 0x04/*Player*/: case 0x0C/*Zombie*/: case 0x13/*Deer*/: case 0x14/*Wolf*/: case 0x50/*Bear*/: case 0x55/*Rabbit*/: case 0x5b/*Zombie*/: // Aiming // Vector3 aimingTo = Vector3.Zero; if (Aimed == true || currentEntity.Distance > 300f || this.GameMemory.ReadByte(entityEntry + 0x137C) != 1) { /* Already aimed, not in range, entity is dead */ } else if (ModifierKeys.HasFlag(Keys.Control) || Convert.ToBoolean(Native.GetAsyncKeyState(Keys.XButton1) & 0x8000) == true) { if (AimedEntity != null && AimedEntity.Id == currentEntity.Id) { if (Convert.ToBoolean(this.GameMemory.ReadByte(entityEntry + 0x137C)) == false) { // Target is dead // AimedEntity = null; } else { Aimed = true; AimedEntity = currentEntity; Vector3 AIM; float offsetY = 1.7f; if (AimedEntity.Type == 0x55) offsetY = 0.20f; if (AimedEntity.Type == 0x13) offsetY = 0.75f; if (AimedEntity.Type == 0x14) offsetY = 0.50f; if (AimedEntity.Type == 0x50) offsetY = 0.65f; if (WorldToScreen(new Vector3(AimedEntity.Pos.X, AimedEntity.Pos.Y + offsetY, AimedEntity.Pos.Z), out AIM)) { int moveOffsetX = (int)(Math.Round(AIM.X) - this.GameWindowCenter.X) / 2; int moveOffsetY = (int)(Math.Round(AIM.Y) - this.GameWindowCenter.Y) / 2; DrawText("Aimed at " + AimedEntity.Name + ": " + moveOffsetX + ", " + moveOffsetY, ref TextRegion, Color.Red); if (moveOffsetX != 0 || moveOffsetY != 0) Native.mouse_event(0x0001, (short)moveOffsetX, (short)moveOffsetY, 0, 0); } } } else if (AimedEntity == null && WorldToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), out aimingTo)) { float distance = Vector2.Distance(new Vector2(aimingTo.X, aimingTo.Y), new Vector2(this.GameWindowCenter.X, this.GameWindowCenter.Y)); if (distance < 100f) { AimedEntity = currentEntity; Aimed = true; float moveOffsetX = aimingTo.X - this.GameWindowCenter.X; float moveOffsetY = aimingTo.Y - this.GameWindowCenter.Y; Native.mouse_event(0x0001, (short)moveOffsetX, (short)moveOffsetY, 0, 0); } } } else { AimedEntity = null; } // Show Entity when ESP enabled // if (ShowESP) { Byte EntityAlive = this.GameMemory.ReadByte(entityEntry + 0x137C); if (HideDead == false || Convert.ToBoolean(EntityAlive) == true) { // Deer or Rabbit // if (EntityType == 0x13 || EntityType == 0x55) { if (ShowAnimals) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.DarkGreen, true, false, BoxedAnimals, 2f, EntityYaw, EntityPitch); } // Player // else if (EntityType == 0x04) { // Show HP long num22 = this.GameMemory.ReadInt64(entityEntry + 0x4068L); // old 0x3fa8L uint num23 = this.GameMemory.ReadUInt32(num22); for (uint j = 1; (num23 != 0x30) && (j < 50); j++) { num22 = this.GameMemory.ReadInt64(num22 + 0xf8L); num23 = this.GameMemory.ReadUInt32(num22); } uint playerHP = this.GameMemory.ReadUInt32(num22 + 0xb0L) / 100; int Hue = (int)(120f * (float)playerHP / 100f); // Hue red at 0° green at 120° Color color = ColorTranslator.FromWin32(ColorHLSToRGB(Hue, 120, 240)); // H,L,S; string playerNameHP = EntityName + " " + playerHP.ToString() + "%"; if (ShowPlayers) this.EntityToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), playerNameHP, color, true, false, BoxedPlayers, 2f, EntityYaw, EntityPitch); //if (ShowPlayers) this.EntityToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), EntityName, Color.SkyBlue, true, false, BoxedPlayers, 2f, EntityYaw, EntityPitch); } // Aggressive NPC (Wolf, Bear, Zombies) // else { if (ShowAggressive) this.EntityToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), EntityName, Color.Red, true, false, BoxedAggressive, 2f, EntityYaw, EntityPitch); } } } break; case 0x2E: // Loot if (ShowESP && ShowItems) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.GreenYellow, true, false, BoxedItems, 1f, 0f, 0f); break; case 0x6D: // Stash case 0x9C: // Land Mine if (ShowESP && ShowItems) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.SaddleBrown, true, false, BoxedItems, 1f, 0f, 0f); break; case 0x33: // Storage Container if (ShowESP && ShowContainers) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Gray, true, false, BoxedItems, 1f, 0f, 0f); break; case 0x34: // Weapons if (ShowESP && ShowWeapons) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.GreenYellow, true, false, BoxedItems, 1f, 0f, 0f); break; case 0x15: // Ammo if (ShowESP && ShowAmmo) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Orange, true, false, BoxedItems, 1f, 0f, 0f); break; case 0x11: // OffRoad case 0x72: // Pickup case 0x76: // PoliceCar if (ShowESP && ShowVehicles) this.EntityToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), EntityName, Color.HotPink, true, false, BoxedVehicles, 2f, 0f, 0f); break; case 0x2C: // Battery & Sparkplugs if (ShowESP && ShowItems) { if (EntityName.Contains("Battery") || EntityName.Contains("Sparkplugs")) { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.DeepPink, true, false, BoxedItems, 1f, 0f, 0f); } else { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.White, true, false, BoxedItems, 1f, 0f, 0f); } } break; case 0x16: // Dresser case 0x17: // Armoire case 0x19: // World Doors case 0x1D: // Cabinets case 0x1E: // Cabinets case 0x21: // Cabinets case 0x22: // Cabinets case 0x23: // Cabinets case 0x25: // Refrigerator case 0x26: // Garbage Can case 0x28: // Cabinets case 0x29: // Desk case 0x27: // Dumpster case 0x30: // File Cabinet case 0x31: // Tool Cabinet case 0x37: // Recycle Bin (with fire) case 0x38: // Punji Sticks case 0x3D: // Wooded Barricade case 0x3E: // Water Well case 0x3F: // Armoire case 0x40: // Dresser case 0x42: // Chest case 0x44: // Wrecked Sedan case 0x45: // Wrecked Van case 0x46: // Wrecked Truck case 0x49: // Ottoman case 0x4A: // Ottoman case 0x4F: // Designer-placed(?) Door case 0x5D: // File Cabinet case 0x61: // Cabinets case 0x63: // Cabinets case 0x6F: // Locker case 0x70: // Weapon Locker case 0x71: // Glass Cabinet case 0x79: // Designer-placed(?) Door case 0x7A: // Resting (Bed) case 0x7B: // Designer-placed(?) Door case 0x7C: // Designer-placed(?) Door case 0x80: // Cabinets case 0x81: // Cabinets case 0x82: // Cabinets case 0x83: // Cabinets case 0x84: // Cabinets case 0x85: // Cabinets case 0x86: // Cabinets case 0x87: // Cabinets case 0x88: // Cabinets case 0xA1: // Washing Machine case 0xA2: // Dryer case 0x7D: // IO.FireHydrant case 0x7E: // IO.FireHydrant //this.WorldToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName + "[" + EntityId.ToString("X2") + "]", Color.Gray, true, false, false, 0f, 0f); break; case 0x4C: // Shed case 0x5F: // Metal Wall/Gate case 0x62: // Basic Shack Door case 0x6E: // Desk Foundation case 0x9E: // Metal Door case 0xA6: // Large Shelter case 0xA7: // Shed //this.WorldToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName + "[" + EntityId.ToString("X2") + "]", Color.Gray, true, false, false, 0f, 0f); break; default: // Other Items //if (ShowESP && ShowItems) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName + "[" + EntityType.ToString("X2") + "]", Color.White, true, false, false, 1f, 0f, 0f); break; } entityEntry = this.GameMemory.ReadInt64(entityEntry + 0x410); } if (Aimed == false) AimedEntity = null; if (ShowEntityLists) { ENTITY[] playerList = Entity.Where(E => E.Type == 0x04).OrderBy(E => E.Distance).ToArray(); ENTITY[] aggressiveList = Entity.Where(E => E.Type == 0x0C || E.Type == 0x14 || E.Type == 0x50 || E.Type == 0x5b).OrderBy(E => E.Distance).ToArray(); ENTITY[] animalsList = Entity.Where(E => E.Type == 0x13 || E.Type == 0x55).OrderBy(E => E.Distance).ToArray(); ENTITY[] vehiclesList = Entity.Where(E => E.Type == 0x11 || E.Type == 0x72 || E.Type == 0x76).OrderBy(E => E.Distance).ToArray(); ENTITY[] ammoList = Entity.Where(E => E.Type == 0x15).OrderBy(E => E.Distance).ToArray(); int itemY = (aggressiveList.Length > 10 ? 150 : aggressiveList.Length * 15); foreach (ENTITY entity in aggressiveList) { DrawText(entity.Name + " [" + Math.Round(entity.Distance).ToString() + " m]", this.GameWindowRect.Left + 20, this.GameWindowRect.Bottom - itemY - 15, Color.Red); itemY -= 15; if (itemY <= 0) break; } itemY = (animalsList.Length > 10 ? 150 : animalsList.Length * 15); foreach (ENTITY entity in animalsList) { DrawText(entity.Name + " [" + Math.Round(entity.Distance).ToString() + " m]", this.GameWindowRect.Left + 120, this.GameWindowRect.Bottom - itemY - 15, Color.Green); itemY -= 15; if (itemY <= 0) break; } itemY = (vehiclesList.Length > 10 ? 150 : vehiclesList.Length * 15); foreach (ENTITY entity in vehiclesList) { DrawText(entity.Name + " [" + Math.Round(entity.Distance).ToString() + " m]", this.GameWindowRect.Left + 220, this.GameWindowRect.Bottom - itemY - 15, Color.HotPink); itemY -= 15; if (itemY <= 0) break; } itemY = (playerList.Length > 10 ? 150 : playerList.Length * 15); foreach (ENTITY entity in playerList) { DrawText(entity.Name + " [" + Math.Round(entity.Distance).ToString() + " m]", this.GameWindowRect.Left + 320, this.GameWindowRect.Bottom - itemY - 15, Color.SkyBlue); itemY -= 15; if (itemY <= 0) break; } itemY = (ammoList.Length > 10 ? 150 : ammoList.Length * 15); foreach (ENTITY entity in ammoList) { DrawText(entity.Name + " [" + Math.Round(entity.Distance).ToString() + " m]", this.GameWindowRect.Left + 440, this.GameWindowRect.Bottom - itemY - 15, Color.Orange); itemY -= 15; if (itemY <= 0) break; } } if (ShowRadar) { DrawFilledBox(this.GameWindowRect.Right - 225, this.GameWindowRect.Top + 50, 201f, 201f, Color.DimGray, RadarTransparency); DrawBoxAbs(this.GameWindowRect.Right - 225, this.GameWindowRect.Top + 50, 201f, 201f, 1f, Color.Black); DrawLine(this.GameWindowRect.Right - 125, this.GameWindowRect.Top + 50, this.GameWindowRect.Right - 125, this.GameWindowRect.Top + 251, 1f, Color.Black); DrawLine(this.GameWindowRect.Right - 225, this.GameWindowRect.Top + 150, this.GameWindowRect.Right - 24, this.GameWindowRect.Top + 150, 1f, Color.Black); RadarCenter = new Vector2(this.GameWindowRect.Right - 125, this.GameWindowRect.Top + 125 + 25); DrawFilledBox(RadarCenter.X - 1f, RadarCenter.Y - 1f, 3f, 3f, Color.White); if (RadarCenter.Length() > 0f) { foreach (ENTITY entity in Entity) { Vector2 pointToRotate = new Vector2(entity.Pos.X, entity.Pos.Z); Vector2 vector3 = new Vector2(player_X, player_Z); pointToRotate = vector3 - pointToRotate; float num30 = pointToRotate.Length() * 0.5f; num30 = Math.Min(num30, 90f); pointToRotate.Normalize(); pointToRotate = (Vector2)(pointToRotate * num30); pointToRotate += RadarCenter; pointToRotate = RotatePoint(pointToRotate, RadarCenter, player_D, true); if (entity.Type == 0x04 && RadarPlayers) { DrawFilledBox(pointToRotate.X, pointToRotate.Y, 3f, 3f, Color.SkyBlue); } if ((entity.Type == 0x0C || entity.Type == 0x14 || entity.Type == 0x50 || entity.Type == 0x5b) && RadarAggressive) { DrawFilledBox(pointToRotate.X, pointToRotate.Y, 3f, 3f, Color.Red); } if ((entity.Type == 0x13 || entity.Type == 0x55) && RadarAnimals) { DrawFilledBox(pointToRotate.X, pointToRotate.Y, 3f, 3f, Color.LightGreen); } if ((entity.Type == 0x11 || entity.Type == 0x72 || entity.Type == 0x76) && RadarVehicles) { DrawFilledBox(pointToRotate.X, pointToRotate.Y, 3f, 3f, Color.HotPink); } } } } if (ShowCities) { this.EntityToScreen(new Vector3(-129f, 40f, -1146f), "Pleasant Valley", Color.DarkViolet, true, false, false, 1f, 0f, 0f); this.EntityToScreen(new Vector3(-1233f, 90f, 1855f), "Cranberry", Color.DarkViolet, true, false, false, 1f, 0f, 0f); this.EntityToScreen(new Vector3(2003f, 50f, 2221f), "Ranchito", Color.DarkViolet, true, false, false, 1f, 0f, 0f); this.EntityToScreen(new Vector3(750f, 175f, 3750f), "Base", Color.DarkViolet, true, false, false, 1f, 0f, 0f); } if (Main.ShowMap && (DXTextrureMap != null || DXTextrureMapLarge != null)) { DXSprite.Begin(SpriteFlags.AlphaBlend); if (Main.ShowMapLarge && DXTextrureMapLarge != null) { map_pos_x = RemapValue(player_X, 4000f, -4000f, -512f, 512f); map_pos_z = RemapValue(player_Z, -4000f, 4000f, -512f, 512f); DXSprite.Draw(DXTextrureMapLarge, new Vector3(512f, 512f, 0f), new Vector3(this.GameWindowCenter.X, this.GameWindowCenter.Y, 0f), Color.FromArgb(MapTransparency, 0xff, 0xff, 0xff)); } else if (DXTextrureMap != null) { map_pos_x = RemapValue(player_X, 4000f, -4000f, -265f, 265f); map_pos_z = RemapValue(player_Z, -4000f, 4000f, -265f, 265f); DXSprite.Draw(DXTextrureMap, new Vector3(256f, 256f, 0f), new Vector3(this.GameWindowCenter.X, this.GameWindowCenter.Y, 0f), Color.FromArgb(MapTransparency, 0xff, 0xff, 0xff)); } DXSprite.End(); float direction = Main.player_D * -1f; float fromX = (float)((this.GameWindowCenter.X + map_pos_z) + (20.0 * Math.Cos(direction))); float fromY = (float)((this.GameWindowCenter.Y + map_pos_x) + (20.0 * Math.Sin(direction))); DrawFilledBox((this.GameWindowCenter.X + map_pos_z) - 2f, (this.GameWindowCenter.Y + map_pos_x) - 2f, 6f, 6f, Color.Magenta); DrawLine(fromX, fromY, (this.GameWindowCenter.X + map_pos_z) + 1f, (this.GameWindowCenter.Y + map_pos_x) + 1f, 1f, Color.PaleVioletRed); } DXDevice.EndScene(); DXDevice.Present(); Thread.Sleep(1); } DXDevice.Dispose(); Application.Exit(); } public void DoAiming() { while (true) { if (Aimed == true && AimedEntity != null) { } Thread.Sleep(1); } } protected override void WndProc(ref Message m) { if (m.Msg == 0x312) { switch ((int)m.WParam) { case 0: if (this.Settings != null && this.Settings.Visible) { this.Settings.Close(); break; } this.Settings = new Settings(); this.Settings.Show(); this.Settings.Location = new Point(this.GameWindowRect.Right - this.Settings.Width - 20, this.GameWindowRect.Top + 200); Native.SetForegroundWindow(this.GameMemory.Process.MainWindowHandle); break; case 1: ShowRadar = !ShowRadar; Main.Ini.IniWriteValue("Radar", "Show", ShowRadar.ToString()); break; case 2: ShowMap = !ShowMap; break; case 3: ShowMapLarge = !ShowMapLarge; Main.Ini.IniWriteValue("Map", "LargeMap", Main.ShowMapLarge.ToString()); break; case 4: Main.IsRunning = false; break; } } base.WndProc(ref m); } public static void MoveMouse(int xDelta, int yDelta) { Native.mouse_event(1, xDelta, yDelta, 0u, 0u); } public static void MoveMouseTo(int x, int y) { Native.mouse_event(0x8000, x, y, 0, 0); Native.mouse_event(1, x, y, 0, 0); } public static bool HideESPAiming { get; set; } public bool Aimbot { get; set; } private void Main_MouseClick(object sender, MouseEventArgs e) { //Native.mouse_event(2, 0, 0, 0, 0); Native.mouse_event(4, 0, 0, 0, 0); } } } |
My Setting.cs
Quote:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace H1Z1ESP { public partial class Settings : Form { public Settings() { InitializeComponent(); this.showPlayers.Checked = Main.ShowPlayers; this.showAggressive.Checked = Main.ShowAggressive; this.snowAnimals.Checked = Main.ShowAnimals; this.showContainers.Checked = Main.ShowContainers; this.showWeapons.Checked = Main.ShowWeapons; this.showAmmo.Checked = Main.ShowAmmo; this.showItems.Checked = Main.ShowItems; this.mapLarge.Checked = Main.ShowMapLarge; this.mapTransparency.Value = Main.MapTransparency; this.showPosition.Checked = Main.ShowPosition; this.showCities.Checked = Main.ShowCities; this.hideDead.Checked = Main.HideDead; } private void showPlayers_CheckedChanged(object sender, EventArgs e) { Main.ShowPlayers = this.showPlayers.Checked; Main.Ini.IniWriteValue("ESP", "ShowPlayers", Main.ShowPlayers.ToString()); } private void showAggressive_CheckedChanged(object sender, EventArgs e) { Main.ShowAggressive = this.showAggressive.Checked; Main.Ini.IniWriteValue("ESP", "ShowAggressive", Main.ShowAggressive.ToString()); } private void snowAnimals_CheckedChanged(object sender, EventArgs e) { Main.ShowAnimals = this.snowAnimals.Checked; Main.Ini.IniWriteValue("ESP", "ShowAnimals", Main.ShowAnimals.ToString()); } private void showContainers_CheckedChanged(object sender, EventArgs e) { Main.ShowContainers = this.showContainers.Checked; Main.Ini.IniWriteValue("ESP", "ShowContainers", Main.ShowContainers.ToString()); } private void showWeapons_CheckedChanged(object sender, EventArgs e) { Main.ShowWeapons = this.showWeapons.Checked; Main.Ini.IniWriteValue("ESP", "ShowWeapons", Main.ShowWeapons.ToString()); } private void showAmmo_CheckedChanged(object sender, EventArgs e) { Main.ShowAmmo = this.showAmmo.Checked; Main.Ini.IniWriteValue("ESP", "ShowAmmo", Main.ShowAmmo.ToString()); } private void showItems_CheckedChanged(object sender, EventArgs e) { Main.ShowItems = this.showItems.Checked; Main.Ini.IniWriteValue("ESP", "ShowItems", Main.ShowItems.ToString()); } private void mapLarge_CheckedChanged(object sender, EventArgs e) { Main.ShowMapLarge = this.mapLarge.Checked; Main.Ini.IniWriteValue("Map", "LargeMap", Main.ShowMapLarge.ToString()); } private void mapTransparency_Scroll(object sender, EventArgs e) { Main.MapTransparency = this.mapTransparency.Value; Main.Ini.IniWriteValue("Map", "Transparency", Main.MapTransparency.ToString()); } private void showPosition_CheckedChanged(object sender, EventArgs e) { Main.ShowPosition = this.showPosition.Checked; Main.Ini.IniWriteValue("Misc", "ShowPosition", Main.ShowPosition.ToString()); } private void showCities_CheckedChanged(object sender, EventArgs e) { Main.ShowCities = this.showCities.Checked; Main.Ini.IniWriteValue("Misc", "ShowCities", Main.ShowCities.ToString()); } private void hideDead_CheckedChanged(object sender, EventArgs e) { Main.HideDead = this.hideDead.Checked; Main.Ini.IniWriteValue("Misc", "HideDead", Main.HideDead.ToString()); } private void HideESPAiming_CheckedChanged(object sender, EventArgs e) { Main.HideESPWhenAiming = this.hideESPAiming.Checked; Main.Ini.IniWriteValue("Misc", "HideESPWhenAiming", Main.HideESPWhenAiming.ToString()); } } } |
My Program.cs
Quote:
using System; using System.Text; using System.Data; using System.Drawing; using System.Threading; using System.Windows.Forms; using System.Collections.Generic; using System.Runtime.InteropServices; using System.ComponentModel; using System.Diagnostics; using SlimDX.Direct3D9; using SlimDX; namespace H1Z1ESP { [StructLayout(LayoutKind.Sequential)] public struct POINT { public int X; public int Y; public POINT(int x, int y) { this.X = x; this.Y = y; } } [StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left; public int Top; public int Right; public int Bottom; } [StructLayout(LayoutKind.Sequential)] public struct MARGIN { public int Top; public int Left; public int Right; public int Bottom; } [StructLayout(LayoutKind.Sequential)] public struct Matrix4 { public float M11; public float M12; public float M13; public float M14; public float M21; public float M22; public float M23; public float M24; public float M31; public float M32; public float M33; public float M34; public float M41; public float M42; public float M43; public float M44; } public class ENTITY { public Int32 Id; public Int32 Type; public String Name; public Vector3 Pos; public Vector3 Vector; public Vector2 Screen; public float Distance; public float Pitch; public float Yaw; public float Speed; } #region Class: Windows API public class Native { [DllImport("user32.dll")] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll")] public static extern int GetWindowThreadProcessId(IntPtr hWnd, out int ProcessId); [DllImport("user32.dll", SetLastError = true)] public static extern uint GetWindowLong(IntPtr hWnd, int nIndex); [DllImport("user32.dll", SetLastError = true)] public static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong); [DllImport("user32.dll", SetLastError = true)] public static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags); [return: MarshalAs(UnmanagedType.Bool)] [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect); [return: MarshalAs(UnmanagedType.Bool)] [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd); [DllImport("dwmapi.dll")] public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGIN pMargins); [DllImport("kernel32.dll")] public static extern IntPtr OpenProcess(uint dwAccess, bool inherit, int pid); [DllImport("kernel32.dll", SetLastError = true)] public static extern bool ReadProcessMemory(IntPtr hProcess, long lpBaseAddress, [In, Out] byte[] lpBuffer, ulong dwSize, out IntPtr lpNumberOfBytesRead); [DllImport("kernel32.dll")] public static extern bool CloseHandle(IntPtr handle); [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)] public static extern void mouse_event(uint dwFlags, int dx, int dy, uint cButtons, uint dwExtraInfo); [DllImport("user32.dll")] public static extern short GetAsyncKeyState(int vKey); [DllImport("user32.dll")] public static extern short GetAsyncKeyState(Keys vKey); } #endregion public class IniHandler { public string path; public IniHandler(string INIPath) { this.path = INIPath; } [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); public string IniReadValue(string Section, string Key) { StringBuilder retVal = new StringBuilder(0xff); GetPrivateProfileString(Section, Key, "", retVal, 0xff, this.path); return retVal.ToString(); } public void IniWriteValue(string Section, string Key, string Value) { WritePrivateProfileString(Section, Key, Value, this.path); } [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); } #region Class: FastMemory public class FastMemory { public Process Process; private Int32 ProcessID; private IntPtr ProcessHandle; private String ProcessClassName; ~FastMemory() { if (this.ProcessHandle != IntPtr.Zero) { Native.CloseHandle(this.ProcessHandle); } } public bool Attach(string lpClassName) { this.ProcessHandle = Native.FindWindow(lpClassName, null); if (this.ProcessHandle != IntPtr.Zero) { this.ProcessClassName = lpClassName; Native.GetWindowThreadProcessId(this.ProcessHandle, out this.ProcessID); this.Process = Process.GetProcessById(this.ProcessID); this.ProcessHandle = Native.OpenProcess(0x38, false, this.ProcessID); return (this.ProcessHandle != IntPtr.Zero); } return false; } public bool IsOpen { get { return this.Attach(this.ProcessClassName); } } public byte ReadByte(long lpBaseAddress) { IntPtr ptr; byte[] lpBuffer = new byte[1]; Native.ReadProcessMemory(this.ProcessHandle, lpBaseAddress, lpBuffer, 1L, out ptr); return lpBuffer[0]; } public byte[] ReadBytes(long _lpBaseAddress, ulong _Size) { IntPtr ptr; byte[] lpBuffer = new byte[_Size]; Native.ReadProcessMemory(this.ProcessHandle, _lpBaseAddress, lpBuffer, _Size, out ptr); return lpBuffer; } public float ReadFloat(long _lpBaseAddress) { IntPtr ptr; byte[] lpBuffer = new byte[4]; Native.ReadProcessMemory(this.ProcessHandle, _lpBaseAddress, lpBuffer, 4L, out ptr); return BitConverter.ToSingle(lpBuffer, 0); } public double ReadDouble(long _lpBaseAddress) { IntPtr ptr; byte[] lpBuffer = new byte[8]; Native.ReadProcessMemory(this.ProcessHandle, _lpBaseAddress, lpBuffer, 8L, out ptr); return BitConverter.ToDouble(lpBuffer, 0); } public short ReadInt16(long _lpBaseAddress) { IntPtr ptr; byte[] lpBuffer = new byte[2]; Native.ReadProcessMemory(this.ProcessHandle, _lpBaseAddress, lpBuffer, 2L, out ptr); return BitConverter.ToInt16(lpBuffer, 0); } public ushort ReadUInt16(long lpBaseAddress) { IntPtr ptr; byte[] lpBuffer = new byte[2]; Native.ReadProcessMemory(this.ProcessHandle, lpBaseAddress, lpBuffer, 2L, out ptr); return BitConverter.ToUInt16(lpBuffer, 0); } public int ReadInt32(long _lpBaseAddress) { IntPtr ptr; byte[] lpBuffer = new byte[4]; Native.ReadProcessMemory(this.ProcessHandle, _lpBaseAddress, lpBuffer, 4L, out ptr); return BitConverter.ToInt32(lpBuffer, 0); } public uint ReadUInt32(long lpBaseAddress) { IntPtr ptr; byte[] lpBuffer = new byte[4]; Native.ReadProcessMemory(this.ProcessHandle, lpBaseAddress, lpBuffer, 4L, out ptr); return BitConverter.ToUInt32(lpBuffer, 0); } public long ReadInt64(long _lpBaseAddress) { IntPtr ptr; byte[] lpBuffer = new byte[8]; Native.ReadProcessMemory(this.ProcessHandle, _lpBaseAddress, lpBuffer, 8L, out ptr); return BitConverter.ToInt64(lpBuffer, 0); } public ulong ReadUInt64(long lpBaseAddress) { IntPtr ptr; byte[] lpBuffer = new byte[8]; Native.ReadProcessMemory(this.ProcessHandle, lpBaseAddress, lpBuffer, 8L, out ptr); return BitConverter.ToUInt64(lpBuffer, 0); } public Matrix4 ReadMatrix(long _lpBaseAddress) { IntPtr ptr; Matrix4 matrix = new Matrix4(); byte[] lpBuffer = new byte[0x40]; Native.ReadProcessMemory(this.ProcessHandle, _lpBaseAddress, lpBuffer, 0x40L, out ptr); matrix.M11 = BitConverter.ToSingle(lpBuffer, 0x00); matrix.M12 = BitConverter.ToSingle(lpBuffer, 0x04); matrix.M13 = BitConverter.ToSingle(lpBuffer, 0x08); matrix.M14 = BitConverter.ToSingle(lpBuffer, 0x0C); matrix.M21 = BitConverter.ToSingle(lpBuffer, 0x10); matrix.M22 = BitConverter.ToSingle(lpBuffer, 0x14); matrix.M23 = BitConverter.ToSingle(lpBuffer, 0x18); matrix.M24 = BitConverter.ToSingle(lpBuffer, 0x1C); matrix.M31 = BitConverter.ToSingle(lpBuffer, 0x20); matrix.M32 = BitConverter.ToSingle(lpBuffer, 0x24); matrix.M33 = BitConverter.ToSingle(lpBuffer, 0x28); matrix.M34 = BitConverter.ToSingle(lpBuffer, 0x2C); matrix.M41 = BitConverter.ToSingle(lpBuffer, 0x30); matrix.M42 = BitConverter.ToSingle(lpBuffer, 0x34); matrix.M43 = BitConverter.ToSingle(lpBuffer, 0x38); matrix.M44 = BitConverter.ToSingle(lpBuffer, 0x3C); return matrix; } public string ReadString(long lpBaseAddress, int size) { IntPtr ptr; byte[] lpBuffer = new byte[size]; Native.ReadProcessMemory(this.ProcessHandle, lpBaseAddress, lpBuffer, (ulong)size, out ptr); return Encoding.UTF8.GetString(lpBuffer); } } #endregion #region Class: Hotkey public class Hotkey { [DllImport("user32.dll")] private static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vk); [DllImport("user32.dll")] private static extern bool UnregisterHotKey(IntPtr hWnd, int id); [Flags] public enum Modifiers { Alt = 1, Ctrl = 2, None = 0, Shift = 4, Win = 8 } [StructLayout(LayoutKind.Sequential)] public struct HookInfo { public int ID; public IntPtr hWnd; public HookInfo(IntPtr Handle, int id) { this.ID = id; this.hWnd = Handle; } } private int freeID = 0; private List<HookInfo> hookedKeys = new List<HookInfo>(); public const int WM_HOTKEY_MSG_ID = 0x312; public void disable(HookInfo i) { this.RemoveHook(i); UnregisterHotKey(i.hWnd, i.ID); } public HookInfo enable(IntPtr Handle, Modifiers Mod, Keys Key) { HookInfo item = new HookInfo(Handle, this.freeID++); this.hookedKeys.Add(item); RegisterHotKey(Handle, item.ID, (int)Mod, (int)Key); return item; } ~Hotkey() { this.unhookAll(); } private void RemoveHook(HookInfo hInfo) { for (int i = 0; i < this.hookedKeys.Count; i++) { if ((this.hookedKeys[i].hWnd == hInfo.hWnd) && (this.hookedKeys[i].ID == hInfo.ID)) { this.hookedKeys.RemoveAt(i--); } } } public void unhookAll() { for (int i = 0; i < this.hookedKeys.Count; i++) { this.disable(this.hookedKeys[i]); } } public HookInfo[] HookedKeys { get { return this.hookedKeys.ToArray(); } } } #endregion public static class Program { /// <summary> /// Главная точка входа для приложения. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Main()); } } } |
Thanks Read.BRO.
http://ift.tt/1NOXG7V
Ver publicacion completa // See full post --> >>UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats<<
Thx tjdwls1951
PostDate: March 12, 2015 at 05:13AM
0 comments:
Post a Comment