diff --git a/GmodCheatx64.sln b/GmodCheatx64.sln new file mode 100644 index 0000000..9b63b84 --- /dev/null +++ b/GmodCheatx64.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34221.43 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GmodCheatx64", "GmodCheatx64\GmodCheatx64.csproj", "{E85B52B7-DA98-424F-8EFC-178DC1860B77}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E85B52B7-DA98-424F-8EFC-178DC1860B77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E85B52B7-DA98-424F-8EFC-178DC1860B77}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E85B52B7-DA98-424F-8EFC-178DC1860B77}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E85B52B7-DA98-424F-8EFC-178DC1860B77}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F45257D9-92A2-47A3-9971-6F2E117E0F52} + EndGlobalSection +EndGlobal diff --git a/GmodCheatx64/GmodCheatx64.csproj b/GmodCheatx64/GmodCheatx64.csproj new file mode 100644 index 0000000..df20e67 --- /dev/null +++ b/GmodCheatx64/GmodCheatx64.csproj @@ -0,0 +1,21 @@ + + + + Exe + net7.0 + enable + enable + x64 + + + + + + + + + + + + + diff --git a/GmodCheatx64/Program.cs b/GmodCheatx64/Program.cs new file mode 100644 index 0000000..d5ea2e1 --- /dev/null +++ b/GmodCheatx64/Program.cs @@ -0,0 +1,152 @@ +using Swed64; +using System.Runtime.InteropServices; +using GmodCheatx64; +using System.Threading; +using System; +using ClickableTransparentOverlay; +using ImGuiNET; +using System.Numerics; +using Vortice.Mathematics; +using System.Diagnostics; + + +namespace GmodCheatx64s +{ + internal class Program + { + + [DllImport("user32.dll")] + + static extern short GetAsyncKeyState(int vkey); + + //Game + + #region Offsets + const int entitybase = 0x0901DB8; + const int localPlayer = 0x08DF820; + + const int viewangleX = 0x5D5370; //yaw rechts links + const int viewangleY = 0x5D536C; //pitch oben unten + + const int hp = 0xC8; + const int x = 0x308; + const int y = 0x30C; + const int z = 0x310; + + #endregion + + public static void Main(string[] args) + { + + Swed swed = new Swed("gmod"); + + entity player = new entity(); + List entityList = new List(); + + var moduleBase = swed.GetModuleBase("client.dll"); + var enginebase = swed.GetModuleBase("engine.dll"); + + Console.WriteLine("Starting ImGui"); + renderer renderer = new renderer(); + renderer.Start().Wait(); + + while (true) + { + //Console.Write(swed.ReadFloat(enginebase, viewangleX)); + //Console.Write(swed.ReadFloat(enginebase, viewangleY)); + //Console.Write("\n"); + if (GetAsyncKeyState(0x56) < 0) + { + //var EntityObj = swed.ReadPointer(moduleBase, entitybase + 0x20); + //Console.WriteLine(swed.ReadFloat(EntityObj, 0x308)); + + updatelocal(); + updateEntities(); + entityList = entityList.OrderBy(o => o.mag).ToList(); + if (entityList.Count > 0) + { + //Console.WriteLine(entityList[0].health); + aim(entityList[0]); + } + Thread.Sleep(1); + } + + void updatelocal() + { + var buffer = swed.ReadPointer(moduleBase, localPlayer); + var positionX = swed.ReadFloat(buffer, x); + var positionY = swed.ReadFloat(buffer, y); + var positionZ = swed.ReadFloat(buffer, z); + var healthLoc = swed.ReadInt(buffer, hp); + player.x = positionX; + player.y = positionY; + player.z = positionZ; + player.health = healthLoc; + } + + float calcMag(entity entity) + { + return (float)Math.Sqrt(Math.Pow(entity.x - player.x, 2) + Math.Pow(entity.y - player.y, 2) + Math.Pow(entity.z - player.z, 2)); + } + + void updateEntities() + { + entityList.Clear(); + + for (int i = 0; i < 64; i++) + { + var buffer = swed.ReadPointer(moduleBase, entitybase + 0x20 + i * 0x20); + + var posx = swed.ReadFloat(buffer, x); + var posy = swed.ReadFloat(buffer, y); + var posz = swed.ReadFloat(buffer, z); + var healthEnt = swed.ReadInt(buffer, hp); + + var ent = new entity + { + x = posx, + y = posy, + z = posz, + health = healthEnt + }; + + if(renderer.enableHealthCheck == true ) + { + if (healthEnt > 0) + { + ent.mag = calcMag(ent); + entityList.Add(ent); + } + } + else + { + ent.mag = calcMag(ent); + entityList.Add(ent); + } + } + } + + void aim(entity entity) + { + //Console.WriteLine("New"); + //Console.WriteLine(entity.health); + + float deltaX = entity.x - player.x; + float deltaY = entity.y - player.y; + + float X = (float)(Math.Atan2(deltaY, deltaX) * 180 / Math.PI); + float deltaZ = entity.z - 5 - player.z; + + double dist = Math.Sqrt(Math.Pow(deltaX, 2) + Math.Pow(deltaY, 2)); + + float Y = -(float)(Math.Atan2(deltaZ, dist) * 180 / Math.PI); + + var buffer = swed.ReadPointer(moduleBase, localPlayer); + + swed.WriteFloat(enginebase, viewangleX, X); + swed.WriteFloat(enginebase, viewangleY, Y); + } + } + } + } +} \ No newline at end of file diff --git a/GmodCheatx64/entity.cs b/GmodCheatx64/entity.cs new file mode 100644 index 0000000..280e011 --- /dev/null +++ b/GmodCheatx64/entity.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Swed64; + +namespace GmodCheatx64 +{ + internal class entity + { + public int health; + public float x, y, z; + public float mag; + } +} diff --git a/GmodCheatx64/renderer.cs b/GmodCheatx64/renderer.cs new file mode 100644 index 0000000..5e90892 --- /dev/null +++ b/GmodCheatx64/renderer.cs @@ -0,0 +1,65 @@ +using ClickableTransparentOverlay; +using GmodCheatx64s; +using ImGuiNET; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Text; +using System.Threading.Tasks; +using Veldrid.OpenGLBinding; + +namespace GmodCheatx64 +{ + public class renderer : Overlay + { + bool checkBoxValue= false; + int loveMeter = 0; + string input = ""; + string input2 = ""; + + bool enableOverlay = false; + public bool enableHealthCheck = false; + Vector2 screenSize = new Vector2(2560, 1440); + Vector2 drawPosition = new Vector2(150, 150); + + + protected override void Render() + { + DrawMenu(); + DrawOverlay(); + } + + void DrawMenu() + { + ImGui.Begin("Gmod x64 Made by Finn"); + ImGui.Checkbox("Draw Overlay", ref enableOverlay); + ImGui.BeginChild("Aimbot"); + ImGui.Checkbox("CheckIfEntityHealth 0", ref enableHealthCheck); + ImGui.EndChild(); + ImGui.End(); + } + + void DrawOverlay() + { + if (enableOverlay) + { + ImGui.SetNextWindowSize(screenSize); + ImGui.SetNextWindowPos(new Vector2(0, 0)); + ImGui.Begin("Overlayxx", ImGuiWindowFlags.NoDecoration + | ImGuiWindowFlags.NoBackground + | ImGuiWindowFlags.NoBringToFrontOnFocus + | ImGuiWindowFlags.NoMove + | ImGuiWindowFlags.NoInputs + | ImGuiWindowFlags.NoCollapse + | ImGuiWindowFlags.NoScrollbar + | ImGuiWindowFlags.NoScrollWithMouse + ); + + ImDrawListPtr drawList = ImGui.GetWindowDrawList(); + + drawList.AddCircle(drawPosition, 50,ImGui.ColorConvertFloat4ToU32(new Vector4(1,0,0,1))); //Red + } + } + } +}