- Статус
- Оффлайн
- Регистрация
- 19 Июн 2019
- Сообщения
- 281
- Реакции
- 46
У моих друзей почему то съезжает есп. Протестил на full hd и 4k мониках.
У меня фулл хд и всё норм, а у друзей с фулл хд и 4к всё хуёво (на скрине).
Что делать? Сурс от
upd:
У меня фулл хд и всё норм, а у друзей с фулл хд и 4к всё хуёво (на скрине).
Что делать? Сурс от
Пожалуйста, авторизуйтесь для просмотра ссылки.
(noad)upd:
cs:
using Multi_ESP;
using Swed64;
using System.Numerics;
using System.Net;
using System.Reflection.PortableExecutable;
//main logic
//init swed
Swed swed = new Swed("cs2");
//get client.dll
IntPtr client = swed.GetModuleBase("client.dll");
//init render
Renderer renderer = new Renderer();
Thread renderThread = new Thread(new ThreadStart(renderer.Start().Wait));
renderThread.Start();
//get screen size
Vector2 screenSize = renderer.screeenSize;
//store enteties
List<Entity> entities = new List<Entity>();
Entity localPlayer = new Entity();
// offsets
//offsets.cs
int dwEntityList = (int)Dumper.Offsets.dwEntityList;
int dwLocalPlayerPawn = (int)Dumper.Offsets.dwLocalPlayerPawn;
int dwViewMatrix = (int)Dumper.Offsets.dwViewMatrix;
//client.dll offsets
int m_vOldOrigin = (int)Dumper.ClientDll.C_BasePlayerPawn.m_vOldOrigin; // C_BasePlayerPawn
int m_iTeamNum = (int)Dumper.ClientDll.C_BaseEntity.m_iTeamNum; // C_BaseEntity
int m_lifeState = (int)Dumper.ClientDll.C_BaseEntity.m_lifeState; // C_BaseEntity
int m_hPlayerPawn = (int)Dumper.ClientDll.CCSPlayerController.m_hPlayerPawn; // CCSPlayerController
int m_vecViewOffset = (int)Dumper.ClientDll.C_BaseModelEntity.m_vecViewOffset; // C_BaseModelEntity
int m_iHealth = (int)Dumper.ClientDll.C_BaseEntity.m_iHealth; // C_BaseEntity // new offset for hp
int m_iszPlayerName = (int)Dumper.ClientDll.CBasePlayerController.m_iszPlayerName; // CBasePlayerController // name
int m_entitySpottedState = (int)Dumper.ClientDll.C_CSPlayerPawn.m_entitySpottedState; // C_CSPlayerPawn
int m_bSpotted = (int)Dumper.ClientDll.EntitySpottedState_t.m_bSpotted; // EntitySpottedState_t
int m_bOldIsScoped = (int)Dumper.ClientDll.C_CSPlayerPawn.m_bOldIsScoped; // C_CSPlayerPawn // bool
int m_modelState = (int)Dumper.ClientDll.CSkeletonInstance.m_modelState; // CSkeletonInstance
int m_pGameSceneNode = (int)Dumper.ClientDll.C_BaseEntity.m_pGameSceneNode; // C_BaseEntity
int m_pClippingWeapon = (int)Dumper.ClientDll.C_CSPlayerPawnBase.m_pClippingWeapon; // C_CSPlayerPawnBase
int m_iItemDefinitionIndex = (int)Dumper.ClientDll.C_EconItemView.m_iItemDefinitionIndex; // C_EconItemView
int m_AttributeManager = (int)Dumper.ClientDll.C_EconEntity.m_AttributeManager; // C_EconEntity
int m_Item = (int)Dumper.ClientDll.C_AttributeContainer.m_Item; // C_AttributeContainer
//esp loop
while (true)
{
entities.Clear();
//get entity list
IntPtr entityList = swed.ReadPointer(client, dwEntityList);
//make entry
IntPtr listEntry = swed.ReadPointer(entityList, 0x10);
//get localPlayerPawn
IntPtr localPlayerPawn = swed.ReadPointer(client, dwLocalPlayerPawn);
//getting our team
localPlayer.team = swed.ReadInt(localPlayerPawn , m_iTeamNum);
//loop through entity list
for( int i = 1; i < 64; i++)
{
if (listEntry == IntPtr.Zero) continue;
IntPtr currentController = swed.ReadPointer(listEntry, i * 0x78);
if (currentController == IntPtr.Zero) continue;
int pawnHandle = swed.ReadInt(currentController, m_hPlayerPawn);
if (pawnHandle == 0) continue;
IntPtr listEntry2 = swed.ReadPointer(entityList, 0x8 * ((pawnHandle & 0x7FFF) >> 9) + 0x10);
IntPtr currentPawn = swed.ReadPointer(listEntry2, 0x78 * (pawnHandle & 0x1FF));
//check lifestate
int lifeState = swed.ReadInt(currentPawn, m_lifeState);
if (lifeState !=256) continue;
IntPtr sceneNode = swed.ReadPointer(currentPawn, m_pGameSceneNode);
IntPtr boneMatrix = swed.ReadPointer(sceneNode, m_modelState + 0x80);
//get matrix
float[] viewMatrix = swed.ReadMatrix(client + dwViewMatrix);
IntPtr currentWeapon = swed.ReadPointer(currentPawn, m_pClippingWeapon);
// get item defenition index
short weponDefenitionIndex = swed.ReadShort(currentWeapon, m_AttributeManager + m_Item + m_iItemDefinitionIndex);
//populate entities
Entity entity = new Entity();
entity.spotted = swed.ReadBool(currentPawn, m_entitySpottedState + m_bSpotted);
entity.scoped = swed.ReadBool(currentPawn, m_bOldIsScoped);
entity.name = swed.ReadString(currentController , m_iszPlayerName, 16).Split("\0")[0];// reading name
entity.team = swed.ReadInt(currentPawn, m_iTeamNum);
entity.health = swed.ReadInt(currentPawn, m_iHealth);// reading hp
entity.position = swed.ReadVec(currentPawn, m_vOldOrigin);
entity.viewOffset = swed.ReadVec(currentPawn, m_vecViewOffset);
entity.position2d = Calculate.WordToScreen(viewMatrix, entity.position, screenSize);
entity.viewPosition2D = Calculate.WordToScreen(viewMatrix, Vector3.Add(entity.position, entity.viewOffset), screenSize);
entity.distance = Vector3.Distance(entity.position, localPlayer.position);
entity.bones = Calculate.ReadBones(boneMatrix, swed);
entity.bones2d = Calculate.ReadBones2d(entity.bones, viewMatrix, renderer.screeenSize);
entity.currentWeaponIndex = weponDefenitionIndex;
entity.currentWeaponName = Enum.GetName(typeof(Weapon), weponDefenitionIndex);
entities.Add(entity);
//Console.WriteLine($"entity pos: {entity.position.X} ,{entity.position.Y}, {entity.position.Z}. team : {entity.team}. ID: {i} , weapon: {entity.currentWeaponName}");
}
//Console.Clear();
//update render
renderer.UpdateLocalPlayer(localPlayer);
renderer.UpdateEntities(entities);
Thread.Sleep(1);
}
cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using Swed64;
namespace Multi_ESP
{
public static class Calculate
{
public static Vector2 WordToScreen(float[] matrix, Vector3 pos, Vector2 windowSize)
{
float screenW = (matrix[12] * pos.X) + (matrix[13] * pos.Y) + (matrix[14] * pos.Z) + matrix[15];
if (screenW < 0.001f)
{
return new Vector2(-1, -1);
}
float screenX = (matrix[0] * pos.X) + (matrix[1] * pos.Y) + (matrix[2] * pos.Z) + matrix[3];
float screenY = (matrix[4] * pos.X) + (matrix[5] * pos.Y) + (matrix[6] * pos.Z) + matrix[7];
float X = (windowSize.X / 2) * (1 + screenX / screenW);
float Y = (windowSize.Y / 2) * (1 - screenY / screenW);
return new Vector2(X, Y);
}
//skeleton
public static List<Vector3> ReadBones(IntPtr boneAddress, Swed swed)
{
byte[] boneBytes = swed.ReadBytes(boneAddress, 27 * 32 + 16); // get max, 27 = id, 32 = step
List<Vector3> bones = new List<Vector3>();
foreach (var boneId in Enum.GetValues(typeof(BonesIds))) // loop throuh enums
{
float x = BitConverter.ToSingle(boneBytes, (int)boneId * 32 + 0);
float y = BitConverter.ToSingle(boneBytes, (int)boneId * 32 + 4); //float = 4 bytes
float z = BitConverter.ToSingle(boneBytes, (int)boneId * 32 + 8);
Vector3 currentBone = new Vector3(x, y, z);
bones.Add(currentBone);
}
return bones;
}
public static List<Vector2> ReadBones2d(List<Vector3> bones, float[] viewMatrix, Vector2 screenSize)
{
List<Vector2> bones2d = new List<Vector2>();
foreach (Vector3 bone in bones)
{
Vector2 bone2d = Calculate.WordToScreen(viewMatrix, bone, screenSize);
bones2d.Add(bone2d);
}
return bones2d;
}
}
}
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using ClickableTransparentOverlay;
using System.Runtime.InteropServices;
using ImGuiNET;
namespace Multi_ESP
{
internal class Renderer : Overlay
{
[DllImport("kernel32.dll")]
static extern IntPtr GetConsoleWindow();
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
static extern short GetAsyncKeyState(int vKey);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetForegroundWindow(IntPtr hWnd);
private float yOffset = 20;
//render vals
public Vector2 screeenSize = new Vector2(1920, 1080); // ТУТ ПЫТАЛСЯ МЕНЯТЬ ПОД РАЗРЕШЕНИЯ, НЕ ПОМОГЛО
//enteties copy
private ConcurrentQueue<Entity> entities = new ConcurrentQueue<Entity>();
private Entity localPlayer = new Entity();
private readonly object entityLock = new object();
//design styles
private Vector4 _test_softRed = new Vector4(1, (float)1/255*80, (float)1 / 255 * 80, 1);
//gui elements
private bool enableEsp = false;
private bool teamCheck = true;
private bool enableBones = true;
private bool enableName = true;
private bool enableVisibilityCheck = true;
private bool weaponEsp = false;
private bool box = true;
private bool drawLine = false;
//
//gui TEST elems
private int _test_slider = 0;
private int _test_combo = 0;
private int _test_InputInteger = 100;
private Vector4 _test_colorVal1 = new Vector4(105, 255, 0, 255);
private Vector4 _test_ColorEdit11 = new Vector4(1, 1, 1, 1);
private Vector4 _test_ColorPicker11 = new Vector4(1, 1, 1, 1);
bool showWindow = true;
private float boneThickness = 4;
private Vector4 enemyColor = new Vector4(1, 0, 0, 1); // red
private Vector4 teamColor = new Vector4(0, 1, 0, 1); // green
private Vector4 barColor = new Vector4(0, 1, 0, 1);//green
private Vector4 nameColor = new Vector4(1,1,1,1); //white
private Vector4 hiddenColor = new Vector4(0,0,0,1); //black
private Vector4 BoneColor = new Vector4(1,0,2,1);
//private Vector4 weaponColor = new Vector4(1, 0, 1, 0);
//draw list
ImDrawListPtr drawList;
protected override void Render()
{
//imgui menu
if (GetAsyncKeyState(0x2D)<0)
{
showWindow = !showWindow;
Thread.Sleep(100);
}
if (showWindow)
{
ImGui.Begin("basic esp", ImGuiWindowFlags.NoScrollbar);
ImGui.BeginTabBar("Cheat");
if (ImGui.BeginTabItem("ESP"))
{
ImGui.Checkbox("enable esp", ref enableEsp);
if (enableEsp)
{
ImGui.Checkbox("TUMMEUTU", ref teamCheck);
ImGui.Checkbox("weapon esp", ref weaponEsp);
ImGui.Checkbox("box", ref box);
ImGui.Checkbox("draw line", ref drawLine);
ImGui.Checkbox("bones", ref enableBones);
if (ImGui.CollapsingHeader("bone color"))
{
ImGui.ColorPicker4("##Bone color", ref BoneColor);
}
ImGui.Checkbox("enable visibility check", ref enableVisibilityCheck);
ImGui.Checkbox("enable name", ref enableName);
if (ImGui.CollapsingHeader("team color"))
{
ImGui.ColorPicker4("##teamcolor", ref teamColor);
}
if (ImGui.CollapsingHeader("enemy color"))
{
ImGui.ColorPicker4("##enemycolor", ref enemyColor);
}
if (ImGui.CollapsingHeader("hp bar color"))
{
ImGui.ColorPicker4("##barColor", ref barColor);
}
if (ImGui.CollapsingHeader("name color") && enableName)
{
ImGui.ColorPicker4("##namecolor", ref nameColor);
}
if (ImGui.CollapsingHeader("behind the color") && enableVisibilityCheck)
{
ImGui.ColorPicker4("##inviscolor", ref hiddenColor);
}
}
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Test"))
{
ImGui.Checkbox("Checkbox", ref enableEsp);
ImGui.Text("Text");
ImGui.TextColored(_test_colorVal1, "TextColored");
ImGui.Button("Button");
ImGui.SliderInt("Slider", ref _test_slider, 0, 100);
var _test_comboElems = "One\0Tho\0Tree";
ImGui.Combo("Combo", ref _test_combo, _test_comboElems);
ImGui.InputInt("InputInt", ref _test_InputInteger, 2,2);
ImGui.ColorEdit4("ColorEdit4", ref _test_ColorEdit11);
//ImGui.ColorPicker4("ColorPicker4", ref _test_ColorPicker11);
if (ImGui.CollapsingHeader("CollapsingHeader"))
{
ImGui.TextColored(_test_softRed, "Into CollapsingHeader");
ImGui.SameLine();
ImGui.TextColored(_test_ColorEdit11, "Into CollapsingHeader "+_test_ColorEdit11.ToString());
}
ImGui.EndTabItem();
}
ImGui.EndTabBar();
ImGui.Text("MENU BUTTON: [INSERT]");
ImGui.SetCursorPos(new Vector2(ImGui.GetWindowWidth() - 40, 26));
if (ImGui.Button("Exit"))
{
Environment.Exit(0);
}
}
// draw overlay
DrawOverlay(screeenSize);
drawList = ImGui.GetWindowDrawList();
//drawsuff
if (enableEsp)
{
foreach(Entity entity in entities)
{
//check if entity in screen
if (EntityOnSceen(entity))
{
//if (teamCheck) if (entity.team == localPlayer.team) return;
if (entity.team != localPlayer.team & teamCheck)
{
//draw methods (all)
DrawHealthBar(entity);
if (box) DrawBox(entity);
if (drawLine) DrawLine(entity);
DrawNameAndWeapon(entity);
ScopedCheck(entity);
if (enableBones && entity.team != localPlayer.team) DrawBones(entity);
}
else if (!teamCheck)
{
//draw methods (all)
DrawHealthBar(entity);
if (box) DrawBox(entity);
if (drawLine) DrawLine(entity);
DrawNameAndWeapon(entity);
ScopedCheck(entity);
if (enableBones && entity.team != localPlayer.team) DrawBones(entity);
}
}
}
}
}
//check position
bool EntityOnSceen(Entity entity)
{
if(entity.position2d.X > 0 && entity.position2d.X < screeenSize.X && entity.position2d.Y>0 && entity.position2d.Y < screeenSize.Y)
{
return true;
}
return false;
}
// drawing methods
private void DrawBox(Entity entity)
{
// calc box height
float entityHeight = entity.position2d.Y - entity.viewPosition2D.Y;
//calc box dimensions
Vector2 rectTop = new Vector2(entity.viewPosition2D.X - entityHeight / 4, entity.viewPosition2D.Y - entityHeight / 8.5f);
Vector2 rectBottom = new Vector2(entity.viewPosition2D.X + entityHeight / 4, entity.viewPosition2D.Y + entityHeight);
Vector4 boxColor = localPlayer.team == entity.team ? teamColor : enemyColor;
if (enableVisibilityCheck && localPlayer.team != entity.team)
{
boxColor = entity.spotted ? boxColor : hiddenColor;
}
// Draw rectangle
drawList.AddRect(rectTop, rectBottom, ImGui.ColorConvertFloat4ToU32(boxColor));
/*if (!enableBones)
{
// Calculate center of the top side of the rectangle
Vector2 circleCenter = new Vector2((rectTop.X + rectBottom.X) / 2, rectTop.Y);
// Calculate radius of the circle (half of the height of the rectangle)
float circleRadius = entityHeight / 8.5f;
// hidden check
// Draw circle
drawList.AddCircle(circleCenter, circleRadius, ImGui.ColorConvertFloat4ToU32(boxColor));
}*/
}
private void DrawLine(Entity entity)
{
Vector4 lineColor = localPlayer.team == entity.team ? teamColor : enemyColor;
if (enableVisibilityCheck && localPlayer.team != entity.team)
{
lineColor = entity.spotted ? lineColor : hiddenColor;
}
//draw line
drawList.AddLine(new Vector2(screeenSize.X / 2, screeenSize.Y), entity.position2d, ImGui.ColorConvertFloat4ToU32(lineColor));
}
private void DrawHealthBar(Entity entity)
{
//calc the hp bar height
float entityHeight = entity.position2d.Y - entity.viewPosition2D.Y;
//calc width
float boxLeft = entity.viewPosition2D.X - entityHeight / 4 + 0.01f;
float boxRight = entity.viewPosition2D.X + entityHeight / 4 + 0.01f;
//calc health bar width and height
float barPercentWidth = 0.05f; // 5% of box width
float barHeight = entityHeight * (entity.health / 100f);
float barPixelWidth = barPercentWidth * (boxRight - boxLeft);
//calc bar rectangle
Vector2 barTop = new Vector2(boxLeft - barPixelWidth, entity.position2d.Y - barHeight);
Vector2 barBottom = new Vector2(boxLeft, entity.position2d.Y);
//get bar color
//drawing
drawList.AddRectFilled(barTop, barBottom, ImGui.ColorConvertFloat4ToU32(barColor));
}
private void DrawNameAndWeapon(Entity entity)
{
if (enableName)
{
// Используем расстояние из объекта Entity
float distance = entity.distance;
// Масштабируем размер текста в зависимости от расстояния
float textScale = 0.8f / (distance * 0.1f); // Пример формулы масштабирования
textScale = Math.Clamp(textScale, 0.5f, 2.0f) * 1.5f; // Ограничиваем минимальный и максимальный размер
// Позиция для текста (имя)
Vector2 textLocation1 = new Vector2(entity.viewPosition2D.X, entity.position2d.Y);
// Устанавливаем размер текста
ImGui.SetWindowFontScale(textScale);
// Отрисовываем текст (имя)
drawList.AddText(textLocation1, ImGui.ColorConvertFloat4ToU32(nameColor), $"{entity.name}");
// Если включено отображение оружия
}
if (weaponEsp)
{
// Позиция для текста (оружие)
Vector2 textLocation2 = new Vector2(entity.viewPosition2D.X, entity.position2d.Y);
// Отрисовываем текст (оружие)
drawList.AddText(textLocation2, ImGui.ColorConvertFloat4ToU32(nameColor), $"GUN : {entity.currentWeaponName}");
}
// Возвращаем размер текста к значению по умолчанию
ImGui.SetWindowFontScale(1.0f);
}
private void ScopedCheck(Entity entity)
{
Vector2 textLocation = new Vector2(entity.viewPosition2D.X, entity.position2d.Y + yOffset);
if (entity.scoped)
{
drawList.AddText(textLocation, ImGui.ColorConvertFloat4ToU32(nameColor), $"SCOPPED");
}
}
// bones draw methods
private void DrawBones(Entity entity)
{
// get ether team or enemy colorr depending on the team
uint uintColor = ImGui.ColorConvertFloat4ToU32(BoneColor);
float currentBoneThickness;
if (localPlayer.scoped)
{
currentBoneThickness = boneThickness;
}
else
{
currentBoneThickness = boneThickness / entity.distance;
}
//draw lines between bones
drawList.AddLine(entity.bones2d[1], entity.bones2d[2], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[1], entity.bones2d[3], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[1], entity.bones2d[6], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[3], entity.bones2d[4], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[6], entity.bones2d[7], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[4], entity.bones2d[5], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[7], entity.bones2d[8], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[1], entity.bones2d[0], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[0], entity.bones2d[9], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[0], entity.bones2d[11], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[9], entity.bones2d[10], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[11], entity.bones2d[12], uintColor, currentBoneThickness);
drawList.AddCircle(entity.bones2d[2], (entity.position2d.Y - entity.viewPosition2D.Y) / 8.5f, uintColor);
}
//transfer entity methods
public void UpdateEntities(IEnumerable<Entity> newEntities)
{
entities = new ConcurrentQueue<Entity>(newEntities);
}
public void UpdateLocalPlayer(Entity newEntity)
{
lock (entityLock)
{
localPlayer = newEntity;
}
}
public Entity GetLocalPlayer()
{
lock (entityLock){
return localPlayer;
}
}
// draw overlay
void DrawOverlay(Vector2 screenSize)
{
//ImGui.GetIO().Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\Arial.ttf", 22, null, ImGui.GetIO().Fonts.GetGlyphRangesCyrillic());
ImGui.SetNextWindowSize(screenSize);
ImGui.SetNextWindowPos(new Vector2(0,0));
ImGui.Begin("overlay", ImGuiWindowFlags.NoDecoration
| ImGuiWindowFlags.NoBackground
| ImGuiWindowFlags.NoBringToFrontOnFocus
| ImGuiWindowFlags.NoMove
| ImGuiWindowFlags.NoInputs
| ImGuiWindowFlags.NoCollapse
| ImGuiWindowFlags.NoScrollbar
| ImGuiWindowFlags.NoScrollWithMouse
);
}
}
}
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using ClickableTransparentOverlay;
using System.Runtime.InteropServices;
using ImGuiNET;
namespace Multi_ESP
{
internal class Renderer : Overlay
{
[DllImport("kernel32.dll")]
static extern IntPtr GetConsoleWindow();
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
static extern short GetAsyncKeyState(int vKey);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetForegroundWindow(IntPtr hWnd);
private float yOffset = 20;
//render vals
public Vector2 screeenSize = new Vector2(1920, 1080); // ТУТ ПЫТАЛСЯ МЕНЯТЬ ПОД РАЗРЕШЕНИЯ, НЕ ПОМОГЛО
//enteties copy
private ConcurrentQueue<Entity> entities = new ConcurrentQueue<Entity>();
private Entity localPlayer = new Entity();
private readonly object entityLock = new object();
//design styles
private Vector4 _test_softRed = new Vector4(1, (float)1/255*80, (float)1 / 255 * 80, 1);
//gui elements
private bool enableEsp = false;
private bool teamCheck = true;
private bool enableBones = true;
private bool enableName = true;
private bool enableVisibilityCheck = true;
private bool weaponEsp = false;
private bool box = true;
private bool drawLine = false;
//
//gui TEST elems
private int _test_slider = 0;
private int _test_combo = 0;
private int _test_InputInteger = 100;
private Vector4 _test_colorVal1 = new Vector4(105, 255, 0, 255);
private Vector4 _test_ColorEdit11 = new Vector4(1, 1, 1, 1);
private Vector4 _test_ColorPicker11 = new Vector4(1, 1, 1, 1);
bool showWindow = true;
private float boneThickness = 4;
private Vector4 enemyColor = new Vector4(1, 0, 0, 1); // red
private Vector4 teamColor = new Vector4(0, 1, 0, 1); // green
private Vector4 barColor = new Vector4(0, 1, 0, 1);//green
private Vector4 nameColor = new Vector4(1,1,1,1); //white
private Vector4 hiddenColor = new Vector4(0,0,0,1); //black
private Vector4 BoneColor = new Vector4(1,0,2,1);
//private Vector4 weaponColor = new Vector4(1, 0, 1, 0);
//draw list
ImDrawListPtr drawList;
protected override void Render()
{
//imgui menu
if (GetAsyncKeyState(0x2D)<0)
{
showWindow = !showWindow;
Thread.Sleep(100);
}
if (showWindow)
{
ImGui.Begin("basic esp", ImGuiWindowFlags.NoScrollbar);
ImGui.BeginTabBar("Cheat");
if (ImGui.BeginTabItem("ESP"))
{
ImGui.Checkbox("enable esp", ref enableEsp);
if (enableEsp)
{
ImGui.Checkbox("TUMMEUTU", ref teamCheck);
ImGui.Checkbox("weapon esp", ref weaponEsp);
ImGui.Checkbox("box", ref box);
ImGui.Checkbox("draw line", ref drawLine);
ImGui.Checkbox("bones", ref enableBones);
if (ImGui.CollapsingHeader("bone color"))
{
ImGui.ColorPicker4("##Bone color", ref BoneColor);
}
ImGui.Checkbox("enable visibility check", ref enableVisibilityCheck);
ImGui.Checkbox("enable name", ref enableName);
if (ImGui.CollapsingHeader("team color"))
{
ImGui.ColorPicker4("##teamcolor", ref teamColor);
}
if (ImGui.CollapsingHeader("enemy color"))
{
ImGui.ColorPicker4("##enemycolor", ref enemyColor);
}
if (ImGui.CollapsingHeader("hp bar color"))
{
ImGui.ColorPicker4("##barColor", ref barColor);
}
if (ImGui.CollapsingHeader("name color") && enableName)
{
ImGui.ColorPicker4("##namecolor", ref nameColor);
}
if (ImGui.CollapsingHeader("behind the color") && enableVisibilityCheck)
{
ImGui.ColorPicker4("##inviscolor", ref hiddenColor);
}
}
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Test"))
{
ImGui.Checkbox("Checkbox", ref enableEsp);
ImGui.Text("Text");
ImGui.TextColored(_test_colorVal1, "TextColored");
ImGui.Button("Button");
ImGui.SliderInt("Slider", ref _test_slider, 0, 100);
var _test_comboElems = "One\0Tho\0Tree";
ImGui.Combo("Combo", ref _test_combo, _test_comboElems);
ImGui.InputInt("InputInt", ref _test_InputInteger, 2,2);
ImGui.ColorEdit4("ColorEdit4", ref _test_ColorEdit11);
//ImGui.ColorPicker4("ColorPicker4", ref _test_ColorPicker11);
if (ImGui.CollapsingHeader("CollapsingHeader"))
{
ImGui.TextColored(_test_softRed, "Into CollapsingHeader");
ImGui.SameLine();
ImGui.TextColored(_test_ColorEdit11, "Into CollapsingHeader "+_test_ColorEdit11.ToString());
}
ImGui.EndTabItem();
}
ImGui.EndTabBar();
ImGui.Text("MENU BUTTON: [INSERT]");
ImGui.SetCursorPos(new Vector2(ImGui.GetWindowWidth() - 40, 26));
if (ImGui.Button("Exit"))
{
Environment.Exit(0);
}
}
// draw overlay
DrawOverlay(screeenSize);
drawList = ImGui.GetWindowDrawList();
//drawsuff
if (enableEsp)
{
foreach(Entity entity in entities)
{
//check if entity in screen
if (EntityOnSceen(entity))
{
//if (teamCheck) if (entity.team == localPlayer.team) return;
if (entity.team != localPlayer.team & teamCheck)
{
//draw methods (all)
DrawHealthBar(entity);
if (box) DrawBox(entity);
if (drawLine) DrawLine(entity);
DrawNameAndWeapon(entity);
ScopedCheck(entity);
if (enableBones && entity.team != localPlayer.team) DrawBones(entity);
}
else if (!teamCheck)
{
//draw methods (all)
DrawHealthBar(entity);
if (box) DrawBox(entity);
if (drawLine) DrawLine(entity);
DrawNameAndWeapon(entity);
ScopedCheck(entity);
if (enableBones && entity.team != localPlayer.team) DrawBones(entity);
}
}
}
}
}
//check position
bool EntityOnSceen(Entity entity)
{
if(entity.position2d.X > 0 && entity.position2d.X < screeenSize.X && entity.position2d.Y>0 && entity.position2d.Y < screeenSize.Y)
{
return true;
}
return false;
}
// drawing methods
private void DrawBox(Entity entity)
{
// calc box height
float entityHeight = entity.position2d.Y - entity.viewPosition2D.Y;
//calc box dimensions
Vector2 rectTop = new Vector2(entity.viewPosition2D.X - entityHeight / 4, entity.viewPosition2D.Y - entityHeight / 8.5f);
Vector2 rectBottom = new Vector2(entity.viewPosition2D.X + entityHeight / 4, entity.viewPosition2D.Y + entityHeight);
Vector4 boxColor = localPlayer.team == entity.team ? teamColor : enemyColor;
if (enableVisibilityCheck && localPlayer.team != entity.team)
{
boxColor = entity.spotted ? boxColor : hiddenColor;
}
// Draw rectangle
drawList.AddRect(rectTop, rectBottom, ImGui.ColorConvertFloat4ToU32(boxColor));
/*if (!enableBones)
{
// Calculate center of the top side of the rectangle
Vector2 circleCenter = new Vector2((rectTop.X + rectBottom.X) / 2, rectTop.Y);
// Calculate radius of the circle (half of the height of the rectangle)
float circleRadius = entityHeight / 8.5f;
// hidden check
// Draw circle
drawList.AddCircle(circleCenter, circleRadius, ImGui.ColorConvertFloat4ToU32(boxColor));
}*/
}
private void DrawLine(Entity entity)
{
Vector4 lineColor = localPlayer.team == entity.team ? teamColor : enemyColor;
if (enableVisibilityCheck && localPlayer.team != entity.team)
{
lineColor = entity.spotted ? lineColor : hiddenColor;
}
//draw line
drawList.AddLine(new Vector2(screeenSize.X / 2, screeenSize.Y), entity.position2d, ImGui.ColorConvertFloat4ToU32(lineColor));
}
private void DrawHealthBar(Entity entity)
{
//calc the hp bar height
float entityHeight = entity.position2d.Y - entity.viewPosition2D.Y;
//calc width
float boxLeft = entity.viewPosition2D.X - entityHeight / 4 + 0.01f;
float boxRight = entity.viewPosition2D.X + entityHeight / 4 + 0.01f;
//calc health bar width and height
float barPercentWidth = 0.05f; // 5% of box width
float barHeight = entityHeight * (entity.health / 100f);
float barPixelWidth = barPercentWidth * (boxRight - boxLeft);
//calc bar rectangle
Vector2 barTop = new Vector2(boxLeft - barPixelWidth, entity.position2d.Y - barHeight);
Vector2 barBottom = new Vector2(boxLeft, entity.position2d.Y);
//get bar color
//drawing
drawList.AddRectFilled(barTop, barBottom, ImGui.ColorConvertFloat4ToU32(barColor));
}
private void DrawNameAndWeapon(Entity entity)
{
if (enableName)
{
// Используем расстояние из объекта Entity
float distance = entity.distance;
// Масштабируем размер текста в зависимости от расстояния
float textScale = 0.8f / (distance * 0.1f); // Пример формулы масштабирования
textScale = Math.Clamp(textScale, 0.5f, 2.0f) * 1.5f; // Ограничиваем минимальный и максимальный размер
// Позиция для текста (имя)
Vector2 textLocation1 = new Vector2(entity.viewPosition2D.X, entity.position2d.Y);
// Устанавливаем размер текста
ImGui.SetWindowFontScale(textScale);
// Отрисовываем текст (имя)
drawList.AddText(textLocation1, ImGui.ColorConvertFloat4ToU32(nameColor), $"{entity.name}");
// Если включено отображение оружия
}
if (weaponEsp)
{
// Позиция для текста (оружие)
Vector2 textLocation2 = new Vector2(entity.viewPosition2D.X, entity.position2d.Y);
// Отрисовываем текст (оружие)
drawList.AddText(textLocation2, ImGui.ColorConvertFloat4ToU32(nameColor), $"GUN : {entity.currentWeaponName}");
}
// Возвращаем размер текста к значению по умолчанию
ImGui.SetWindowFontScale(1.0f);
}
private void ScopedCheck(Entity entity)
{
Vector2 textLocation = new Vector2(entity.viewPosition2D.X, entity.position2d.Y + yOffset);
if (entity.scoped)
{
drawList.AddText(textLocation, ImGui.ColorConvertFloat4ToU32(nameColor), $"SCOPPED");
}
}
// bones draw methods
private void DrawBones(Entity entity)
{
// get ether team or enemy colorr depending on the team
uint uintColor = ImGui.ColorConvertFloat4ToU32(BoneColor);
float currentBoneThickness;
if (localPlayer.scoped)
{
currentBoneThickness = boneThickness;
}
else
{
currentBoneThickness = boneThickness / entity.distance;
}
//draw lines between bones
drawList.AddLine(entity.bones2d[1], entity.bones2d[2], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[1], entity.bones2d[3], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[1], entity.bones2d[6], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[3], entity.bones2d[4], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[6], entity.bones2d[7], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[4], entity.bones2d[5], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[7], entity.bones2d[8], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[1], entity.bones2d[0], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[0], entity.bones2d[9], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[0], entity.bones2d[11], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[9], entity.bones2d[10], uintColor, currentBoneThickness);
drawList.AddLine(entity.bones2d[11], entity.bones2d[12], uintColor, currentBoneThickness);
drawList.AddCircle(entity.bones2d[2], (entity.position2d.Y - entity.viewPosition2D.Y) / 8.5f, uintColor);
}
//transfer entity methods
public void UpdateEntities(IEnumerable<Entity> newEntities)
{
entities = new ConcurrentQueue<Entity>(newEntities);
}
public void UpdateLocalPlayer(Entity newEntity)
{
lock (entityLock)
{
localPlayer = newEntity;
}
}
public Entity GetLocalPlayer()
{
lock (entityLock){
return localPlayer;
}
}
// draw overlay
void DrawOverlay(Vector2 screenSize)
{
//ImGui.GetIO().Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\Arial.ttf", 22, null, ImGui.GetIO().Fonts.GetGlyphRangesCyrillic());
ImGui.SetNextWindowSize(screenSize);
ImGui.SetNextWindowPos(new Vector2(0,0));
ImGui.Begin("overlay", ImGuiWindowFlags.NoDecoration
| ImGuiWindowFlags.NoBackground
| ImGuiWindowFlags.NoBringToFrontOnFocus
| ImGuiWindowFlags.NoMove
| ImGuiWindowFlags.NoInputs
| ImGuiWindowFlags.NoCollapse
| ImGuiWindowFlags.NoScrollbar
| ImGuiWindowFlags.NoScrollWithMouse
);
}
}
}
cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
namespace Multi_ESP
{
public class Entity
{
public List<Vector3> bones { get; set; }
public List<Vector2> bones2d { get; set; }
public Vector3 position { get; set; }
public Vector3 viewOffset { get; set; }
public Vector2 position2d { get; set; }
public Vector2 viewPosition2D { get; set; }
public int team { get; set; }
//bones
public Vector3 origin { get; set; }
public float distance { get; set; }
//////////
public short currentWeaponIndex { get; set; }
public string currentWeaponName { get; set; }
public int health { get; set; }
public string name { get; set; }
public bool spotted { get; set; }
public bool scoped { get; set; }
}
public enum BonesIds
{
Waist = 0, //0
Neck = 5, //1
Head = 6, //2
ShoulderLeft = 8, //3
ForeLeft = 9, //4
HandLeft = 11, //5
ShoulderRight = 13, //6
ForeRight = 14, //7
HandRight = 16, //8
KneeLeft = 23,//9
FeetLeft = 24, //10
KneeRight = 26, //11
FeetRight = 27, //12
}
public enum Weapon
{
DEAGLE = 1,
BERETAS = 2,
FIVESEVEN = 3,
GLOCK = 4,
AK47 = 7,
AUG = 8,
AWP = 9,
FAMAS = 10,
G3SG1 = 11,
GALILAR = 13,
M249 = 14,
M4A1 = 16,
MAC10 = 17,
P90 = 19,
MP5SD = 23,
UMP45 = 24,
XM1014 = 25,
BIZON = 26,
MAG7 = 27,
NEGEV = 28,
SAWEDOFF = 29,
TEC9 = 30,
TASER = 31,
HKP2000 = 32,
MP7 = 33,
MP9 = 34,
NOVA = 35,
P250 = 36,
SHIELD = 37,
SCAR20 = 38,
SG556 = 39,
SSG08 = 40,
KNIFEGG = 41,
KNIFE = 42,
FLASHBANG = 43,
HEGRENADE = 44,
SMOKEGRENADE = 45,
MOLOTOV = 46,
DECOY = 47,
INCGRENADE = 48,
C4 = 49,
HEALTHSHOT = 57,
KNIFE_T = 59,
M4A1_SILENCER = 60,
USP_SILENCER = 61,
CZ75A = 63,
REVOLVER = 64,
TAGRENADE = 68,
FISTS = 69,
BREACHCHARGE = 70,
TABLET = 72,
MELEE = 74,
AXE = 75,
HAMMER = 76,
SPANNER = 78,
KNIFE_GHOST = 80,
FIREBOMB = 81,
DIVERSION = 82,
FRAG_GRENADE = 83,
SNOWBALL = 84,
BUMPMINE = 85,
BAYONET = 500,
KNIFE_FLIP = 505,
KNIFE_GUT = 506,
KNIFE_KARAMBIT = 507,
KNIFE_M9_BAYONET = 508,
KNIFE_TACTICAL = 509,
KNIFE_FALCHION = 512,
KNIFE_SURVIVAL_BOWIE = 514,
KNIFE_BUTTERFLY = 515,
KNIFE_PUSH = 516,
KNIFE_URSUS = 519,
KNIFE_GYPSY_JACKKNIFE = 520,
KNIFE_STILETTO = 522,
KNIFE_WIDOWMAKER = 523,
};
}
Последнее редактирование: