99#include " vector.h"
1010#include " render.h"
1111#include " bone.hpp"
12+ #include " weapon.hpp"
1213#include " entity.h"
1314
1415namespace 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
5358struct 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