@@ -72,7 +72,8 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
7272 std::vector<Entity> entities;
7373 entities.reserve (64 );
7474
75- static auto oldPunch = Vector3{};
75+ static auto oldAngle = Vector3{};
76+ static auto newAngle = Vector3{};
7677 static auto velocity = Vector3{};
7778
7879 while (gui::exit)
@@ -91,12 +92,12 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
9192 gui::EndRender ();
9293 continue ;
9394 }
95+
9496 // 处理外挂业务逻辑: 获取相关数据的地址
9597 localPlayer.pawnAddress = mem.Read <uintptr_t >(client + offsets::client_dll::dwLocalPlayerPawn);
9698 localPlayer.origin = mem.Read <Vector3>(localPlayer.pawnAddress + schemas::client_dll::C_BasePlayerPawn::m_vOldOrigin);
9799 localPlayer.viewOffset = mem.Read <Vector3>(localPlayer.pawnAddress + schemas::client_dll::C_BaseModelEntity::m_vecViewOffset);
98100 localPlayer.team = mem.Read <int >(localPlayer.pawnAddress + schemas::client_dll::C_BaseEntity::m_iTeamNum);
99- localPlayer.entIndex = mem.Read <int >(localPlayer.pawnAddress + schemas::client_dll::C_CSPlayerPawnBase::m_iIDEntIndex);// 准星前的玩家id
100101 localPlayer.fFlag = mem.Read <unsigned int >(localPlayer.pawnAddress + schemas::client_dll::C_BaseEntity::m_fFlags);// 玩家的fFlag
101102 localPlayer.flashDuration = mem.Read <float >(localPlayer.pawnAddress + schemas::client_dll::C_CSPlayerPawnBase::m_flFlashBangTime);// 玩家遭受闪光的时间
102103 localPlayer.velocity = mem.Read <Vector3>(localPlayer.pawnAddress + schemas::client_dll::C_BaseEntity::m_vecAbsVelocity);// 玩家移动速度
@@ -110,11 +111,11 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
110111 if (!mem.InForeground ()) continue ;
111112
112113 // 根据entity_list获取第一个入口点
113- const auto list_entry = mem.Read <uintptr_t >(enity_list + (8 * (playerIndex & 0x7FFF ) >> 9 ) + 16 ); // 16==0x10
114+ const auto list_entry = mem.Read <uintptr_t >(enity_list + (0x8 * (playerIndex & 0x7FFF ) >> 9 ) + 0x10 );
114115 if (!list_entry) continue ;
115116
116117 // 获取currentController
117- const auto currentController = mem.Read <uintptr_t >(list_entry + 120 * (playerIndex & 0x1FF ));// 120==0x78
118+ const auto currentController = mem.Read <uintptr_t >(list_entry + 120 * (playerIndex & 0x1FF ));
118119 if (!currentController) continue ;
119120
120121 // 通过currentController获取pawnHandle
@@ -310,7 +311,7 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
310311 }
311312
312313 // 自瞄锁头并开枪
313- if (gui::enableAimbot && entities.size () > 0 ) // && !gui::enableRadar && entities[0].spotted
314+ if (gui::enableAimbot && entities.size () > 0 )
314315 {
315316 if (gui::enableTeamMode)
316317 {
@@ -321,6 +322,8 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
321322 std::stable_sort (entities.begin (), entities.end (), [](const Entity& entity1, const Entity& entity2) {
322323 return entity1.pixelDistance < entity2.pixelDistance ;
323324 });
325+
326+
324327 // 计算自瞄需要偏移的角度
325328 if (entities[0 ].pixelDistance < gui::fovAimbot)
326329 {
@@ -331,13 +334,30 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
331334 mem.Write <Vector3>(client + offsets::client_dll::dwViewAngles, newAnglesVec3);
332335 }
333336
334- // 开枪
337+ // 自动开枪 - 查找准星瞄准的敌人数据
338+ // 枪口准星前的玩家实体index
339+ localPlayer.entIndex = mem.Read <int >(localPlayer.pawnAddress + schemas::client_dll::C_CSPlayerPawnBase::m_iIDEntIndex);
335340 if (gui::enableAutoAttack && localPlayer.entIndex > 0 )
336341 {
337- mem.Write <int >(client + buttons::attack, PLUS_ATTACK);
338- std::this_thread::sleep_for (std::chrono::milliseconds (2 ));
339- mem.Write <int >(client + buttons::attack, MINUS_ATTACK);
340- std::this_thread::sleep_for (std::chrono::milliseconds (2 ));
342+ const auto list_entry = mem.Read <uintptr_t >(enity_list + 0x8 * (localPlayer.entIndex >> 9 ) + 0x10 );
343+ const auto entity = mem.Read <uintptr_t >(list_entry + 120 * (localPlayer.entIndex & 0x1FF ));
344+ const auto enemyTeam = mem.Read <int >(entity + schemas::client_dll::C_BaseEntity::m_iTeamNum);
345+ bool shouldShoot = false ;
346+ if (gui::enableTeamMode)
347+ {
348+ if ( enemyTeam != localPlayer.team )
349+ shouldShoot = true ;
350+ }
351+ else
352+ {
353+ shouldShoot = true ;
354+ }
355+ if (shouldShoot) {
356+ mem.Write <int >(client + buttons::attack, PLUS_ATTACK);
357+ std::this_thread::sleep_for (std::chrono::milliseconds (2 ));
358+ mem.Write <int >(client + buttons::attack, MINUS_ATTACK);
359+ std::this_thread::sleep_for (std::chrono::milliseconds (1 ));
360+ }
341361 }
342362 }
343363
@@ -361,7 +381,7 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
361381 }
362382
363383 // 跳越射击
364- if (localPlayer.fFlag == INAIR && GetAsyncKeyState (VK_SHIFT))
384+ /* if (localPlayer.fFlag == INAIR && GetAsyncKeyState(VK_SHIFT))
365385 {
366386 std::this_thread::sleep_for(std::chrono::milliseconds(3));
367387 velocity = mem.Read<Vector3>(localPlayer.pawnAddress + schemas::client_dll::C_BaseEntity::m_vecAbsVelocity);
@@ -371,7 +391,7 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
371391 mem.Write<int>(client + buttons::attack, PLUS_ATTACK);
372392 std::this_thread::sleep_for(std::chrono::milliseconds(1));
373393 mem.Write<int>(client + buttons::attack, MINUS_ATTACK);
374- }
394+ }*/
375395
376396 // fov视野角度(相机Service)
377397 auto desiredFov = static_cast <unsigned int >(gui::fov);
@@ -390,30 +410,25 @@ INT APIENTRY WinMain(HINSTANCE instance, HINSTANCE, PSTR, INT cmd_show)
390410 if (gui::enableRcs)
391411 {
392412 const auto shotsFired = mem.Read <int32_t >(localPlayer.pawnAddress + schemas::client_dll::C_CSPlayerPawn::m_iShotsFired);// 开枪次数
393- auto sensPointer = mem.Read <uintptr_t >(client + offsets::client_dll::dwSensitivity);
394- auto sensitivity = mem.Read <float >(sensPointer + offsets::client_dll::dwSensitivity_sensitivity);
395- auto aimPunchCache = mem.Read <C_UTL_VECTOR>(localPlayer.pawnAddress + schemas::client_dll::C_CSPlayerPawn::m_aimPunchCache);
396- if (aimPunchCache.data && aimPunchCache.count > 0 && aimPunchCache.count < 0xFFFF )
397- {
398- localPlayer.aimPunch = mem.Read <Vector3>(aimPunchCache.data + (aimPunchCache.count - 1 ) * sizeof (Vector3));
399- }
400- else
401- {
402- continue ;
403- }
413+ // 如果开枪了,就计算后座力补偿
404414 if (shotsFired > 1 )
405- {// 如果开枪了,就计算后座力补偿
415+ {
416+ float m_pitch = 0.022 ;
417+ float m_yaw = 0.022 ;
418+ auto aimPunch = mem.Read <Vector3>(localPlayer.pawnAddress + schemas::client_dll::C_CSPlayerPawn::m_aimPunchAngle);
406419 Vector3 viewAngles = mem.Read <Vector3>(client + offsets::client_dll::dwViewAngles);
407- Vector3 delta = viewAngles - (viewAngles + (oldPunch - (localPlayer.aimPunch * 2 .0f )));
420+ auto sensPointer = mem.Read <uintptr_t >(client + offsets::client_dll::dwSensitivity);
421+ auto sensitivity = mem.Read <float >(sensPointer + offsets::client_dll::dwSensitivity_sensitivity);
422+ newAngle.x = (aimPunch.y - oldAngle.y ) * 2 .f / (m_pitch * sensitivity) / 1 ;
423+ newAngle.y = -(aimPunch.x - oldAngle.x ) * 2 .f / (m_yaw * sensitivity) / 1 ;
424+
425+ mouse_event (MOUSEEVENTF_MOVE, -newAngle.x * -1 , newAngle.y , 0 , 0 );
408426
409- int mouse_angle_x = (int )(delta.x / (sensitivity*0 .022f ));
410- int mouse_angle_y = (int )(delta.y / (sensitivity*0 .022f ));
411- mouse_event (MOUSEEVENTF_MOVE, mouse_angle_x, -mouse_angle_y, 0 , 0 );
412- oldPunch = localPlayer.aimPunch * 2 .0f ;
427+ oldAngle = aimPunch;
413428 }
414429 else
415430 {
416- oldPunch .x = oldPunch .y = oldPunch .z = 0 .f ;
431+ oldAngle .x = oldAngle .y = oldAngle .z = 0 .f ;
417432 }
418433 }
419434
0 commit comments