shjit
This commit is contained in:
@@ -2,149 +2,138 @@
|
||||
#include <cstdint>
|
||||
#include "../../../templeware/utils/math/vector/vector.h"
|
||||
|
||||
#pragma pack(push, 1)
|
||||
// --- Протобуферные структуры для сабтиков (CS2) ---
|
||||
|
||||
struct CCmdQAnglePB {
|
||||
QAngle_t angValue;
|
||||
};
|
||||
|
||||
struct CCmdVectorPB {
|
||||
Vector4D_t vecValue;
|
||||
};
|
||||
|
||||
struct CBasePB_CS2 {
|
||||
void* vtable;
|
||||
uint32_t nHasBits;
|
||||
uint64_t nCachedBits;
|
||||
};
|
||||
|
||||
struct CInButtonStatePB_CS2 : CBasePB_CS2 {
|
||||
uint64_t nValue;
|
||||
uint64_t nValueChanged;
|
||||
uint64_t nValueScroll;
|
||||
};
|
||||
|
||||
struct CSubtickMoveStepPB_CS2 : CBasePB_CS2 {
|
||||
uint64_t nButton;
|
||||
bool bPressed;
|
||||
float flWhen;
|
||||
float flAnalogForwardDelta;
|
||||
float flAnalogLeftDelta;
|
||||
};
|
||||
|
||||
struct CCSGOInterpolationInfoPB_CS2 : CBasePB_CS2 {
|
||||
float flFraction;
|
||||
int nSrcTick;
|
||||
int nDstTick;
|
||||
};
|
||||
|
||||
struct CMsgQAnglePB_CS2 { QAngle_t angValue; };
|
||||
struct CMsgVectorPB_CS2 { Vector4D_t vecValue; };
|
||||
|
||||
struct CCSGOInputHistoryEntryPB_CS2 {
|
||||
CMsgQAnglePB_CS2* pViewAngles;
|
||||
CMsgVectorPB_CS2* pShootPosition;
|
||||
CMsgVectorPB_CS2* pTargetHeadPositionCheck;
|
||||
CMsgVectorPB_CS2* pTargetAbsPositionCheck;
|
||||
CMsgQAnglePB_CS2* pTargetAngPositionCheck;
|
||||
CCSGOInterpolationInfoPB_CS2* cl_interp;
|
||||
CCSGOInterpolationInfoPB_CS2* sv_interp0;
|
||||
CCSGOInterpolationInfoPB_CS2* sv_interp1;
|
||||
CCSGOInterpolationInfoPB_CS2* player_interp;
|
||||
int nRenderTickCount;
|
||||
float flRenderTickFraction;
|
||||
int nPlayerTickCount;
|
||||
float flPlayerTickFraction;
|
||||
int nFrameNumber;
|
||||
int nTargetEntIndex;
|
||||
};
|
||||
#define MEM_PAD(size) char _pad##__LINE__[size]
|
||||
|
||||
template <typename T>
|
||||
struct RepeatedPtrFieldPB_CS2 {
|
||||
struct RepeatedPtrField_t {
|
||||
struct Rep_t {
|
||||
int nAllocatedSize;
|
||||
T* tElements[128];
|
||||
T* tElements[(std::numeric_limits<int>::max() - 2 * sizeof(int)) / sizeof(void*)];
|
||||
};
|
||||
void* pArena; // 0x0 (8 байт)
|
||||
int nCurrentSize; // 0x8 (4 байта)
|
||||
int nTotalSize; // 0xC (4 байта)
|
||||
Rep_t* pRep; // 0x10 (8 байт)
|
||||
// 0x18
|
||||
void* pArena;
|
||||
int nCurrentSize;
|
||||
int nTotalSize;
|
||||
Rep_t* pRep;
|
||||
};
|
||||
static_assert(sizeof(RepeatedPtrFieldPB_CS2<int>) == 0x18, "RepeatedPtrFieldPB_CS2 size mismatch!");
|
||||
|
||||
struct CBaseUserCmdPB_CS2 {
|
||||
RepeatedPtrFieldPB_CS2<int> subtickMovesField; // 0x0 (0x18)
|
||||
void* strMoveCrc; // 0x18
|
||||
void* pInButtonState; // 0x20
|
||||
CMsgQAnglePB_CS2* pViewAngles; // 0x28
|
||||
int32_t nLegacyCommandNumber; // 0x30
|
||||
int32_t nClientTick; // 0x34
|
||||
float flForwardMove; // 0x38
|
||||
float flSideMove; // 0x3C
|
||||
float flUpMove; // 0x40
|
||||
int32_t nImpulse; // 0x44
|
||||
int32_t nWeaponSelect; // 0x48
|
||||
int32_t nRandomSeed; // 0x4C
|
||||
int32_t nMousedX; // 0x50
|
||||
int32_t nMousedY; // 0x54
|
||||
uint32_t nConsumedServerAngleChanges; // 0x58
|
||||
int32_t nCmdFlags; // 0x5C
|
||||
uint32_t nPawnEntityHandle; // 0x60
|
||||
char pad[0x80 - 0x64]; // паддинг до 0x80
|
||||
class CBasePB {
|
||||
public:
|
||||
MEM_PAD(0x8); // 0x0 VTABLE
|
||||
std::uint32_t nHasBits; // 0x8
|
||||
std::uint64_t nCachedBits; // 0xC
|
||||
void SetBits(std::uint64_t nBits) { nCachedBits |= nBits; }
|
||||
};
|
||||
static_assert(sizeof(CBaseUserCmdPB_CS2) == 0x80, "CBaseUserCmdPB_CS2 size mismatch!");
|
||||
static_assert(sizeof(CBasePB) == 0x18);
|
||||
|
||||
struct CCSGOUserCmdPB_CS2 {
|
||||
uint32_t nHasBits; // 0x0
|
||||
uint64_t nCachedSize; // 0x8
|
||||
RepeatedPtrFieldPB_CS2<CCSGOInputHistoryEntryPB_CS2> inputHistoryField; // 0x10 (0x18)
|
||||
CBaseUserCmdPB_CS2* pBaseCmd; // 0x28
|
||||
bool bLeftHandDesired; // 0x30
|
||||
char pad1[3]; // 0x31-0x33
|
||||
int32_t nAttack3StartHistoryIndex; // 0x34
|
||||
int32_t nAttack1StartHistoryIndex; // 0x38
|
||||
int32_t nAttack2StartHistoryIndex; // 0x3C
|
||||
char pad2[4]; // 0x40-0x43 (чтобы размер стал 0x40)
|
||||
class CMsgQAngle : public CBasePB {
|
||||
public:
|
||||
QAngle_t angValue; // 0x18
|
||||
};
|
||||
static_assert(sizeof(CCSGOUserCmdPB_CS2) == 0x40, "CCSGOUserCmdPB_CS2 size mismatch!");
|
||||
static_assert(sizeof(CMsgQAngle) == 0x28);
|
||||
|
||||
struct CInButtonState_CS2 {
|
||||
void* vtable; // 0x0
|
||||
uint64_t nValue; // 0x8
|
||||
uint64_t nValueChanged; // 0x10
|
||||
uint64_t nValueScroll; // 0x18
|
||||
class CMsgVector : public CBasePB {
|
||||
public:
|
||||
Vector_t vecValue; // 0x18
|
||||
};
|
||||
static_assert(sizeof(CInButtonState_CS2) == 0x20, "CInButtonState_CS2 size mismatch!");
|
||||
static_assert(sizeof(CMsgVector) == 0x28);
|
||||
|
||||
class CCSGOInterpolationInfoPB : public CBasePB {
|
||||
public:
|
||||
float flFraction; // 0x18
|
||||
int nSrcTick; // 0x1C
|
||||
int nDstTick; // 0x20
|
||||
};
|
||||
static_assert(sizeof(CCSGOInterpolationInfoPB) == 0x28);
|
||||
|
||||
class CCSGOInputHistoryEntryPB : public CBasePB {
|
||||
public:
|
||||
CMsgQAngle* pViewAngles; // 0x18
|
||||
CMsgVector* pShootPosition; // 0x20
|
||||
CMsgVector* pTargetHeadPositionCheck; // 0x28
|
||||
CMsgVector* pTargetAbsPositionCheck; // 0x30
|
||||
CMsgQAngle* pTargetAngPositionCheck; // 0x38
|
||||
CCSGOInterpolationInfoPB* cl_interp; // 0x40
|
||||
CCSGOInterpolationInfoPB* sv_interp0; // 0x48
|
||||
CCSGOInterpolationInfoPB* sv_interp1; // 0x50
|
||||
CCSGOInterpolationInfoPB* player_interp; // 0x58
|
||||
int nRenderTickCount; // 0x60
|
||||
float flRenderTickFraction; // 0x64
|
||||
int nPlayerTickCount; // 0x68
|
||||
float flPlayerTickFraction; // 0x6C
|
||||
int nFrameNumber; // 0x70
|
||||
int nTargetEntIndex; // 0x74
|
||||
};
|
||||
static_assert(sizeof(CCSGOInputHistoryEntryPB) == 0x78);
|
||||
|
||||
struct CInButtonState {
|
||||
MEM_PAD(0x8); // 0x0 VTABLE
|
||||
std::uint64_t nValue; // 0x8
|
||||
std::uint64_t nValueChanged; // 0x10
|
||||
std::uint64_t nValueScroll; // 0x18
|
||||
};
|
||||
static_assert(sizeof(CInButtonState) == 0x20);
|
||||
|
||||
class CBaseUserCmdPB : public CBasePB {
|
||||
public:
|
||||
RepeatedPtrField_t<void*> subtickMovesField;
|
||||
std::string* strMoveCrc;
|
||||
CInButtonState* pInButtonState; // 0x20
|
||||
CMsgQAngle* pViewAngles; // 0x28
|
||||
std::int32_t nLegacyCommandNumber;
|
||||
std::int32_t nClientTick;
|
||||
float flForwardMove;
|
||||
float flSideMove;
|
||||
float flUpMove;
|
||||
std::int32_t nImpulse;
|
||||
std::int32_t nWeaponSelect;
|
||||
std::int32_t nRandomSeed;
|
||||
std::int32_t nMousedX;
|
||||
std::int32_t nMousedY;
|
||||
std::uint32_t nConsumedServerAngleChanges;
|
||||
std::int32_t nCmdFlags;
|
||||
std::uint32_t nPawnEntityHandle;
|
||||
};
|
||||
static_assert(sizeof(CBaseUserCmdPB) == 0x80);
|
||||
|
||||
class CCSGOUserCmdPB {
|
||||
public:
|
||||
std::uint32_t nHasBits;
|
||||
std::uint64_t nCachedSize;
|
||||
RepeatedPtrField_t<CCSGOInputHistoryEntryPB> inputHistoryField;
|
||||
CBaseUserCmdPB* pBaseCmd;
|
||||
bool bLeftHandDesired;
|
||||
std::int32_t nAttack3StartHistoryIndex;
|
||||
std::int32_t nAttack1StartHistoryIndex;
|
||||
std::int32_t nAttack2StartHistoryIndex;
|
||||
void CheckAndSetBits(std::uint32_t nBits) {
|
||||
if (!(nHasBits & nBits))
|
||||
nHasBits |= nBits;
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(CCSGOUserCmdPB) == 0x40);
|
||||
|
||||
class CUserCmd {
|
||||
public:
|
||||
char pad_0x00[0x8]; // 0x0
|
||||
char pad_0x08[0x10]; // 0x8
|
||||
CCSGOUserCmdPB_CS2 csgoUserCmd; // 0x18
|
||||
CInButtonState_CS2 nButtons; // 0x58
|
||||
char pad_0x78[0x20]; // 0x78
|
||||
MEM_PAD(0x8); // 0x0 VTABLE
|
||||
MEM_PAD(0x10); // 0x8
|
||||
CCSGOUserCmdPB csgoUserCmd; // 0x18
|
||||
CInButtonState nButtons; // 0x58
|
||||
MEM_PAD(0x20); // 0x78
|
||||
|
||||
CCSGOInputHistoryEntryPB_CS2* GetInputHistoryEntry(int nIndex) {
|
||||
if (!csgoUserCmd.inputHistoryField.pRep) return nullptr;
|
||||
if (nIndex < 0 || nIndex >= csgoUserCmd.inputHistoryField.nCurrentSize) return nullptr;
|
||||
CCSGOInputHistoryEntryPB* GetInputHistoryEntry(int nIndex) {
|
||||
if (nIndex >= csgoUserCmd.inputHistoryField.pRep->nAllocatedSize || nIndex >= csgoUserCmd.inputHistoryField.nCurrentSize)
|
||||
return nullptr;
|
||||
return csgoUserCmd.inputHistoryField.pRep->tElements[nIndex];
|
||||
}
|
||||
|
||||
void SetSubTickAngle(const QAngle_t& angView) {
|
||||
if (!csgoUserCmd.inputHistoryField.pRep) return;
|
||||
for (int i = 0; i < csgoUserCmd.inputHistoryField.nCurrentSize; ++i) {
|
||||
CCSGOInputHistoryEntryPB_CS2* pInputEntry = GetInputHistoryEntry(i);
|
||||
if (!pInputEntry || !pInputEntry->pViewAngles) continue;
|
||||
for (int i = 0; i < this->csgoUserCmd.inputHistoryField.pRep->nAllocatedSize; i++) {
|
||||
CCSGOInputHistoryEntryPB* pInputEntry = this->GetInputHistoryEntry(i);
|
||||
if (!pInputEntry || !pInputEntry->pViewAngles)
|
||||
continue;
|
||||
pInputEntry->pViewAngles->angValue = angView;
|
||||
pInputEntry->SetBits(0x1U); // INPUT_HISTORY_BITS_VIEWANGLES
|
||||
}
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(CUserCmd) == 0x98, "CUserCmd size mismatch! Проверь паддинг и порядок полей.");
|
||||
|
||||
// static_assert(sizeof(CUserCmd) == 0x98, "CUserCmd size mismatch! Проверь паддинг и порядок полей.");
|
||||
|
||||
// Для overlay/hud:
|
||||
// extern size_t g_szCBaseUserCmdPB_CS2;
|
||||
// extern size_t g_szRepeatedPtrFieldPB_CS2;
|
||||
static_assert(sizeof(CUserCmd) == 0x98);
|
||||
@@ -398,328 +398,210 @@ void Aimbot() {
|
||||
}
|
||||
|
||||
void Ver2Aimbot(CUserCmd* pCmd) {
|
||||
// --- Silent Aim: чистая и безопасная реализация ---
|
||||
if (!Config::silent_aim || !pCmd) return;
|
||||
static C_CSPlayerPawn* lockedTarget = nullptr;
|
||||
static bool prevSilentState = false;
|
||||
static QAngle_t last_punch_angle = { 0,0,0 };
|
||||
static int shotCount = 0;
|
||||
static bool targetWasLost = false;
|
||||
static bool targetWasLockedThisPress = false;
|
||||
C_CSPlayerPawn* lp = H::oGetLocalPlayer(0);
|
||||
if (!lp || !lp->handle().valid() || lp->getHealth() <= 0) return;
|
||||
Vector_t lep = GetEntityEyePos(lp);
|
||||
// Получаем viewangles только из CUserCmd!
|
||||
QAngle_t* cur = nullptr;
|
||||
if (pCmd->csgoUserCmd.pBaseCmd && pCmd->csgoUserCmd.pBaseCmd->pViewAngles) {
|
||||
cur = &pCmd->csgoUserCmd.pBaseCmd->pViewAngles->angValue;
|
||||
}
|
||||
if (!cur) return;
|
||||
// --- Кнопка активации ---
|
||||
bool silentActive = Config::always_on_silent_aim ? true : (GetAsyncKeyState(Config::silent_aim_key) & 0x8000);
|
||||
if (Config::silent_shooterAfterAim && (GetAsyncKeyState(Config::triggerbot_key) & 0x8000)) {
|
||||
silentActive = true;
|
||||
}
|
||||
int shotsFired = lp ? lp->getShotsFired() : 0;
|
||||
shotCount = shotsFired;
|
||||
// --- Сброс флагов при новом нажатии ---
|
||||
if (silentActive && !prevSilentState) {
|
||||
targetWasLost = false;
|
||||
targetWasLockedThisPress = false;
|
||||
}
|
||||
// --- Поиск цели ---
|
||||
if (silentActive && !lockedTarget) {
|
||||
if (Config::silent_rage || (!targetWasLost && !targetWasLockedThisPress)) {
|
||||
int nMaxHighestEntity = I::GameEntity->Instance->GetHighestEntityIndex();
|
||||
float bestFov = Config::silent_aim_fov;
|
||||
C_CSPlayerPawn* bestTarget = nullptr;
|
||||
QAngle_t bestAngle = { 0, 0, 0 };
|
||||
for (int i = 1; i <= nMaxHighestEntity; i++) {
|
||||
auto Entity = I::GameEntity->Instance->Get(i);
|
||||
if (!Entity) continue;
|
||||
if (!Entity->handle().valid()) continue;
|
||||
SchemaClassInfoData_t* _class = nullptr;
|
||||
Entity->dump_class_info(&_class);
|
||||
if (!_class) continue;
|
||||
const uint32_t hash = HASH(_class->szName);
|
||||
if (hash == HASH("C_CSPlayerPawn")) {
|
||||
C_CSPlayerPawn* pawn = (C_CSPlayerPawn*)Entity;
|
||||
if (!pawn) continue;
|
||||
if (pawn->get_entity_by_handle() == lp->get_entity_by_handle()) continue;
|
||||
if (pawn->getHealth() <= 0) continue;
|
||||
if (Config::team_check && pawn->getTeam() == lp->getTeam()) continue;
|
||||
// --- Выбор кости для silent aim ---
|
||||
Vector_t target_pos;
|
||||
switch (Config::silent_aim_bone) {
|
||||
case Config::BONE_HEAD:
|
||||
target_pos = GetBonePosition(pawn, BONE_INDEX_HEAD); break;
|
||||
case Config::BONE_NECK:
|
||||
target_pos = GetBonePosition(pawn, BONE_INDEX_NECK); break;
|
||||
case Config::BONE_BODY:
|
||||
target_pos = GetBonePosition(pawn, BONE_INDEX_BODY); break;
|
||||
case Config::BONE_NEAREST:
|
||||
default:
|
||||
target_pos = GetAimbotTargetPos(pawn, lep, *cur); break;
|
||||
}
|
||||
QAngle_t angle = CalcAngles(target_pos, lep);
|
||||
angle.x *= -1.f;
|
||||
angle.y += 180.f;
|
||||
float fov = GetFov(*cur, angle);
|
||||
if (!std::isfinite(fov) || fov > bestFov) continue;
|
||||
bestFov = fov;
|
||||
bestTarget = pawn;
|
||||
bestAngle = angle;
|
||||
}
|
||||
}
|
||||
lockedTarget = bestTarget;
|
||||
last_punch_angle = { 0,0,0 };
|
||||
if (!Config::silent_rage && lockedTarget) targetWasLockedThisPress = true;
|
||||
if (!Config::silent_rage && !lockedTarget) targetWasLost = true;
|
||||
}
|
||||
}
|
||||
// --- Сброс при отпускании кнопки ---
|
||||
if (!silentActive) {
|
||||
lockedTarget = nullptr;
|
||||
last_punch_angle = { 0,0,0 };
|
||||
targetWasLost = false;
|
||||
targetWasLockedThisPress = false;
|
||||
}
|
||||
// --- Наведение на цель ---
|
||||
if (silentActive && lockedTarget) {
|
||||
// Проверка валидности цели
|
||||
if (!lp || !lp->handle().valid() || lp->getHealth() <= 0 ||
|
||||
lockedTarget->get_entity_by_handle() == lp->get_entity_by_handle() ||
|
||||
lockedTarget->getHealth() <= 0 ||
|
||||
!lockedTarget->handle().valid() ||
|
||||
(Config::team_check && lockedTarget->getTeam() == lp->getTeam())) {
|
||||
lockedTarget = nullptr;
|
||||
last_punch_angle = { 0,0,0 };
|
||||
targetWasLost = true;
|
||||
prevSilentState = silentActive;
|
||||
return;
|
||||
}
|
||||
// --- Выбор кости для silent aim ---
|
||||
Vector_t target_pos;
|
||||
switch (Config::silent_aim_bone) {
|
||||
case Config::BONE_HEAD:
|
||||
target_pos = GetBonePosition(lockedTarget, BONE_INDEX_HEAD); break;
|
||||
case Config::BONE_NECK:
|
||||
target_pos = GetBonePosition(lockedTarget, BONE_INDEX_NECK); break;
|
||||
case Config::BONE_BODY:
|
||||
target_pos = GetBonePosition(lockedTarget, BONE_INDEX_BODY); break;
|
||||
case Config::BONE_NEAREST:
|
||||
default:
|
||||
target_pos = GetAimbotTargetPos(lockedTarget, lep, *cur); break;
|
||||
}
|
||||
QAngle_t angle = CalcAngles(target_pos, lep);
|
||||
angle.x *= -1.f;
|
||||
angle.y += 180.f;
|
||||
// --- Smooth ---
|
||||
if (Config::silent_aim_smooth > 0.f) {
|
||||
QAngle_t delta = (angle - *cur).Normalize();
|
||||
float smooth = Config::silent_aim_smooth;
|
||||
angle = *cur + delta * (1.f / smooth);
|
||||
angle = angle.Normalize();
|
||||
}
|
||||
*cur = angle;
|
||||
}
|
||||
prevSilentState = silentActive;
|
||||
//// --- Silent Aim: чистая и безопасная реализация ---
|
||||
//if (!Config::silent_aim || !pCmd) return;
|
||||
//static C_CSPlayerPawn* lockedTarget = nullptr;
|
||||
//static bool prevSilentState = false;
|
||||
//static QAngle_t last_punch_angle = { 0,0,0 };
|
||||
//static int shotCount = 0;
|
||||
//static bool targetWasLost = false;
|
||||
//static bool targetWasLockedThisPress = false;
|
||||
//C_CSPlayerPawn* lp = H::oGetLocalPlayer(0);
|
||||
//if (!lp || !lp->handle().valid() || lp->getHealth() <= 0) return;
|
||||
//Vector_t lep = GetEntityEyePos(lp);
|
||||
//// Получаем viewangles только из CUserCmd!
|
||||
//QAngle_t* cur = nullptr;
|
||||
//if (pCmd->csgoUserCmd.pBaseCmd && pCmd->csgoUserCmd.pBaseCmd->pViewAngles) {
|
||||
// cur = &pCmd->csgoUserCmd.pBaseCmd->pViewAngles->angValue;
|
||||
//}
|
||||
//if (!cur) return;
|
||||
//// --- Кнопка активации ---
|
||||
//bool silentActive = Config::always_on_silent_aim ? true : (GetAsyncKeyState(Config::silent_aim_key) & 0x8000);
|
||||
//if (Config::silent_shooterAfterAim && (GetAsyncKeyState(Config::triggerbot_key) & 0x8000)) {
|
||||
// silentActive = true;
|
||||
//}
|
||||
//int shotsFired = lp ? lp->getShotsFired() : 0;
|
||||
//shotCount = shotsFired;
|
||||
//// --- Сброс флагов при новом нажатии ---
|
||||
//if (silentActive && !prevSilentState) {
|
||||
// targetWasLost = false;
|
||||
// targetWasLockedThisPress = false;
|
||||
//}
|
||||
//// --- Поиск цели ---
|
||||
//if (silentActive && !lockedTarget) {
|
||||
// if (Config::silent_rage || (!targetWasLost && !targetWasLockedThisPress)) {
|
||||
// int nMaxHighestEntity = I::GameEntity->Instance->GetHighestEntityIndex();
|
||||
// float bestFov = Config::silent_aim_fov;
|
||||
// C_CSPlayerPawn* bestTarget = nullptr;
|
||||
// QAngle_t bestAngle = { 0, 0, 0 };
|
||||
// for (int i = 1; i <= nMaxHighestEntity; i++) {
|
||||
// auto Entity = I::GameEntity->Instance->Get(i);
|
||||
// if (!Entity) continue;
|
||||
// if (!Entity->handle().valid()) continue;
|
||||
// SchemaClassInfoData_t* _class = nullptr;
|
||||
// Entity->dump_class_info(&_class);
|
||||
// if (!_class) continue;
|
||||
// const uint32_t hash = HASH(_class->szName);
|
||||
// if (hash == HASH("C_CSPlayerPawn")) {
|
||||
// C_CSPlayerPawn* pawn = (C_CSPlayerPawn*)Entity;
|
||||
// if (!pawn) continue;
|
||||
// if (pawn->get_entity_by_handle() == lp->get_entity_by_handle()) continue;
|
||||
// if (pawn->getHealth() <= 0) continue;
|
||||
// if (Config::team_check && pawn->getTeam() == lp->getTeam()) continue;
|
||||
// // --- Выбор кости для silent aim ---
|
||||
// Vector_t target_pos;
|
||||
// switch (Config::silent_aim_bone) {
|
||||
// case Config::BONE_HEAD:
|
||||
// target_pos = GetBonePosition(pawn, BONE_INDEX_HEAD); break;
|
||||
// case Config::BONE_NECK:
|
||||
// target_pos = GetBonePosition(pawn, BONE_INDEX_NECK); break;
|
||||
// case Config::BONE_BODY:
|
||||
// target_pos = GetBonePosition(pawn, BONE_INDEX_BODY); break;
|
||||
// case Config::BONE_NEAREST:
|
||||
// default:
|
||||
// target_pos = GetAimbotTargetPos(pawn, lep, *cur); break;
|
||||
// }
|
||||
// QAngle_t angle = CalcAngles(target_pos, lep);
|
||||
// angle.x *= -1.f;
|
||||
// angle.y += 180.f;
|
||||
// float fov = GetFov(*cur, angle);
|
||||
// if (!std::isfinite(fov) || fov > bestFov) continue;
|
||||
// bestFov = fov;
|
||||
// bestTarget = pawn;
|
||||
// bestAngle = angle;
|
||||
// }
|
||||
// }
|
||||
// lockedTarget = bestTarget;
|
||||
// last_punch_angle = { 0,0,0 };
|
||||
// if (!Config::silent_rage && lockedTarget) targetWasLockedThisPress = true;
|
||||
// if (!Config::silent_rage && !lockedTarget) targetWasLost = true;
|
||||
// }
|
||||
//}
|
||||
//// --- Сброс при отпускании кнопки ---
|
||||
//if (!silentActive) {
|
||||
// lockedTarget = nullptr;
|
||||
// last_punch_angle = { 0,0,0 };
|
||||
// targetWasLost = false;
|
||||
// targetWasLockedThisPress = false;
|
||||
//}
|
||||
//// --- Наведение на цель ---
|
||||
//if (silentActive && lockedTarget) {
|
||||
// // Проверка валидности цели
|
||||
// if (!lp || !lp->handle().valid() || lp->getHealth() <= 0 ||
|
||||
// lockedTarget->get_entity_by_handle() == lp->get_entity_by_handle() ||
|
||||
// lockedTarget->getHealth() <= 0 ||
|
||||
// !lockedTarget->handle().valid() ||
|
||||
// (Config::team_check && lockedTarget->getTeam() == lp->getTeam())) {
|
||||
// lockedTarget = nullptr;
|
||||
// last_punch_angle = { 0,0,0 };
|
||||
// targetWasLost = true;
|
||||
// prevSilentState = silentActive;
|
||||
// return;
|
||||
// }
|
||||
// // --- Выбор кости для silent aim ---
|
||||
// Vector_t target_pos;
|
||||
// switch (Config::silent_aim_bone) {
|
||||
// case Config::BONE_HEAD:
|
||||
// target_pos = GetBonePosition(lockedTarget, BONE_INDEX_HEAD); break;
|
||||
// case Config::BONE_NECK:
|
||||
// target_pos = GetBonePosition(lockedTarget, BONE_INDEX_NECK); break;
|
||||
// case Config::BONE_BODY:
|
||||
// target_pos = GetBonePosition(lockedTarget, BONE_INDEX_BODY); break;
|
||||
// case Config::BONE_NEAREST:
|
||||
// default:
|
||||
// target_pos = GetAimbotTargetPos(lockedTarget, lep, *cur); break;
|
||||
// }
|
||||
// QAngle_t angle = CalcAngles(target_pos, lep);
|
||||
// angle.x *= -1.f;
|
||||
// angle.y += 180.f;
|
||||
// // --- Smooth ---
|
||||
// if (Config::silent_aim_smooth > 0.f) {
|
||||
// QAngle_t delta = (angle - *cur).Normalize();
|
||||
// float smooth = Config::silent_aim_smooth;
|
||||
// angle = *cur + delta * (1.f / smooth);
|
||||
// angle = angle.Normalize();
|
||||
// }
|
||||
// *cur = angle;
|
||||
//}
|
||||
//prevSilentState = silentActive;
|
||||
}
|
||||
|
||||
// --- Функция для вывода отладочной информации через ImGui ---
|
||||
void ShowSilentAimDebugInfo(const CUserCmd* pCmd) {
|
||||
char debugBuf[256];
|
||||
_snprintf_s(debugBuf, sizeof(debugBuf),
|
||||
"CUserCmd: size=%zu, csgoUserCmd@%zu, nButtons@%zu, nSubticks=%d, pRep=%p, pBaseCmd=%p",
|
||||
"CUserCmd: size=%zu, m_csgoUserCmd@%zu, m_nButtons@%zu, nSubticks=%d, pRep=%p, pBaseCmd=%p",
|
||||
sizeof(CUserCmd),
|
||||
offsetof(CUserCmd, csgoUserCmd),
|
||||
offsetof(CUserCmd, nButtons),
|
||||
pCmd->csgoUserCmd.inputHistoryField.nCurrentSize,
|
||||
(void*)pCmd->csgoUserCmd.inputHistoryField.pRep,
|
||||
(void*)pCmd->csgoUserCmd.pBaseCmd);
|
||||
offsetof(CUserCmd, m_csgoUserCmd),
|
||||
offsetof(CUserCmd, m_nButtons),
|
||||
pCmd->m_csgoUserCmd.m_inputHistoryField.m_pRep ? pCmd->m_csgoUserCmd.m_inputHistoryField.m_pRep->m_nAllocatedSize : 0,
|
||||
(void*)pCmd->m_csgoUserCmd.m_inputHistoryField.m_pRep,
|
||||
(void*)pCmd->m_csgoUserCmd.m_pBaseCmd);
|
||||
g_DebugString = debugBuf;
|
||||
// ImGui::SetTooltip("%s", debugBuf); // Можно включить при необходимости
|
||||
}
|
||||
|
||||
void SilentAimbot(CUserCmd* pCmd) {
|
||||
static bool printed = false;
|
||||
if (!printed) {
|
||||
std::cout << "RepeatedPtrFieldPB_CS2=" << sizeof(RepeatedPtrFieldPB_CS2<int>)
|
||||
<< ", CBaseUserCmdPB_CS2=" << sizeof(CBaseUserCmdPB_CS2)
|
||||
<< ", CCSGOUserCmdPB_CS2=" << sizeof(CCSGOUserCmdPB_CS2)
|
||||
<< ", CUserCmd=" << sizeof(CUserCmd)
|
||||
<< ", csgoUserCmd@0x" << std::hex << offsetof(CUserCmd, csgoUserCmd)
|
||||
<< ", nButtons@0x" << std::hex << offsetof(CUserCmd, nButtons)
|
||||
<< std::dec << std::endl;
|
||||
printed = true;
|
||||
if (!Config::silent_aim || !pCmd)
|
||||
return;
|
||||
|
||||
C_CSPlayerPawn* lp = H::oGetLocalPlayer(0);
|
||||
if (!lp || !lp->handle().valid() || lp->getHealth() <= 0)
|
||||
return;
|
||||
|
||||
// Кнопка активации
|
||||
bool silentActive = Config::always_on_silent_aim ? true : (GetAsyncKeyState(Config::silent_aim_key) & 0x8000);
|
||||
if (Config::silent_shooterAfterAim && (GetAsyncKeyState(Config::triggerbot_key) & 0x8000)) {
|
||||
silentActive = true;
|
||||
}
|
||||
char debugBuf[256];
|
||||
if (!Config::silent_aim || !pCmd) return;
|
||||
static C_CSPlayerPawn* lockedTarget = nullptr;
|
||||
static bool prevSilentState = false;
|
||||
static QAngle_t last_punch_angle = { 0,0,0 };
|
||||
static int shotCount = 0;
|
||||
static bool targetWasLost = false;
|
||||
static bool targetWasLockedThisPress = false;
|
||||
C_CSPlayerPawn* lp = H::oGetLocalPlayer(0);
|
||||
if (!lp || !lp->handle().valid() || lp->getHealth() <= 0) return;
|
||||
Vector_t lep = GetEntityEyePos(lp);
|
||||
// --- Кнопка активации ---
|
||||
bool silentActive = Config::always_on_silent_aim ? true : (GetAsyncKeyState(Config::silent_aim_key) & 0x8000);
|
||||
if (Config::silent_shooterAfterAim && (GetAsyncKeyState(Config::triggerbot_key) & 0x8000)) {
|
||||
silentActive = true;
|
||||
}
|
||||
int shotsFired = lp ? lp->getShotsFired() : 0;
|
||||
shotCount = shotsFired;
|
||||
if (!silentActive)
|
||||
return;
|
||||
|
||||
if (silentActive && !prevSilentState) {
|
||||
targetWasLost = false;
|
||||
targetWasLockedThisPress = false;
|
||||
}
|
||||
if (silentActive && !lockedTarget) {
|
||||
if (Config::silent_rage || (!targetWasLost && !targetWasLockedThisPress)) {
|
||||
int nMaxHighestEntity = I::GameEntity->Instance->GetHighestEntityIndex();
|
||||
float bestFov = Config::silent_aim_fov;
|
||||
C_CSPlayerPawn* bestTarget = nullptr;
|
||||
QAngle_t bestAngle{};
|
||||
for (int i = 1; i <= nMaxHighestEntity; i++) {
|
||||
auto Entity = I::GameEntity->Instance->Get(i);
|
||||
if (!Entity) continue;
|
||||
if (!Entity->handle().valid()) continue;
|
||||
SchemaClassInfoData_t* _class = nullptr;
|
||||
Entity->dump_class_info(&_class);
|
||||
if (!_class) continue;
|
||||
const uint32_t hash = HASH(_class->szName);
|
||||
if (hash == HASH("C_CSPlayerPawn")) {
|
||||
C_CSPlayerPawn* pawn = (C_CSPlayerPawn*)Entity;
|
||||
if (!pawn) continue;
|
||||
if (pawn->get_entity_by_handle() == lp->get_entity_by_handle()) continue;
|
||||
if (pawn->getHealth() <= 0) continue;
|
||||
if (Config::team_check && pawn->getTeam() == lp->getTeam()) continue;
|
||||
Vector_t target_pos;
|
||||
switch (Config::silent_aim_bone) {
|
||||
case Config::BONE_HEAD:
|
||||
target_pos = GetBonePosition(pawn, BONE_INDEX_HEAD); break;
|
||||
case Config::BONE_NECK:
|
||||
target_pos = GetBonePosition(pawn, BONE_INDEX_NECK); break;
|
||||
case Config::BONE_BODY:
|
||||
target_pos = GetBonePosition(pawn, BONE_INDEX_BODY); break;
|
||||
case Config::BONE_NEAREST:
|
||||
default:
|
||||
target_pos = GetAimbotTargetPos(pawn, lep, QAngle_t{}); break;
|
||||
}
|
||||
QAngle_t angle = CalcAngles(target_pos, lep);
|
||||
angle.x *= -1.f;
|
||||
angle.y += 180.f;
|
||||
float fov = sqrtf(angle.x * angle.x + angle.y * angle.y);
|
||||
if (!std::isfinite(fov) || fov > bestFov) continue;
|
||||
bestFov = fov;
|
||||
bestTarget = pawn;
|
||||
bestAngle = angle;
|
||||
}
|
||||
}
|
||||
lockedTarget = bestTarget;
|
||||
last_punch_angle = { 0,0,0 };
|
||||
if (!Config::silent_rage && lockedTarget) targetWasLockedThisPress = true;
|
||||
if (!Config::silent_rage && !lockedTarget) targetWasLost = true;
|
||||
}
|
||||
}
|
||||
if (!silentActive) {
|
||||
lockedTarget = nullptr;
|
||||
last_punch_angle = { 0,0,0 };
|
||||
targetWasLost = false;
|
||||
targetWasLockedThisPress = false;
|
||||
}
|
||||
if (silentActive && lockedTarget) {
|
||||
if (!lp || !lp->handle().valid() || lp->getHealth() <= 0 ||
|
||||
lockedTarget->get_entity_by_handle() == lp->get_entity_by_handle() ||
|
||||
lockedTarget->getHealth() <= 0 ||
|
||||
!lockedTarget->handle().valid() ||
|
||||
(Config::team_check && lockedTarget->getTeam() == lp->getTeam())) {
|
||||
lockedTarget = nullptr;
|
||||
last_punch_angle = { 0,0,0 };
|
||||
targetWasLost = true;
|
||||
prevSilentState = silentActive;
|
||||
return;
|
||||
}
|
||||
Vector_t target_pos;
|
||||
switch (Config::silent_aim_bone) {
|
||||
case Config::BONE_HEAD:
|
||||
target_pos = GetBonePosition(lockedTarget, BONE_INDEX_HEAD); break;
|
||||
case Config::BONE_NECK:
|
||||
target_pos = GetBonePosition(lockedTarget, BONE_INDEX_NECK); break;
|
||||
case Config::BONE_BODY:
|
||||
target_pos = GetBonePosition(lockedTarget, BONE_INDEX_BODY); break;
|
||||
case Config::BONE_NEAREST:
|
||||
default:
|
||||
target_pos = GetAimbotTargetPos(lockedTarget, lep, QAngle_t{}); break;
|
||||
}
|
||||
QAngle_t angle = CalcAngles(target_pos, lep);
|
||||
angle.x *= -1.f;
|
||||
angle.y += 180.f;
|
||||
// --- Smooth ---
|
||||
if (Config::silent_aim_smooth > 0.f) {
|
||||
QAngle_t cur = angle;
|
||||
bool found = false;
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
CCSGOInputHistoryEntryPB_CS2* entry = pCmd->GetInputHistoryEntry(i);
|
||||
if (entry && entry->pViewAngles) {
|
||||
cur = entry->pViewAngles->angValue;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
QAngle_t delta = (angle - cur).Normalize();
|
||||
float smooth = Config::silent_aim_smooth;
|
||||
angle = cur + delta * (1.f / smooth);
|
||||
angle = angle.Normalize();
|
||||
}
|
||||
// --- Устанавливаем угол для всех сабтиков ---
|
||||
int nSubticks = pCmd->csgoUserCmd.inputHistoryField.nCurrentSize;
|
||||
_snprintf_s(debugBuf, sizeof(debugBuf), "nSubticks=%d, pRep=%p", nSubticks, (void*)pCmd->csgoUserCmd.inputHistoryField.pRep);
|
||||
// g_DebugString = debugBuf; // Удалено
|
||||
Vector_t localEye = GetEntityEyePos(lp);
|
||||
// --- Исправленный доступ к углам ---
|
||||
QAngle_t* curAngles = nullptr;
|
||||
if (pCmd && pCmd->csgoUserCmd.pBaseCmd && pCmd->csgoUserCmd.pBaseCmd->pViewAngles)
|
||||
curAngles = &pCmd->csgoUserCmd.pBaseCmd->pViewAngles->angValue;
|
||||
if (!curAngles)
|
||||
return;
|
||||
|
||||
// --- Расширенный отладочный вывод ---
|
||||
// char debugBuf[256]; // Удалено
|
||||
// _snprintf_s(debugBuf, sizeof(debugBuf), // Удалено
|
||||
// "CUserCmd: size=%zu, csgoUserCmd@%zu, nButtons@%zu, nSubticks=%d, pRep=%p, pBaseCmd=%p", // Удалено
|
||||
// sizeof(CUserCmd), // Удалено
|
||||
// offsetof(CUserCmd, csgoUserCmd), // Удалено
|
||||
// offsetof(CUserCmd, nButtons), // Удалено
|
||||
// pCmd->csgoUserCmd.inputHistoryField.nCurrentSize, // Удалено
|
||||
// (void*)pCmd->csgoUserCmd.inputHistoryField.pRep, // Удалено
|
||||
// (void*)pCmd->csgoUserCmd.pBaseCmd); // Удалено
|
||||
// g_DebugString = debugBuf; // Удалено
|
||||
// Поиск цели
|
||||
float bestFov = Config::silent_aim_fov;
|
||||
C_CSPlayerPawn* bestTarget = nullptr;
|
||||
Vector_t bestTargetPos{};
|
||||
for (int i = 1; i <= I::GameEntity->Instance->GetHighestEntityIndex(); ++i) {
|
||||
auto Entity = I::GameEntity->Instance->Get(i);
|
||||
if (!Entity || !Entity->handle().valid())
|
||||
continue;
|
||||
SchemaClassInfoData_t* _class = nullptr;
|
||||
Entity->dump_class_info(&_class);
|
||||
if (!_class || HASH(_class->szName) != HASH("C_CSPlayerPawn"))
|
||||
continue;
|
||||
C_CSPlayerPawn* pawn = (C_CSPlayerPawn*)Entity;
|
||||
if (!pawn || pawn->get_entity_by_handle() == lp->get_entity_by_handle() || pawn->getHealth() <= 0)
|
||||
continue;
|
||||
if (Config::team_check && pawn->getTeam() == lp->getTeam())
|
||||
continue;
|
||||
Vector_t targetPos = GetBonePosition(pawn, Config::silent_aim_bone == Config::BONE_HEAD ? BONE_INDEX_HEAD :
|
||||
Config::silent_aim_bone == Config::BONE_NECK ? BONE_INDEX_NECK :
|
||||
Config::silent_aim_bone == Config::BONE_BODY ? BONE_INDEX_BODY :
|
||||
BONE_INDEX_HEAD);
|
||||
QAngle_t angle = CalcAngles(targetPos, localEye);
|
||||
angle.x *= -1.f;
|
||||
angle.y += 180.f;
|
||||
float fov = GetFov(*curAngles, angle);
|
||||
if (!std::isfinite(fov) || fov > bestFov)
|
||||
continue;
|
||||
bestFov = fov;
|
||||
bestTarget = pawn;
|
||||
bestTargetPos = targetPos;
|
||||
}
|
||||
if (!bestTarget)
|
||||
return;
|
||||
|
||||
ShowSilentAimDebugInfo(pCmd);
|
||||
QAngle_t aimAngle = CalcAngles(bestTargetPos, localEye);
|
||||
aimAngle.x *= -1.f;
|
||||
aimAngle.y += 180.f;
|
||||
|
||||
_snprintf_s(debugBuf, sizeof(debugBuf),
|
||||
"sizeof(CUserCmd)=%zu, csgoUserCmd@0x%zX, nButtons@0x%zX",
|
||||
sizeof(CUserCmd),
|
||||
offsetof(CUserCmd, csgoUserCmd),
|
||||
offsetof(CUserCmd, nButtons));
|
||||
g_DebugString = debugBuf;
|
||||
|
||||
_snprintf_s(debugBuf, sizeof(debugBuf),
|
||||
"sizeof(CUserCmd)=%zu, csgoUserCmd@0x%zX, nButtons@0x%zX, RepeatedPtrFieldPB_CS2=%zu, CBaseUserCmdPB_CS2=%zu",
|
||||
sizeof(CUserCmd),
|
||||
offsetof(CUserCmd, csgoUserCmd),
|
||||
offsetof(CUserCmd, nButtons),
|
||||
sizeof(RepeatedPtrFieldPB_CS2<int>),
|
||||
sizeof(CBaseUserCmdPB_CS2));
|
||||
g_DebugString = debugBuf;
|
||||
|
||||
_snprintf_s(debugBuf, sizeof(debugBuf),
|
||||
"RepeatedPtrFieldPB_CS2=%zu, CBaseUserCmdPB_CS2=%zu, CCSGOUserCmdPB_CS2=%zu, CUserCmd=%zu, csgoUserCmd@0x%zX, nButtons@0x%zX",
|
||||
sizeof(RepeatedPtrFieldPB_CS2<int>),
|
||||
sizeof(CBaseUserCmdPB_CS2),
|
||||
sizeof(CCSGOUserCmdPB_CS2),
|
||||
sizeof(CUserCmd),
|
||||
offsetof(CUserCmd, csgoUserCmd),
|
||||
offsetof(CUserCmd, nButtons));
|
||||
g_DebugString = debugBuf;
|
||||
|
||||
|
||||
}
|
||||
prevSilentState = silentActive;
|
||||
// Установить угол для всех сабтиков
|
||||
pCmd->SetSubTickAngle(aimAngle);
|
||||
}
|
||||
|
||||
@@ -38,12 +38,13 @@ void* __fastcall H::hkLevelInit(void* pClientModeShared, const char* szNewMap) {
|
||||
return LevelInit.GetOriginal()(pClientModeShared, szNewMap);
|
||||
}
|
||||
|
||||
bool __fastcall H::hkCreateMove(void* pInput, int nSlot, void* pCmd) {
|
||||
//Aimbot();
|
||||
//SilentAimbot(reinterpret_cast<CUserCmd*>(pCmd));
|
||||
Ver2Aimbot(reinterpret_cast<CUserCmd*>(pCmd));
|
||||
bool __fastcall H::hkCreateMove(void* pInput, int nSlot, CUserCmd* pCmd) {
|
||||
SilentAimbot(pCmd);
|
||||
//Ver2Aimbot(pCmd);
|
||||
Triggerbot();
|
||||
return CreateMove.GetOriginal()(pInput, nSlot, pCmd);
|
||||
|
||||
return CreateMove.GetOriginal()(pInput, nSlot, pCmd);
|
||||
// return CreateMove.GetOriginal()(pInput, edx, nSlot, pCmd);
|
||||
}
|
||||
|
||||
void H::Hooks::init() {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "../features/aim/CUserCmd.h"
|
||||
#include "includeHooks.h"
|
||||
#include "../../cs2/entity/C_AggregateSceneObject/C_AggregateSceneObject.h"
|
||||
#include "../../cs2/entity/C_CSPlayerPawn/C_CSPlayerPawn.h"
|
||||
@@ -16,7 +17,8 @@ namespace H {
|
||||
void* __fastcall hkLevelInit(void* pClientModeShared, const char* szNewMap);
|
||||
void __fastcall hkChamsObject(void* pAnimatableSceneObjectDesc, void* pDx11, CMeshData* arrMeshDraw, int nDataCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2);
|
||||
void __fastcall hkRenderFlashbangOverlay(void* a1, void* a2, void* a3, void* a4, void* a5);
|
||||
bool __fastcall hkCreateMove(void* pInput, int nSlot, void* pCmd);
|
||||
// bool __fastcall hkCreateMove(void* pInput, void* edx, int nSlot, CUserCmd* pCmd);
|
||||
bool __fastcall hkCreateMove(void* pInput, int nSlot, CUserCmd* pCmd);
|
||||
inline float g_flActiveFov;
|
||||
float hkGetRenderFov(void* rcx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user