Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 267bfb6

Browse files
committed
骨骼透视完成
1 parent fc77aea commit 267bfb6

22 files changed

Lines changed: 262 additions & 117 deletions

CHANGELOG.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
## Changes📣
22

3-
最新更新于2024年2月29日 21:54:22,功能如下
3+
最新更新于2024年3月9日 16:39:00,现有功能如下
44

55
- 方框透视
66
- 骨骼透视
7-
- 人物身体发光
8-
- 实时显示剩余血条
7+
- 玩家身体发光
8+
- 地图扫描敌人雷达
9+
- 实时显示剩余血条、玩家名字、玩家持有的武器
910
- 自瞄锁头并开枪射击
1011
- 枪后坐力补偿
11-
- 地图扫描敌人雷达
1212
- 防闪光弹
1313
- 连跳
1414
- 玩家当前移动速度监控

CS2CheatCpp/CS2CheatCpp.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175
<ClInclude Include="src\memory\memory.h" />
176176
<ClInclude Include="src\render.h" />
177177
<ClInclude Include="src\vector.h" />
178+
<ClInclude Include="src\weapon.hpp" />
178179
</ItemGroup>
179180
<ItemGroup>
180181
<ResourceCompile Include="CS2CheatCpp1.rc" />

CS2CheatCpp/CS2CheatCpp.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@
9595
<ClInclude Include="resource1.h">
9696
<Filter>头文件</Filter>
9797
</ClInclude>
98+
<ClInclude Include="src\weapon.hpp">
99+
<Filter>头文件</Filter>
100+
</ClInclude>
98101
</ItemGroup>
99102
<ItemGroup>
100103
<ResourceCompile Include="CS2CheatCpp1.rc">

CS2CheatCpp/imgui.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ IsChild=1
112112
Size=150,380
113113

114114
[Window][CS2 Cheat]
115-
Pos=776,199
116-
Size=600,500
115+
Pos=1065,56
116+
Size=443,487
117117

118118
[Table][0xD181190E,2]
119119
Column 0 Weight=1.0000

CS2CheatCpp/src/entity.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22
#include "vector.h"
33
#include <string>
4+
#include <vector>
45

56
class Entity
67
{
@@ -12,14 +13,17 @@ class Entity
1213
int health;
1314
int team;
1415
float flashDuration;
16+
float distance;
1517
unsigned int fFlag;
1618
unsigned int lifeState;
1719
int entIndex;
20+
short currentWeaponIndex;
21+
const char* currentWeaponName;
1822
bool spotted;
1923
Vector3 head;
2024
Vector3 origin;
2125
Vector3 viewOffset;
2226
Vector3 aimPunch;
2327
Vector3 velocity;
24-
float distance;
28+
std::vector<Vector3> bones;
2529
};

CS2CheatCpp/src/gui.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -304,24 +304,26 @@ void gui::Render() noexcept
304304
}
305305
}
306306

307-
ImGui::Text("Player current movement speed: %d", speed);
308-
ImGui::Text("Player maximum movement speed: %d", maxSpeed);
309-
ImGui::Checkbox("Box perspective", &boxEsp);
310-
ImGui::Checkbox("Player body glow", &playerBodyGlow);
311-
ImGui::Checkbox("Player remaining health", &playerHealth);
307+
ImGui::Text("Current movement speed: %d", speed);
308+
ImGui::Text("Maximum movement speed: %d", maxSpeed);
309+
ImGui::Checkbox("Box perspective", &enableBoxEsp);
310+
ImGui::Checkbox("Bone perspective", &enableBoneEsp);
311+
ImGui::Checkbox("Body glow", &enableBodyGlow);
312+
ImGui::Checkbox("Remaining health", &enableHealth);
312313
ImGui::SetItemTooltip("Health is displayed in real-time as a green rectangle next to the enemy");
313-
ImGui::Checkbox("Auto-aim (aimbot)", &aimbot);
314+
ImGui::Checkbox("Weapon", &enableWeapon);
315+
ImGui::Checkbox("Auto-aim (aimbot)", &enableAimbot);
314316
ImGui::SetItemTooltip("This option requires the player to manually fire, or in conjunction with the automatic firing option. When combined with turning off the radar option, it enables visibility detection for enemies behind walls");
315-
ImGui::Checkbox("Radar", &radar);
317+
ImGui::Checkbox("Radar", &enableRadar);
316318
ImGui::SetItemTooltip("This option will continuously display the radar for enemies on the map, but it will block visibility detection and auto-aim (aimbot)");
317-
ImGui::Checkbox("Automatic firing", &autoAttack);
319+
ImGui::Checkbox("Automatic firing", &enableAutoAttack);
318320
ImGui::SetItemTooltip("This option needs to be enabled in conjunction with auto-aim (aimbot)");
319-
ImGui::Checkbox("RCS (Recoil Control System) ", &rcs);
320-
ImGui::Checkbox("Anti-flash", &flash);
321-
ImGui::Checkbox("Bunny hop", &bhop);
321+
ImGui::Checkbox("RCS (Recoil Control System) ", &enableRcs);
322+
ImGui::Checkbox("Anti-flash", &enableFlash);
323+
ImGui::Checkbox("Bunny hop", &enableBhop);
322324
ImGui::SetItemTooltip("Hold down the space bar on the keyboard continuously");
323325
ImGui::SliderInt("fov (Field of view)", &fov, 0, 180);
324-
if (bombPlanted) {
326+
if (enableBombPlanted) {
325327
ImGui::Text("The terrorist has planted the bomb. Time until explosion: %d seconds", bombTimeLeft);
326328
}
327329
else

CS2CheatCpp/src/gui.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@ namespace gui
99
// imgui控件状态
1010
inline bool exit = true;
1111
inline bool menutoggle = true;
12-
inline bool boxEsp = true;// 方框透视
13-
inline bool playerBodyGlow = true;// 玩家身体发光
14-
inline bool playerHealth = true;// 玩家血量
15-
inline bool aimbot = false;// 自瞄锁头
16-
inline bool autoAttack = false;// 自瞄锁头并开枪
17-
inline bool rcs = false; // 后座力补偿
18-
inline bool radar = false;// 雷达
19-
inline bool flash = true; // 防闪光
20-
inline bool bhop = false;// 连跳
12+
inline bool enableBoxEsp = true;// 方框透视
13+
inline bool enableBoneEsp = true;// 骨骼透视
14+
inline bool enableBodyGlow = false;// 玩家身体发光
15+
inline bool enableHealth = true;// 玩家血量
16+
inline bool enableAimbot = false;// 自瞄锁头
17+
inline bool enableAutoAttack = false;// 自瞄锁头并开枪
18+
inline bool enableRcs = false; // 后座力补偿
19+
inline bool enableRadar = false;// 雷达
20+
inline bool enableFlash = true; // 防闪光
21+
inline bool enableBhop = false;// 连跳
2122
inline int fov = 0;// 视野角度
2223
inline int speed = 0;// 当前速度
2324
inline int maxSpeed = 0;// 最大速度
24-
inline bool bombPlanted = false; // 炸弹是否已安放
25+
inline bool enableBombPlanted = false; // 炸弹是否已安放
2526
inline int bombTimeLeft = -1; // 炸弹爆炸倒计时
27+
inline bool enableWeapon = true; // 显示玩家当前的武器
2628

2729
// win32api window相关变量
2830
inline HWND overlay = nullptr;

CS2CheatCpp/src/main.cpp

Lines changed: 63 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "vector.h"
1010
#include "render.h"
1111
#include "bone.hpp"
12+
#include "weapon.hpp"
1213
#include "entity.h"
1314

1415
namespace offsets {
@@ -48,6 +49,10 @@ namespace offsets {
4849
constexpr std::ptrdiff_t m_bIsScoped = 0x1400; // bool
4950
constexpr std::ptrdiff_t m_vecAbsVelocity = 0x3D8; // Vector
5051
constexpr std::ptrdiff_t m_bBombPlanted = 0x9DD; // bool C_CSGameRules
52+
constexpr std::ptrdiff_t m_pClippingWeapon = 0x1308; // C_CSWeaponBase*
53+
constexpr std::ptrdiff_t m_iItemDefinitionIndex = 0x1BA; // uint16_t
54+
constexpr std::ptrdiff_t m_AttributeManager = 0x1098; // C_AttributeContainer C_EconEntity
55+
constexpr std::ptrdiff_t m_Item = 0x50; // C_EconItemView
5156
}
5257

5358
struct C_UTL_VECTOR
@@ -109,7 +114,7 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
109114
bombPlanted = mem.Read<bool>(gameRules + offsets::m_bBombPlanted);
110115
if (bombPlanted)
111116
{
112-
gui::bombPlanted = true;
117+
gui::enableBombPlanted = true;
113118
/*for (int i = 0;i < 40;i++)
114119
{
115120
bombPlanted = mem.Read<bool>(gameRules + offsets::m_bBombPlanted);
@@ -126,7 +131,7 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
126131
else
127132
{
128133
gui::bombTimeLeft = -1;
129-
gui::bombPlanted = false;
134+
gui::enableBombPlanted = false;
130135
}
131136
}
132137

@@ -158,7 +163,9 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
158163
if (!list_entry2) {
159164
continue;
160165
}
166+
161167
const auto currentPawn = mem.Read<uintptr_t>(list_entry2 + 120 * (playerPawnHandle & 0x1FF));// 120==0x78
168+
162169
// 扫描到"我"就排除我的信息
163170
if (!currentPawn || currentPawn == localPlayer.pawnAddress) {
164171
continue;
@@ -170,24 +177,25 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
170177
if (team == localPlayer.team) {
171178
continue;
172179
}
173-
// 玩家的真实姓名
174180
const auto playerName = mem.ReadString<128>(currentController + offsets::m_iszPlayerName);
175181

176-
// currentPawn有生命值等信息,而玩家姓名在currentController下
182+
// currentPawn有生命值、武器等信息,而玩家姓名在currentController下
177183
int health = mem.Read<int>(currentPawn + offsets::m_iHealth);
178184
const auto lifeState = mem.Read<unsigned int>(currentPawn + offsets::m_lifeState);
179185
if (health <= 0 || health > 100 || lifeState != 256) {
180186
continue;
181187
}
188+
auto currentWeapon = mem.Read<uintptr_t>(currentPawn + offsets::m_pClippingWeapon);
189+
short weaponDefinitionIndex = mem.Read<short>(currentWeapon + offsets::m_AttributeManager + offsets::m_Item + offsets::m_iItemDefinitionIndex);
182190

183191
// 获取雷达状态并设置敌人显示在雷达上
184-
if (gui::radar) {
192+
if (gui::enableRadar) {
185193
bool spotted = mem.Read<bool>(currentPawn + offsets::m_entitySpottedState + offsets::m_bSpotted);
186194
mem.Write<bool>(currentPawn + offsets::m_entitySpottedState + offsets::m_bSpotted, true);
187195
}
188196

189197
// 玩家身体发光
190-
if (gui::playerBodyGlow) {
198+
if (gui::enableBodyGlow) {
191199
mem.Write<float>(currentPawn + offsets::m_flDetectedByEnemySensorTime, 86400);
192200
}
193201

@@ -202,12 +210,13 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
202210
entity.origin = mem.Read<Vector3>(currentPawn+offsets::m_vOldOrigin);
203211
entity.viewOffset = mem.Read<Vector3>(currentPawn+offsets::m_vecViewOffset);
204212
entity.distance = Vector3::distance(entity.origin, localPlayer.origin);
213+
entity.currentWeaponIndex = weaponDefinitionIndex;
214+
entity.currentWeaponName = getWeaponName(weaponDefinitionIndex);
205215

206216
// 获取玩家的头坐标实现锁头
207217
const auto sceneNode = mem.Read<uintptr_t>(currentPawn + offsets::m_pGameSceneNode);
208218
// 获取骨骼信息绘制玩家骨骼
209219
const auto boneMatrix = mem.Read<uintptr_t>(sceneNode + offsets::m_modelState + 0x80);
210-
//Vector3 head = { entity.origin.x, entity.origin.y, entity.origin.z + 75.f };
211220
entity.head = mem.Read<Vector3>(boneMatrix + bones::head * 32);
212221

213222
// 将收集好的所有玩家信息存储起来
@@ -217,66 +226,80 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
217226
Vector3 screenPos;
218227
Vector3 screenHead;
219228

220-
RGB enemy = { 255, 0, 0 };
221-
RGB hp = { 0, 255, 0 };
222-
//RGB bone = { 255, 255, 255 };
223-
224229
if (Vector3::word_to_screen(view_matrix, entity.origin, screenPos) &&
225230
Vector3::word_to_screen(view_matrix, entity.head, screenHead) &&
226231
entity.origin.x != 0) {
227232
float height = screenPos.y - screenHead.y;
228-
//float headHeight = height / 8;
233+
float headHeight = height / 8;
229234
float width = height / 2.4f;
230235

231-
if (gui::boxEsp) {
232-
Render::DrawRect(
236+
if (gui::enableBoxEsp) {
237+
render::DrawRect(
233238
screenHead.x - width / 2,
234239
screenHead.y,
235240
width,
236241
height,
237-
enemy,
242+
render::enemy,
238243
1.5,
239244
false,
240245
255
241246
);
247+
render::DrawTextContent(
248+
screenHead.x + width / 2,
249+
screenHead.y,
250+
render::name,
251+
entity.name.c_str()
252+
);
253+
}
254+
255+
if (gui::enableWeapon) {
256+
render::DrawTextContent(
257+
screenHead.x,
258+
screenHead.y + height / 4,
259+
render::weapon,
260+
entity.currentWeaponName
261+
);
242262
}
243263

244-
if (gui::playerHealth) {
245-
Render::DrawRect(
264+
if (gui::enableHealth) {
265+
render::DrawRect(
246266
screenHead.x - (width / 2 + 10),
247267
screenHead.y + (height * (100 - health) / 100),
248268
3,
249269
height - (height * (100 - health) / 100),
250-
hp,
270+
render::hp,
251271
1.5,
252272
true,
253273
255
254274
);
255275
}
256-
}
257-
/*Render::Circle(
258-
screenHead.x,
259-
screenHead.y,
260-
headHeight - 3,
261-
bone
262-
);
263-
264-
for (int i = 0; i < sizeof(boneConnections) / sizeof(boneConnections[0]); i++) {
265-
int bone1 = boneConnections[i].bone1;
266-
int bone2 = boneConnections[i].bone2;
267276

268-
Vector3 vectorBone1 = mem.Read<Vector3>(boneArray + bone1*32);
269-
Vector3 vectorBone2 = mem.Read<Vector3>(boneArray + bone2*32);
277+
for (int i = 0; i < sizeof(boneConnections) / sizeof(boneConnections[0]); i++) {
278+
int bone1 = boneConnections[i].bone1;
279+
int bone2 = boneConnections[i].bone2;
270280

271-
Vector3 b1 = vectorBone1.WorldConvertToScreen(view_matrix);
272-
Vector3 b2 = vectorBone1.WorldConvertToScreen(view_matrix);
281+
Vector3 vectorBone1 = mem.Read<Vector3>(boneMatrix + bone1 * 32);
282+
Vector3 vectorBone2 = mem.Read<Vector3>(boneMatrix + bone2 * 32);
273283

274-
Render::Line(b1.x, b1.y, b2.x, b2.y, bone, 2.0);
275-
}*/
284+
Vector3 b1;
285+
Vector3 b2;
286+
Vector3::word_to_screen(view_matrix, vectorBone1, b1);
287+
Vector3::word_to_screen(view_matrix, vectorBone2, b2);
288+
render::Circle(
289+
screenHead.x,
290+
screenHead.y,
291+
headHeight - 3,
292+
render::bone,
293+
false,
294+
255
295+
);
296+
render::Line(b1.x, b1.y, b2.x, b2.y, render::bone, 255, 1.5);
297+
}
298+
}
276299
}
277300

278301
// 自瞄锁头并开枪
279-
if (gui::aimbot && entities.size() > 0 && !gui::radar && entities[0].spotted)
302+
if (gui::enableAimbot && entities.size() > 0 && !gui::enableRadar && entities[0].spotted)
280303
{
281304
// 扫描距离我最近的敌人
282305
std::stable_sort(entities.begin(), entities.end(), [](const Entity& entity1, const Entity& entity2) {
@@ -291,7 +314,7 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
291314
mem.Write<Vector3>(client + offsets::dwViewAngles, newAnglesVec3);
292315

293316
// 开枪
294-
if (gui::autoAttack && localPlayer.entIndex > 0)
317+
if (gui::enableAutoAttack && localPlayer.entIndex > 0)
295318
{
296319
mem.Write<int>(client + offsets::dwForceAttack, PLUS_ATTACK);
297320
std::this_thread::sleep_for(std::chrono::milliseconds(1));
@@ -301,13 +324,13 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
301324
}
302325

303326
// 防闪光弹
304-
if (gui::flash && localPlayer.flashDuration > 0)
327+
if (gui::enableFlash && localPlayer.flashDuration > 0)
305328
{
306329
mem.Write<float>(localPlayer.pawnAddress + offsets::m_flFlashBangTime, 0);
307330
}
308331

309332
// 连跳
310-
if (gui::bhop && GetAsyncKeyState(VK_SPACE) & 0x01)
333+
if (gui::enableBhop && GetAsyncKeyState(VK_SPACE) & 0x01)
311334
{
312335
if (localPlayer.fFlag == STANDING || localPlayer.fFlag == CROUCHING)
313336
{
@@ -334,7 +357,7 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
334357
gui::speed = std::sqrt(localPlayer.velocity.x * localPlayer.velocity.x + localPlayer.velocity.y * localPlayer.velocity.y + localPlayer.velocity.z * localPlayer.velocity.z);
335358

336359
// 后坐力补偿
337-
if (gui::rcs) {
360+
if (gui::enableRcs) {
338361
const auto shotsFired = mem.Read<int32_t>(localPlayer.pawnAddress + offsets::m_iShotsFired);// 开枪次数
339362
auto sensPointer = mem.Read<uintptr_t>(client + offsets::dwSensitivity);
340363
auto sensitivity = mem.Read<float>(sensPointer + offsets::dwSensitivity_sensitivity);

0 commit comments

Comments
 (0)