Add project files.

This commit is contained in:
Finn
2024-04-24 22:45:56 +02:00
parent 5a1c3d656b
commit 8f1da0a4ea
5 changed files with 279 additions and 0 deletions

25
GmodCheatx64.sln Normal file
View File

@@ -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

View File

@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ClickableTransparentOverlay" Version="9.1.0" />
<PackageReference Include="ImGui.NET" Version="1.90.1.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
<PackageReference Include="swed64" Version="1.0.5" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="Veldrid.ImGui" Version="5.72.0" />
<PackageReference Include="Vortice.Mathematics" Version="1.7.8" />
</ItemGroup>
</Project>

152
GmodCheatx64/Program.cs Normal file
View File

@@ -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<entity> entityList = new List<entity>();
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);
}
}
}
}
}

16
GmodCheatx64/entity.cs Normal file
View File

@@ -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;
}
}

65
GmodCheatx64/renderer.cs Normal file
View File

@@ -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
}
}
}
}