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); if ((player_rad >=-11.25) && (player_rad <=11.25)) {player_C ="E";} else if ((player_rad >=11.25) && (player_rad <=33.75)) { player_C ="ENE"; } else if ((player_rad >=33.75) && (player_rad <=56.25)) { player_C ="NE"; } else if ((player_rad >=56.25) && (player_rad <=78.75)) { player_C ="NNE"; } else if ((player_rad >=78.75) && (player_rad <=101.25)) { player_C ="N"; } else if ((player_rad >=101.25) && (player_rad <=123.75)) { player_C ="NNW"; } else if ((player_rad >=123.75) && (player_rad <=146.25)) { player_C ="NW"; } else if ((player_rad >=146.25) && (player_rad <=168.75 )) { player_C ="WNW"; } else if ((player_rad >=168.75) && (player_rad <=180)) { player_C ="W"; } else if ((player_rad >=-180) && (player_rad <=-168.75)) { player_C ="W"; } else if ((player_rad >=-168.75) && (player_rad <=-146.25)) { player_C ="WSW"; } else if ((player_rad >=-146.25) && (player_rad <=-123.75)) { player_C ="SW"; } else if ((player_rad >=-123.75) && (player_rad <=-101.25)) { player_C ="SSW"; } else if ((player_rad >=-101.25) && (player_rad <=-78.75)) { player_C ="S"; } else if ((player_rad >=-78.75) && (player_rad <=-56.25)) { player_C ="SSE"; } else if ((player_rad >=-56.75) && (player_rad <=-33.75)) { player_C ="SE"; } else if ((player_rad >=-33.75) && (player_rad <=-11.25)) { player_C ="ESE"; } player_X = this.GameMemory.ReadFloat(playerOffset + 0x200); player_Y = this.GameMemory.ReadFloat(playerOffset + 0x204); player_Z = this.GameMemory.ReadFloat(playerOffset + 0x208); player_D = this.GameMemory.ReadFloat(playerOffset + 0x2D0); player_rad = player_D * (180.0/Math.PI); 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("Position X: " + player_X.ToString("F1") + " Y: " + player_Y.ToString("F1") + " Z: " + player_Z.ToString("F1"), ref TextRegion, Color.White); DrawText("Direction: " + player_D.ToString("F2"), ref TextRegion, Color.White); DrawText("方向:" + player_C, ref TextRegion, Color.White); DrawText("*Greenshot為免費程式請勿商業行為*", ref TextRegion, Color.SkyBlue); } 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 + 0x420); 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; IsCorpse = false; InVehicle = false; IsDriving = false; /* //XYZ// posOffset = this.GameMemory.ReadInt64(entityEntry + 0x198); if (EntityType == 0x04 || EntityType == 0x05) { EntityX = this.GameMemory.ReadFloat(posOffset + 0x100); EntityY = this.GameMemory.ReadFloat(posOffset + 0x104); EntityZ = this.GameMemory.ReadFloat(posOffset + 0x108); EntitySpeed = this.GameMemory.ReadFloat(entityEntry + 0x2C8); EntityYaw = this.GameMemory.ReadFloat(entityEntry + 0x2E0); }*/ int EntityType = this.GameMemory.ReadInt32(entityEntry + 0x5E0); if (EntityType == 0) continue; int EntityId = this.GameMemory.ReadInt32(entityEntry + 0x638); long _nameEntry = this.GameMemory.ReadInt64(entityEntry + 0x4F8); String EntityName = this.GameMemory.ReadString(_nameEntry, this.GameMemory.ReadInt32(entityEntry + 0x500)); // Get Player Pos // if (EntityType == 0x04 || EntityType == 0x05) { EntityX = this.GameMemory.ReadFloat(entityEntry + 0x3E0); EntityY = this.GameMemory.ReadFloat(entityEntry + 0x3E4); EntityZ = this.GameMemory.ReadFloat(entityEntry + 0x3E8); } else { EntityX = this.GameMemory.ReadFloat(entityEntry + 0x3C90); EntityY = this.GameMemory.ReadFloat(entityEntry + 0x3C94); EntityZ = this.GameMemory.ReadFloat(entityEntry + 0x3C98); } // 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); Int32 EntityState = this.GameMemory.ReadInt32(entityEntry + 0x5D8); // 自瞄及顯示用 // Detect type of Loot (Corpse or Loot) // if (currentEntity.Type == 0x2E && this.GameMemory.ReadByte(entityEntry + 0x1D88) == 0xE4) { IsCorpse = true; currentEntity.Name = "Corpse"; } /* // display EntityType // if (ShowESP) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName + "\n" + "[" + BoneID.ToString("X2") + "]" + "[" + EntityType.ToString("X4") + "]", Color.Red, true, false, false, 2f, EntityYaw, EntityPitch); break;*/ switch (EntityType) { case 0x04/*Player*/: case 0x05/*BR Player*/: /* case 0x11: // OffRoad case 0x72: // Pickup case 0x76: // PoliceCar*/ #region // Aiming // Vector3 aimingTo = Vector3.Zero; if (Aimed == true || currentEntity.Distance > 200f || this.GameMemory.ReadByte(entityEntry + 0x13AC) != 1) { /* Already aimed, not in range, entity is dead */ } else if (ModifierKeys.HasFlag(Keys.Control) == true) { if (AimedEntity != null && AimedEntity.Id == currentEntity.Id) { if (Convert.ToBoolean(this.GameMemory.ReadByte(entityEntry + 0x13AC)) == false) //old 0x137C { // Target is dead // AimedEntity = null; } else { Aimed = true; AimedEntity = currentEntity; Vector3 AIM; float offsetY = 0f; { switch (EntityState) { case 0: offsetY = 1.75f; ; break; // Standing [站立] case 1: offsetY = 1.05f; ; break; // Crouched [坐著] case 2: offsetY = 1.55f; break; // Walking [走路] case 3: offsetY = 1.55f; break; // Running [跑步] case 4: offsetY = 1.60f; break; // Jumping [跳躍] case 5: offsetY = 1.05f; break; // Crouching [蹲著] case 6: offsetY = 0.3f; break; // Prone [趴著] case 7: offsetY = 0.3f; break; // Crawling [爬行] } } 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) / AimC; int moveOffsetY = (int)(Math.Round(AIM.Y) - this.GameWindowCenter.Y) / AimC; 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)) // EntityY + 1f old { 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); } } } // AIM 2 // else if (Convert.ToBoolean(Native.GetAsyncKeyState(Keys.CapsLock) & 0x8000) || Convert.ToBoolean(Native.GetAsyncKeyState(Keys.XButton1) & 0x8000) == true) { if (AimedEntity != null && AimedEntity.Id == currentEntity.Id) { if (Convert.ToBoolean(this.GameMemory.ReadByte(entityEntry + 0x13AC)) == false) { // Target is dead // AimedEntity = null; } else { Aimed = true; AimedEntity = currentEntity; Vector3 AIM; float offsetY = 0f; { switch (EntityState) { case 0: offsetY = 1.75f; ; break; // Standing [站立] case 1: offsetY = 1.05f; ; break; // Crouched [坐著] case 2: offsetY = 1.65f; break; // Walking [走路] case 3: offsetY = 1.65f; break; // Running [跑步] case 4: offsetY = 1.55f; break; // Jumping [跳躍] case 5: offsetY = 1.05f; break; // Crouching [蹲著] case 6: offsetY = 0.3f; break; // Prone [趴著] case 7: offsetY = 0.3f; break; // Crawling [爬行] } } 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; // /1 int moveOffsetY = (int)(Math.Round(AIM.Y) - this.GameWindowCenter.Y) * 2; // /1 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)) // EntityY + 1f old { float distance = Vector2.Distance(new Vector2(aimingTo.X, aimingTo.Y), new Vector2(this.GameWindowCenter.X, this.GameWindowCenter.Y)); if (distance < 50f) { 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; } # endregion */ // Player Behavior // if (EntityType == 0x04 || EntityType == 0x05) { switch (EntityState) { case 0: EntityName += " [站立]"; break; // Standing case 1: EntityName += " [坐著]"; break; // Crouched case 2: EntityName += " [走路]"; break; // Walking case 3: EntityName += " [跑步]"; break; // Running case 4: EntityName += " [跳躍]"; break; // Jumping case 5: EntityName += " [蹲著]"; break; // Crouching case 6: EntityName += " [趴著]"; break; // Prone case 7: EntityName += " [爬行]"; break; // Crawling } } //* // Show Entity when ESP enabled // if (ShowESP) // && this.GameMemory.ReadFloat(entityEntry + 0x1CC) == 1f) { Byte EntityAlive = this.GameMemory.ReadByte(entityEntry + 0x13AC); Byte EntityAlive2 = (this.GameMemory.ReadUInt32(this.GameMemory.ReadInt64(entityEntry + 0x4098L) + 0xB0L) / 100 == 30) && (EntityType == 0x0C || EntityType == 0x5B) ? (byte)0 : (byte)1; if (HideDead == false || Convert.ToBoolean(EntityAlive) == true) { // Player // if (EntityType == 0x04 || EntityType == 0x05) { // Show HP if(ShowESP) { long HPoffset = this.GameMemory.ReadInt64(entityEntry + 0x4098L); // old 0x4058L oldold 0x3fa8L uint playerHP = this.GameMemory.ReadUInt32(HPoffset + 0xb0L) / 100; { HPoffset = this.GameMemory.ReadInt64(HPoffset + 0xF8); } 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() + "%"; /* long HPoffset = this.GameMemory.ReadInt64(entityEntry + 0x4068L); uint eHP = this.GameMemory.ReadUInt32(HPoffset + 0xb0L); uint maxHP = this.GameMemory.ReadUInt32(HPoffset + 0xb4L); if (maxHP != 0) { uint entityHP = 100 * eHP / maxHP; EntityName = EntityName + " " + entityHP.ToString() + "%" + " " + "[" + state + "]"; }*/ if (ShowPlayers) this.EntityToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), playerNameHP, color, true, false, BoxedPlayers, 2f, EntityYaw, EntityPitch); } else { 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; // Deer or Rabbit // case 0x13: // Deer if (ShowAnimals) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.DarkGreen, true, false, BoxedAnimals, 2f, EntityYaw, EntityPitch); break; case 0x55: // Rabbit if (ShowAnimals) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.DarkGreen, true, false, BoxedAnimals, 2f, EntityYaw, EntityPitch); break; // Aggressive NPC (Wolf, Bear, Zombies) // case 0x0C: // Zombies if (ShowAggressive) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Thistle, true, false, BoxedAggressive, 2f, EntityYaw, EntityPitch); break; case 0x5b: // Zombies if (ShowAggressive) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Red, true, false, BoxedAggressive, 2f, EntityYaw, EntityPitch); break; case 0x14: // Wolf if (ShowAggressive) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Red, true, false, BoxedAggressive, 2f, EntityYaw, EntityPitch); break; case 0x50: // Bear if (ShowAggressive) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Red, true, false, BoxedAggressive, 2f, EntityYaw, EntityPitch); break; case 0x2E: // Loot if (ShowESP && ShowRoot) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName + "\n" + "[" + EntityType.ToString("X2") + "]" + "[" + EntityType.ToString("X4") + "]", Color.GreenYellow, true, false, BoxedItems, 0.15f, 0.15f, 0.15f); break; /* if (ShowRoot) { if (IsCorpse == false) { if (ShowESP && ShowItems) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.GreenYellow, true, false, BoxedItems, 1f, EntityYaw, EntityPitch); } else if (ShowCorpse == true) { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), currentEntity.Name, Color.Olive, true, false, BoxedItems, 1f, EntityYaw, EntityPitch); } }*/ case 0x1B: // Campfire case 0x6D: // Stash case 0x9C: // Land Mine if (ShowESP && ShowItems && !BRMode) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.SaddleBrown, true, false, BoxedItems, 0.15f, 0.15f, 0.15f); break; case 0x2F: // Furnace // case 0x33: // Storage Container case 0x35: // Animal Trap case 0x36: // Dew Collector case 0x53: // Barbeque if (ShowESP && ShowContainers) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Gray, true, false, BoxedItems, 0.15f, 0.15f, 0.15f); break; case 0x34: // Weapons if (ShowESP && ShowWeapons) { if (EntityName.Contains("M1911") || EntityName.Contains("AR15") || EntityName.Contains(".308 Hunting Rifle") || EntityName.Contains("12GA Pump Shotgun") || EntityName.Contains("M9") || EntityName.Contains("R380") || EntityName.Contains("Recurve Bow") || EntityName.Contains("Crowbar")) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName + "\n" + "[" + EntityType.ToString("X2") + "]", Color.GreenYellow, true, false, BoxedItems, 1f, 0f, 0f); } break; case 0x15: // Ammo if (ShowESP && ShowAmmo) { if (EntityName.Contains(".45 Round") || EntityName.Contains(".308 Round") || EntityName.Contains(".223 Round") || EntityName.Contains("Shotgun Shell") || EntityName.Contains(".380 round") || EntityName.Contains("9mm Round")) { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Orange, true, false, BoxedItems, 1f, 0f, 0f); } else this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Moccasin, true, false, BoxedItems, 1f, 0f, 0f); } break; case 0x11: // OffRoad case 0x72: // Pickup case 0x76: // PoliceCar if (ShowESP && ShowVehicles) { if (EntityType == 0x11 || EntityType == 0x72 || EntityType == 0x76) { if (ShowVehicles) this.EntityToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), EntityName, Color.HotPink, true, false, BoxedVehicles, 2f, EntityYaw, EntityPitch); } } if (ShowESP && ShowVehicles) this.EntityToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), EntityName, Color.HotPink, true, false, BoxedVehicles, 2f, 0f, 0f); break; case 0x2C: // Resources, Battary, Turbo, Sparkplugs if (ShowESP && ShowItems) { if (ShowFirstAid || ShowBackpack || ShowHelmet) { if (ShowFirstAid && EntityName.Contains("First")) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.LimeGreen, true, false, BoxedItems, 0.15f, 0.15f, 0.15f); if (ShowBackpack && EntityName.Contains("Backpack") || EntityName.Contains("Waist Pack")) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.CornflowerBlue, true, false, BoxedItems, 0.15f, 0.15f, 0.15f); if (ShowHelmet && EntityName.Contains("Helmet") || EntityName.Contains("Body Armor")) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.IndianRed, true, false, BoxedItems, 0.15f, 0.15f, 0.15f); } else { if (EntityName.Contains("Battery") || EntityName.Contains("Turbo") || EntityName.Contains("Headlights") || EntityName.Contains("Sparkplugs")) { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Plum, true, false, BoxedItems, 0.15f, 0.15f, 0.15f); } else this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.White, true, false, BoxedItems, 0.15f, 0.15f, 0.15f); } } 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 0x8D: // Military_Cache case 0x8F: // BR_Military_Cache 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 0x8E: // 空頭 if (ShowESP && ShowItems && !BRMode) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.SaddleBrown, true, false, BoxedItems, 0.15f, 0.15f, 0.15f); 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; /* // display EntityType // if (ShowESP) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), "\n" + "[" + EntityType + "]" + "[" + EntityType.ToString("X2") + "]", Color.Red, true, false, false, 1f, 0.30f, 0.30f); break;*/ case 0x2A: //手銬key if (ShowAmmo) { this.EntityToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), EntityName, Color.White, true, false, BoxedVehicles, 2f, EntityYaw, EntityPitch); } break; default: // Other Items /* if (ShowESP && ShowItems && !BRMode) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName + "[" + EntityType.ToString("X2") + "]" + "\n" + "[" + EntityType + "]", Color.White, true, false, false, 0.15f, 0.30f, 0.30f); break; // +"\n"+"["+ EntityType +"]"*/ // display EntityType // if (Convert.ToBoolean(Native.GetAsyncKeyState(Keys.XButton2) & 0x8000) == true) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName + "\n" + "[" + EntityType.ToString("X2") + "]" + "[" + EntityType.ToString("X4") + "]", Color.Red, true, false, false, 2f, EntityYaw, EntityPitch); break; } entityEntry = this.GameMemory.ReadInt64(entityEntry + 0x420); } if (Aimed == false) AimedEntity = null; if (ShowEntityLists) { ENTITY[] playerList = Entity.Where(E => E.Type == 0x04 || E.Type == 0x05).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 + 340, 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.LightSlateGray, 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 || entity.Type == 0x05) && 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); DrawBox(pointToRotate.X, pointToRotate.Y, 3f, 3f, 1f, Color.HotPink); } } } } */ if (ShowRadar) { if (RadarMap) { int marginRight = 50; int marginTop = 50; // place the radar in the top right (-50px) corner of the screen int radarRadius = 128; // max display distance in [m] float mapScale = 0.5f; // = Texture.Width / 8192f (if you use image of size 4096x4096 then mapScale = 0.5f, if 2048x2048 then mapScale = 0.25f) if (DXTextureGameMap != null) { Matrix mRT = Matrix.RotationZ(-(player_D - 1.57079632679f)) * Matrix.Translation(-this.Width / 2 + GameWindowRect.Right - marginRight - radarRadius, this.Height / 2 - GameWindowRect.Top - marginTop - radarRadius, 0); Matrix mView = Matrix.Identity; Matrix mProj = Matrix.OrthoLH(this.Width, this.Height, 0f, 1.0f); DXDevice.SetTransform(TransformState.World, mRT); DXDevice.SetTransform(TransformState.View, mView); DXDevice.SetTransform(TransformState.Projection, mProj); // Transform in-game player position to the image map, (x,y) in [-4096,4096]x[-4096,4096]->[0,4096]x[0,4096] float mapX = (4096 + player_Z) * mapScale; float mapY = (4096 - player_X) * mapScale; // and now to texture coordinates [0,4096] -> [0,1] mapX = mapX / (float)4096; mapY = mapY / (float)4096; Vector2 playerPosition = new Vector2(mapX, mapY); float scale = radarRadius / (float)4096; DataStream stream = CircleVertices.Lock(0, 0, LockFlags.None); stream.WriteRange(BuildVertexCircle(Vector2.Zero, playerPosition, radarRadius, scale, circleComplexity)); CircleVertices.Unlock(); DXDevice.SetStreamSource(0, CircleVertices, 0, TexVertex.SizeBytes); DXDevice.VertexFormat = TexVertex.Format; DXDevice.SetTexture(0, DXTextureGameMap); /* alpha blending not working as expected DXDevice.SetRenderState(RenderState.AlphaBlendEnable, true); DXDevice.SetRenderState(RenderState.SourceBlend, SlimDX.Direct3D9.Blend.BlendFactor); DXDevice.SetRenderState(RenderState.BlendFactor, 0xffffff); */ DXDevice.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear); DXDevice.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear); DXDevice.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear); DXDevice.DrawPrimitives(PrimitiveType.TriangleFan, 0, circleComplexity); } else // just paint green background { DrawFilledBox(this.GameWindowRect.Right - marginRight - radarRadius * 2, this.GameWindowRect.Top + marginTop, radarRadius * 2, radarRadius * 2, Color.DarkOliveGreen, RadarTransparency); DrawBoxAbs(this.GameWindowRect.Right - marginRight - radarRadius * 2, this.GameWindowRect.Top + marginTop, radarRadius * 2, radarRadius * 2, 1f, Color.Black); } RadarCenter = new Vector2(this.GameWindowRect.Right - marginRight - radarRadius, this.GameWindowRect.Top + marginTop + radarRadius); if (RadarCenter.Length() > 0f) { // vertical line DrawLine(RadarCenter.X, this.GameWindowRect.Top + marginTop, RadarCenter.X, this.GameWindowRect.Top + marginTop + radarRadius * 2, 1f, Color.Black); // horizontal line DrawLine(this.GameWindowRect.Right - marginRight - radarRadius * 2, RadarCenter.Y, this.GameWindowRect.Right - marginRight, RadarCenter.Y, 1f, Color.Black); // center point DrawFilledBox(RadarCenter.X - 1f, RadarCenter.Y - 1f, 3f, 3f, Color.White); if (RadarLine) { //動物 DrawLine(RadarCenter.X - 3, RadarCenter.Y - 10, RadarCenter.X + 3, RadarCenter.Y - 10, 1f, Color.White); DrawLine(RadarCenter.X - 3, RadarCenter.Y + 10, RadarCenter.X + 3, RadarCenter.Y + 10, 1f, Color.White); DrawLine(RadarCenter.X - 10, RadarCenter.Y - 3, RadarCenter.X - 10, RadarCenter.Y + 3, 1f, Color.White); DrawLine(RadarCenter.X + 10, RadarCenter.Y - 3, RadarCenter.X + 10, RadarCenter.Y + 3, 1f, Color.White); //物品 DrawLine(RadarCenter.X - 5, RadarCenter.Y - 80, RadarCenter.X + 5, RadarCenter.Y - 80, 1f, Color.White); DrawLine(RadarCenter.X - 5, RadarCenter.Y + 80, RadarCenter.X + 5, RadarCenter.Y + 80, 1f, Color.White); DrawLine(RadarCenter.X - 80, RadarCenter.Y - 5, RadarCenter.X - 80, RadarCenter.Y + 5, 1f, Color.White); DrawLine(RadarCenter.X + 80, RadarCenter.Y - 5, RadarCenter.X + 80, RadarCenter.Y + 5, 1f, Color.White); } //Display each entity in correct relational position foreach (ENTITY entity in Entity) { if (entity.Type == 0x04 || entity.Type == 0x05 || entity.Type == 0x0C || entity.Type == 0x14 || entity.Type == 0x50 || entity.Type == 0x5b || entity.Type == 0x0C || entity.Type == 0x14 || entity.Type == 0x50 || entity.Type == 0x5b || entity.Type == 0x13 || entity.Type == 0x55 || entity.Type == 0x11 || entity.Type == 0x72 || entity.Type == 0x76) { Vector2 pointToRotate = new Vector2(entity.Pos.X, entity.Pos.Z); Vector2 playerPosition = new Vector2(player_X, player_Z); pointToRotate = playerPosition - pointToRotate; float distance = pointToRotate.Length(); distance = Math.Min(distance, (float)radarRadius * 2); pointToRotate.Normalize(); pointToRotate = (Vector2)(pointToRotate * distance * mapScale); pointToRotate += RadarCenter; pointToRotate = RotatePoint(pointToRotate, RadarCenter, player_D, true); if ((entity.Type == 0x05 || entity.Type == 0x04) && RadarPlayers) { DrawFilledBox(pointToRotate.X, pointToRotate.Y, 4f, 4f, Color.Black); DrawFilledBox(pointToRotate.X, pointToRotate.Y, 3f, 3f, Color.DeepSkyBlue); } 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) { DrawBox(pointToRotate.X, pointToRotate.Y, 4f, 4f, 2f, Color.HotPink); } } } } } else { 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 || entity.Type == 0x05) && 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.HotPink, true, false, false, 1f, 0f, 0f); this.EntityToScreen(new Vector3(-1233f, 90f, 1855f), "Cranberry", Color.HotPink, true, false, false, 1f, 0f, 0f); this.EntityToScreen(new Vector3(2003f, 50f, 2221f), "Ranchito", Color.HotPink, 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 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); //0x200 player_Y = this.GameMemory.ReadFloat(playerOffset + 0x214); //0x204 player_Z = this.GameMemory.ReadFloat(playerOffset + 0x218); //0x208 player_D = this.GameMemory.ReadFloat(playerOffset + 0x240); //0x230 long posOffset = this.GameMemory.ReadInt64(playerOffset + 0x198); //0x190 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("Position X: " + player_X.ToString("F1") + " Y: " + player_Y.ToString("F1") + " Z: " + player_Z.ToString("F1"), ref TextRegion, Color.White); DrawText("Direction: " + player_D.ToString("F2"), 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); //0x400 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); //0x5B0 if (EntityType == 0) continue; int EntityId = this.GameMemory.ReadInt32(entityEntry + 0x620); //0x608 long _nameEntry = this.GameMemory.ReadInt64(entityEntry + 0x4E0); //0x468 String EntityName = this.GameMemory.ReadString(_nameEntry, this.GameMemory.ReadInt32(entityEntry + 0x4E8)); //0x470 // Player Position // if (EntityType == 0x04) { EntityX = this.GameMemory.ReadFloat(entityEntry + 0x210); //0x1C0 EntityY = this.GameMemory.ReadFloat(entityEntry + 0x214); //0x1C4 EntityZ = this.GameMemory.ReadFloat(entityEntry + 0x218); //0x1C8 EntitySpeed = this.GameMemory.ReadFloat(entityEntry + 0x2C8); //0x1D8 EntityYaw = this.GameMemory.ReadFloat(entityEntry + 0x2E0); //0x1F0 } // Vechicle Position // else if (EntityType == 0x11 || EntityType == 0x72 || EntityType == 0x76) { EntityX = this.GameMemory.ReadFloat(entityEntry + 0x250); //0x200 EntityY = this.GameMemory.ReadFloat(entityEntry + 0x254); EntityZ = this.GameMemory.ReadFloat(entityEntry + 0x258); EntitySpeed = this.GameMemory.ReadFloat(entityEntry + 0x2C8); //0x1D8 } else { // Try Get NPC Position // EntityX = this.GameMemory.ReadFloat(entityEntry + 0x410); //0x3C0 if (EntityX == 0) { // Item Position // EntityX = this.GameMemory.ReadFloat(entityEntry + 0x13F0); //0x13E0 EntityY = this.GameMemory.ReadFloat(entityEntry + 0x13E4); EntityZ = this.GameMemory.ReadFloat(entityEntry + 0x13E8); } else { // NPC Position // EntityY = this.GameMemory.ReadFloat(entityEntry + 0x414); EntityZ = this.GameMemory.ReadFloat(entityEntry + 0x418); EntitySpeed = this.GameMemory.ReadFloat(entityEntry + 0x2C8); //0x1D8 EntityYaw = this.GameMemory.ReadFloat(entityEntry + 0x2E0); //0x1F0 } } long entityPositionOffset = this.GameMemory.ReadInt64(entityEntry + 0x198); EntityX = this.GameMemory.ReadFloat(entityPositionOffset + 0x110); EntityY = this.GameMemory.ReadFloat(entityPositionOffset + 0x114); EntityZ = this.GameMemory.ReadFloat(entityPositionOffset + 0x118); // 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) { // 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 + 0x136C)) == false) { // Target is dead // AimedEntity = null; } else if (AimedUpdate >= DateTime.Now) { Aimed = true; AimedEntity = currentEntity; Vector3 AIM; float offsetY = 1.0f; 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)) { float moveOffsetX = AIM.X - this.GameWindowCenter.X; float moveOffsetY = AIM.Y - this.GameWindowCenter.Y; DrawText("Aimed at " + AimedEntity.Name + ": " + moveOffsetX + ", " + moveOffsetY, ref TextRegion, Color.Red); Native.mouse_event(0x0001, (short)moveOffsetX, (short)moveOffsetY, 0, 0); AimedUpdate = DateTime.Now.AddMilliseconds(50); } } } 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; AimedUpdate = DateTime.Now.AddMilliseconds(50); } } } else { AimedEntity = null; } */ // Show Entity when ESP enabled // if (ShowESP) // && this.GameMemory.ReadFloat(entityEntry + 0x1CC) == 1f) { Byte EntityAlive = this.GameMemory.ReadByte(entityEntry + 0x137C); //0x136C 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 + 0x4068); //old: 0x4058L old old 0x3fa8L 0x4068 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) { if (EntityName.Contains("First")) { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Green, true, false, BoxedItems, 1f, 0f, 0f); } else { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.GreenYellow, true, false, BoxedItems, 1f, 0f, 0f); } } break; case 0x1B: // Campfire 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 0x2F: // Furnace // case 0x33: // Storage Container case 0x35: // Animal Trap case 0x36: // Dew Collector case 0x53: // Barbeque 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) { if (EntityName.Contains("Shotgun")) { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.OrangeRed, true, false, BoxedItems, 1f, 0f, 0f); } else if (EntityName.Contains("AR15")) { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.OrangeRed, true, false, BoxedItems, 1f, 0f, 0f); } else if (EntityName.Contains("M1911")) { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.OrangeRed, true, false, BoxedItems, 1f, 0f, 0f); } else { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.GreenYellow, true, false, BoxedItems, 1f, 0f, 0f); } } break; case 0x15: // Ammo if (ShowESP && ShowAmmo) { if (EntityName.Contains(".223")) { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Orange, true, false, BoxedItems, 1f, 0f, 0f); } else if (EntityName.Contains("Shotgun")) { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Orange, true, false, BoxedItems, 1f, 0f, 0f); } else if (EntityName.Contains(".45")) { 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: // Resources, Battary, Turbo, Sparkplugs if (ShowESP && ShowItems) { if (EntityName.Contains("Battery") || EntityName.Contains("Turbo") || EntityName.Contains("Headlights") || EntityName.Contains("Sparkplugs")) { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.LavenderBlush, true, false, BoxedItems, 1f, 0f, 0f); } // ******ACTUAL LOCATION if (EntityName.Contains("First Aid Kit")) { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Lime, 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) { if (EntityName.Contains("First")) { this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Green, true, false, BoxedItems, 1f, 0f, 0f); } else { 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(); 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] " + playerHP.ToString() + "%" , this.GameWindowRect.Left + 320, this.GameWindowRect.Bottom - itemY - 15, Color.SkyBlue); itemY -= 15; if (itemY <= 0) break; } } if (ShowRadar) { DrawFilledBox(this.GameWindowRect.Right - 225, this.GameWindowRect.Top + 50, 201f, 201f, Color.DarkOliveGreen, 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); } 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(); }