- 5
- 1
Привет столкнулся с проблемой аим бот не работает
Дело в класах
Гляньте что не так
Дело в класах
Гляньте что не так
Код:
class CTable
{
public:
void Init()
{
__int16 SizeTable = GetCount();
PDWORD64 Table = new DWORD64[SizeTable + 2];
Table[0] = (DWORD64)this;
Table[1] = (DWORD64)&g_pCTable[0];
memcpy(&Table[2], (void*)g_pCTable, sizeof(DWORD64) * SizeTable);
g_pCTable = (PDWORD64)&Table[2];
}
template <typename T>
__inline T GetOrigFunction(int Index)
{
return (T)((PDWORD64)g_pCTable[-1])[Index];
}
template <typename T>
__inline T Hooking(int Index, T nFunction)
{
T orig = (T)g_pCTable[Index];
g_pCTable[Index] = (DWORD64)nFunction;
return orig;
}
private:
__inline __int16 GetCount()
{
__int16 Size = 0;
while (g_pCTable[Size] != 0) ++Size;
return Size;
}
private:
PDWORD64 g_pCTable;
};
struct СSkeletonPose
{
public:
QuatT& GetAbsJointByID(int nJointID) { return CallFunction<QuatT& (__thiscall*)(PVOID, int)>(this, 0x38)(this, nJointID); }
int16 GetJointIdByName(const char* sz_joint_name) { return CallFunction<int16(__fastcall*)(PVOID64, const char*)>(this, 0x18)(this, sz_joint_name); }
const char* GetszNameByJointId(int16 sz_joint_name) { return CallFunction<const char* (__fastcall*)(PVOID64, int16)>(this, 0x38)(this, sz_joint_name); }
};
struct СCharacterInstance
{
public:
СSkeletonPose* GetISkeletonPose() { return CallFunction<СSkeletonPose* (__thiscall*)(PVOID)>(this, 0x28)(this); }
};
class CPhysicalEntity
{
public:
void* GetForeignData(int itype = 0) { return CallFunction<void* (__thiscall*)(PVOID, int)>(this, 0x68)(this, itype); }
};
struct CRayHit
{
float dist;
CPhysicalEntity* pCollider;
int ipart;
int partid;
short surface_idx;
short idmatOrg;
int foreignIdx;
int iNode;
Vec3 pt;
Vec3 n;
int bTerrain;
int iPrim;
CRayHit* next;
};
struct CRayHitCached
{
CPhysicalEntity* pCollider;
int ipart;
int iNode;
CRayHitCached() { pCollider = 0; ipart = 0; }
CRayHitCached(const CRayHit& hit) { pCollider = hit.pCollider; ipart = hit.ipart; iNode = hit.iNode; }
CRayHitCached& operator=(const CRayHit& hit) { pCollider = hit.pCollider; ipart = hit.ipart; iNode = hit.iNode; return *this; }
};
struct SSharedGameHitInfo
{
/*EntityId shooterId;//0x00
EntityId targetId;//0x04
int material;//0x08
int typeId;//0x0C
int bulletType;//0x10
int partId;//0x14
Vec3 pos;//0x18
Vec3 dir;//0x24
Vec3 shootPos;//0x30
bool meleeArmorAbsorb;//0x3C*/
EntityId shooterId; //0x0000
EntityId targetId; //0x0004
int materialId; //0x0008
int typeId; //0x000С
int bulletType; //0x0010
int partId; //0x0014
Vec3 pos; //0x0018
Vec3 dir; //0x0028
Vec3 shootPos; //0x0034
bool meleeArmorAbsorb; //0x003C
DWORD itemId; //0x0040
DWORD projectileId; //0x004C
Vec3 normal; //0x0054
bool bServer; //0x0069
};
struct SSourceGameHitInfo
{
EntityId itemId;////0x40
EntityId projectileId;//0x44
uint16 ammoClassId;//0x48
float angle;//0x4C
Vec3 normal;//0x50
bool silencer;//0x5C
};
struct SClientGameHitInfo
{
SSharedGameHitInfo shared;//0x00
SSourceGameHitInfo source;//0x40
float travelDistance;//0x60
float damageReduction;//0x64
bool bFromRemote;//0x68
bool canBeReported;//0x69
bool bRequest;//0x6A
};
class CGameRules
{
public:
int GetTeam(EntityId entityId) { return CallFunction<int(__thiscall*)(PVOID, EntityId)>(this, 0x368)(this, entityId); }
int GetHitTypeId(const char* type) { return CallFunction<int(__thiscall*)(PVOID, const char*)>(this, 0x140)(this, type); }
int GetHitMaterialId(const char* materialName) { return CallFunction<int(__thiscall*)(PVOID, const char*)>(this, 0x390)(this, materialName); }
void ClientHit(SClientGameHitInfo* info) { return CallFunction<void(__thiscall*)(PVOID, SClientGameHitInfo*)>(this, 0x4E0)(this, info); }
};
class CEntityClass
{
public:
const char* GetIClassName() { return CallFunction<const char* (__fastcall*)(PVOID64)>(this, 0x10)(this); }
};
struct CEntityArchetype
{
public:
const char* GetName() { return CallFunction<const char* (__thiscall*)(PVOID)>(this, 0x10)(this); }
};
class CEntity
{
public:
EntityId GetEntityId() { return CallFunction<EntityId(__thiscall*)(PVOID)>(this, 0x8)(this); }
CEntityClass* GetEntityClass() { return CallFunction<CEntityClass* (__fastcall*)(PVOID64)>(this, 0x18)(this); }
CEntityArchetype* GetCEntityArchetype() { return (CEntityArchetype*)*(DWORD64*)((DWORD64)this + 0x38); }
Matrix34 GetEntityWorldTM() { return (Matrix34) * (Matrix34*)((DWORD64)this + 0x40); }
void SetName(const char* Name) { return CallFunction<void(__thiscall*)(PVOID, const char*)>(this, 0x58)(this, Name); }
const char* GetName() { return CallFunction<const char* (__thiscall*)(PVOID)>(this, 0x60)(this); }
Vec3 GetPosition() { return *(Vec3*)((DWORD64)this + 0x70); }
bool IsHidden() { return CallFunction<bool(__fastcall*)(PVOID64)>(this, 0x178)(this); }
СCharacterInstance* GetCharacter(int nSlot) { return CallFunction<СCharacterInstance* (__thiscall*)(PVOID, int)>(this, 0x290)(this, nSlot); }
};
class CEntityIt
{
public:
CEntity* Next() { return CallFunction<CEntity* (__fastcall*)(PVOID)>(this, 0x30)(this); }
};
class CEntitySystem
{
public:
CEntityIt* GetEntityIterator() { return CallFunction<CEntityIt* (__thiscall*)(PVOID)>(this, 0xA8)(this); }
};
struct CGameObject
{
public:
char pad_0x0000[0x18];
CEntity* m_pEntity;
};
struct CWeaponParamsTwo
{
public:
char pad_0x00[0x68];
TWeaponMap m_stats; // 0x68 "needIcon"
BOOL GetStat(uint32_t id, FLOAT* value)
{
if (uint32_t* stat = FindStat(id))
{
*(uint32_t*)value = stat[0] ^ stat[1];
return TRUE;
}
return FALSE;
}
BOOL SetStat(uint32_t id, FLOAT value)
{
if (uint32_t* stat = FindStat(id))
{
stat[0] = *(uint32_t*)&value ^ stat[1];
return TRUE;
}
return FALSE;
}
void FastKnife(FLOAT value)
{
SetStat(56, value);
SetStat(57, 0.1f);
SetStat(61, value);
SetStat(83, value);
SetStat(84, 0.01f);
SetStat(85, value);
}
void GetIScatter(FLOAT value)
{
SetStat(95, value);
SetStat(96, value);
}
private:
uint32_t* FindStat(uint32_t id)
{
TWeaponMap::iterator it = m_stats.find(id);
if (it != m_stats.end())
{
return it->second;
}
return 0;
}
};
class CWeaponParamThree
{
public:
INT CounterAmmo(VOID) { return (INT) * (DWORD64*)((DWORD64)this + 0xC); }
};
class CWeaponSpecific
{
public:
CWeaponParamsTwo* GetIWeaponParamsTwo() { return (CWeaponParamsTwo*)*(DWORD64*)((DWORD64)this + 0x60); }
CWeaponParamThree* GetIWeaponParamThree() { return (CWeaponParamThree*)*(DWORD64*)((DWORD64)this + 0x0068); }
void RequestReload() { auto _this = this; ((uint64(__fastcall*)(PVOID, uint32))IWeaponPTR_RequestReload)(&_this, 0); }
void GetShutter(int8 Value) { *(int8*)((DWORD64)this + 0xD2) = Value; }
const char* GetWeaponName() { return (const char*)*(uint64*)((uint64)this + 0x28); }
};
class CWeapon
{
public:
CWeaponSpecific* GetIWeaponSpecific() { return (CWeaponSpecific*)*(DWORD64*)((DWORD64)this + 0x8); }
void SetFiringPos(Vec3 Position) { *(Vec3*)((DWORD64) * (DWORD64*)((DWORD64)this + 0x18) + 0x1C) = Position; }
void StartFire() { CallFunction<void(__thiscall*)(PVOID)>(this, 0x58)(this); }
void StopFire() { CallFunction<void(__thiscall*)(PVOID)>(this, 0x60)(this); }
};
class CItem
{
public:
CEntity* GetIWeaponEntity() { return m_pEntity; }
CGameObject* GetGameObject() { return m_pGameObject; }
EntityId GetEntityId() { return m_entityId; }
DWORD GetItemId() { return m_dwItemId; }
CWeapon* GetIWeapon() { return (CWeapon*)((DWORD64)this + 0x28); }
private:
char pad_0x0000[0x10]; //0x0000
CEntity* m_pEntity; //0x0010
CGameObject* m_pGameObject; //0x0018
EntityId m_entityId; //0x0020
char pad_0x0024[0x28]; //0x0024
DWORD m_dwItemId; //0x004C
};
class CActor
{
public:
CEntity* GetEntity() { return *(CEntity**)((__int64)this + 0x10); }
EntityId GetTriggeredID()
{
DWORD64 offset_0 = *(DWORD64*)(DWORD64(this + 0x18));
if (!offset_0) return 0;
DWORD64 offset_1 = *(DWORD64*)(DWORD64(offset_0 + 0x60));
if (!offset_1) return 0;
DWORD64 offset_2 = *(DWORD64*)(DWORD64(offset_1 + 0x20));
if (!offset_2) return 0;
return *(EntityId*)(DWORD64(offset_2 + 0x170));
}
CItem* GetCurrentItem(bool includeVehicle = false) { return CallFunction<CItem* (__thiscall*)(PVOID, bool)>(this, 456)(this, includeVehicle); }
EntityId GetEntityId() { return (EntityId) * (DWORD64*)((DWORD64)this + 0x20); }
int GetHealth() { return CallFunction<int(__thiscall*)(PVOID)>(this, 0xD8)(this); }
bool IsDead() { return GetHealth() <= 0; }
void GetRecoilParams(int ParamsRecoil) { CallFunction<void(__thiscall*)(PVOID, int)>(this, 0x2D8)(this, ParamsRecoil); }
int GetWeaponSlot() { return *(int*)((__int64)this + (0xECC + 0x8 + 0x1)); }
int GetTeamId() { return *(int*)((__int64)this + 0x3E0); }
};
class CActorSystem
{
public:
CActor* GetActor(int entityId) { return CallFunction<CActor* (__thiscall*)(PVOID, int)>(this, 0x78)(this, entityId); }
};
struct CGameFrameworkListener
{
virtual ~CGameFrameworkListener() { }//0
virtual void Render(float fDeltaTime) { };//1
virtual void OnSaveGame(class ISaveGame* pSaveGame) { };//2
virtual void OnLoadGame(class ILoadGame* pLoadGame) { };//3
virtual void OnLevelEnd(const char* nextLevel) { };//4
virtual void OnActionEvent(const SActionEvent& event) { };//5
virtual void Fun() { }//6
};
class CGameFramework
{
public:
CActor* GetClientActor()
{
CActor* pLocalActor = NULL;
bool bGetActorResult = CallFunction<bool(__thiscall*)(PVOID, CActor**)>(this, 0x470)(this, &pLocalActor);
if (!bGetActorResult) pLocalActor = NULL;
return pLocalActor;
}
CActorSystem* GetActorSystem() { return CallFunction<CActorSystem* (__fastcall*)(PVOID)>(this, 200)(this); }
CGameRules* GetGameRulesSystem() { return CallFunction<CGameRules* (__fastcall*)(PVOID)>(this, 1096)(this); }
CEntitySystem* GetIEntitySystem() { return (CEntitySystem*)*(DWORD64*)((DWORD64)this + 0x30); }
void RegisterListener(CGameFrameworkListener* pGameFrameworkListener, const char* name, EFRAMEWORKLISTENERPRIORITY eFrameworkListenerPriority)
{
CallFunction<void(__fastcall*)(PVOID, CGameFrameworkListener*, const char*, EFRAMEWORKLISTENERPRIORITY)>(this, 0x6C)(this, pGameFrameworkListener, name, eFrameworkListenerPriority);
}
};
struct SCVars
{
public:
void i_soundeffects(INT32 Value)
{
*(INT32*)((DWORD64)this + 0xE4) = Value;
}
void i_lighteffects(INT32 Value)
{
*(INT32*)((DWORD64)this + 0xE8) = Value;
}
void i_particleeffects(INT32 Value)
{
*(INT32*)((DWORD64)this + 0xEC) = Value;
}
void i_rejecteffects(INT32 Value)
{
*(INT32*)((DWORD64)this + 0xF0) = Value;
}
void i_pelletsDisp(FLOAT Value)
{
*(FLOAT*)((DWORD64)this + 0x12C) = Value;
}
void g_parametric_spread_attack_enabled(FLOAT Value)
{
*(FLOAT*)((DWORD64)this + 0x250) = Value;
}
void GetIScatter(FLOAT Value, FLOAT Value2)
{
i_pelletsDisp(Value); g_parametric_spread_attack_enabled(Value2);
}
void cl_stand_to_crouch_delay_all(int Value)
{
*(int*)((DWORD)this + 3372) = Value;
*(int*)((DWORD)this + 3376) = Value;
*(int*)((DWORD)this + 3380) = Value;
*(int*)((DWORD)this + 3384) = Value;
*(int*)((DWORD)this + 3388) = Value;
*(int*)((DWORD)this + 3392) = Value;
}
};
struct SViewport
{
int nX, nY, nWidth, nHeight;
float fMinZ, fMaxZ;
SViewport() : nX(0), nY(0), nWidth(0), nHeight(0) {}
SViewport(int nNewX, int nNewY, int nNewWidth, int nNewHeight)
{
nX = nNewX;
nY = nNewY;
nWidth = nNewWidth;
nHeight = nNewHeight;
}
_inline friend bool operator != (const SViewport& m1, const SViewport& m2)
{
if (m1.nX != m2.nX || m1.nY != m2.nY || m1.nWidth != m2.nWidth || m1.nHeight != m2.nHeight || m1.fMinZ != m2.fMinZ || m1.fMaxZ != m2.fMaxZ)
return true;
return false;
}
};
class CRenderer
{
static Vec3* mathVec3Project(Vec3* pvMin, const Vec3* pvObj, const int32 pViewport[4], const Matrix44* pProjection, const Matrix44* pView, const Matrix44* pWorld)
{
return CallAddress<Vec3* (__fastcall*)(Vec3*, const Vec3*, const int32[], const Matrix44*, const Matrix44*, const Matrix44*)>(0x1420DE3D8)
(pvMin, pvObj, pViewport, pProjection, pView, pWorld);
}
public:
char pad_0x0000[0xA720]; //0x0000
__int64 m_pDirectDevice; //0xA6D0 // import -> D3DXCreateTexture -> j_D3DXCreateTexture -> 2 sub
void DrawAABB(AABB& bbox) { return CallFunction<void(__thiscall*)(void*, AABB&)>(this, 0x7F8)(this, bbox); }
Vec3 GetViewCamera() { return *(Vec3*)((DWORD64)this + 0x1700); }
SViewport GetNewViewport() { return *(SViewport*)((DWORD64)this + 0x9308); }
SViewport GetMainRTViewport() { return *(SViewport*)((DWORD64)this + 0x92C0); }
float GetWidth() { return (float)CallFunction<int(__fastcall*)(PVOID)>(this, 0x2D0)(this); }
float GetHeight() { return (float)CallFunction<int(__fastcall*)(PVOID)>(this, 0x2D8)(this); }
bool ProjectToScreen(Vec3 vIn, Vec3& vOut)
{
PDWORD pRenderThread = *(PDWORD*)((DWORD64)this + 0x8D60);
DWORD v5 = pRenderThread[51];
if (v5 != pRenderThread[53])
{
v5 = GetCurrentThreadId();
}
int nThreadID = (v5 != pRenderThread[51]) ? pRenderThread[10] : pRenderThread[11];
SViewport vp = GetMainRTViewport();
int32 v[4];
v[0] = vp.nX;
v[1] = vp.nY;
v[2] = vp.nWidth;
v[3] = vp.nHeight;
Matrix44 mIdent;
mIdent.SetIdentity();
Matrix44* pProjection = **(Matrix44***)((DWORD64)this + 0xEA0 + 0x318 * nThreadID);
Matrix44* pView = **(Matrix44***)((DWORD64)this + 0xE98 + 0x318 * nThreadID);
mathVec3Project(&vOut, &vIn, v, pProjection, pView, &mIdent);
if (vOut.z <= 0.0f || vOut.z >= 1.0f) return false;
return true;
}
inline bool WorldToScreen(Vec3 world, Vec3& screen)
{
return this->ProjectToScreen(world, screen);
}
bool GetPriority(Vec3 vEntityPos)
{
Vec3 vCameraPos = this->GetViewCamera();
bool bProximityZ = abs(vCameraPos.z - vEntityPos.z) <= 1.5f;
vCameraPos.z = vEntityPos.z = 0.f;
bool bProximityXY = (vCameraPos - vEntityPos).GetLength() <= 1.25f;
return bProximityXY && bProximityZ;
}
};
struct SClimbSettings
{
char pad_0000[16]; //0x0000
float distNearClipPlane; //0x0010
uint32_t ViewID; //0x0014
float minHelperHeight; //0x0018
float maxHelperHeight; //0x001C
float detectZoneLength; //0x0020
float nearZoneLength; //0x0024
float lowerAnimStartDist; //0x0028
float verticalVelocity; //0x002C
float upperOffset; //0x0030
float upperOffset2; //0x0034
float middleOffset; //0x0038
};
struct SSpecialMovesSettings
{
SClimbSettings* m_pClimbSettings;
};
class CGame
{
public:
class CGameFramework* GetIGameFramework()
{
typedef CGameFramework* (__fastcall* CGameFramework)(PVOID64); return CallFunction<CGameFramework>(this, 0x70)(this);
}
SCVars* GetCVars()
{
return (SCVars*)*(DWORD64*)((DWORD64)this + 0x130);
}
SSpecialMovesSettings* GetSMSettings()
{
DWORD64 v0 = *(DWORD64*)((DWORD64)this + 0x290);
if (!v0) return NULL;
SSpecialMovesSettings* pSMSettings = *(SSpecialMovesSettings**)(v0 + 0x8);
if (!pSMSettings) return NULL;
return pSMSettings;
}
};
class CSystem
{
public:
CTable* GetVTable() { return (CTable*)this; }
};
class CConsole
{
public:
SCVars* GetCVars()
{
return (SCVars*)*(DWORD64*)((DWORD64)this + 0x40);//B8
}
};
class CPhysicalWorld
{
public:
int RayWorldIntersection(const Vec3& org, const Vec3& dir, int objtypes, unsigned int flags, CRayHit* hits, int nMaxHits, CPhysicalEntity** pSkipEnts = 0, int nSkipEnts = 0, void* pForeignData = 0, int iForeignData = 0, const char* pNameTag = "RayWorldIntersection(Game)", CRayHitCached* phitLast = 0, int iCaller = 4)
{
using oRayWorldIntersection = int(__fastcall*)(PVOID, const Vec3&, const Vec3&, int, unsigned int, CRayHit*, int, CPhysicalEntity**, int, void*, int, const char*, CRayHitCached*, int);
return CallFunction<oRayWorldIntersection>(this, 0x118)(this, org, dir, objtypes, flags, hits, nMaxHits, pSkipEnts, nSkipEnts, pForeignData, iForeignData, pNameTag, phitLast, iCaller);
}
bool isVisible(Vec3 shootPos, Vec3 pos)
{
CRayHit tmpHit;
return !this->RayWorldIntersection(shootPos, pos - shootPos, 0x100 | 1, 0xA | 0x400, &tmpHit, 1);
}
};
class SSystemGlobalEnvironment
{
public:
CRenderer* GetIRenderer()
{
return (CRenderer*)*(uintptr_t*)((uintptr_t)this + 0x48);
}
CEntitySystem* GetIEntitySystem()
{
return (CEntitySystem*)*(uintptr_t*)((uintptr_t)this + 0xD8);
}
CConsole* GetConsole()
{
return (CConsole*)*(uintptr_t*)((uintptr_t)this + 0x40);//
}
CPhysicalWorld* GetIPhysicalWorld() { return (CPhysicalWorld*)*(uintptr_t*)((uintptr_t)this + 0x70);
}
CGame* GetIGame()
{
return (CGame*)*(uintptr_t*)((uintptr_t)this + 0xC8);
}
CSystem* GetSystem()
{
return (CSystem*)*(uintptr_t*)((uintptr_t)this + 0xE8);
}
static SSystemGlobalEnvironment* Singleton() { return *(SSystemGlobalEnvironment**)STATIC_SSGE;
}
};