-
Автор темы
- #1
Source from other forum.
Autowall.cpp
MiscClasses.h
Entities.h
Autowall.cpp
Код:
#include "AutoWall.h"
//#include "R.h"
#define HITGROUP_GENERIC 0
#define HITGROUP_HEAD 1
#define HITGROUP_CHEST 2
#define HITGROUP_STOMACH 3
#define HITGROUP_LEFTARM 4
#define HITGROUP_RIGHTARM 5
#define HITGROUP_LEFTLEG 6
#define HITGROUP_RIGHTLEG 7
#define HITGROUP_GEAR 10
inline bool CGameTrace::DidHitWorld() const
{
return m_pEnt->GetIndex() == 0;
}
inline bool CGameTrace::DidHitNonWorldEntity() const
{
return m_pEnt != NULL && !DidHitWorld();
}
boost HandleBulletPenetration (CSWeaponInfo * wpn_data, FireBulletData & data);
float GetHitgroupDamageMult(int iHitGroup)
{
switch (iHitGroup)
{
case HITGROUP_GENERIC:
return 0.5f;
case HITGROUP_HEAD:
return 2.0f;
case HITGROUP_CHEST:
return 0.5f;
case HITGROUP_STOMACH:
return 0.75f;
case HITGROUP_LEFTARM:
return 0.5f;
case HITGROUP_RIGHTARM:
return 0.5f;
case HITGROUP_LEFTLEG:
return 0.375f;
case HITGROUP_RIGHTLEG:
return 0.375f;
case HITGROUP_GEAR:
return 0.5f;
default:
return 1.0f;
}
return 1.0f;
}
void ScaleDamage(int hitgroup, IClientEntity *enemy, float weapon_armor_ratio, float ¤t_damage)
{
current_damage *= GetHitgroupDamageMult(hitgroup);
if (enemy->ArmorValue() > 0)
{
if (hitgroup == HITGROUP_HEAD)
{
if (enemy->HasHelmet())
current_damage *= (weapon_armor_ratio);
}
else
{
current_damage *= (weapon_armor_ratio);
}
}
}
bool SimulateFireBullet(IClientEntity *local, CBaseCombatWeapon *weapon, FireBulletData &data)
{
data.penetrate_count = 4; // Max Amount Of Penitration
data.trace_length = 0.0f; // wow what a meme
auto *wpn_data = weapon->GetCSWpnData(); // Get Weapon Info
data.current_damage = (float)wpn_data->m_iDamage;// Set Damage Memes
while ((data.penetrate_count > 0) && (data.current_damage >= 1.0f))
{
data.trace_length_remaining = wpn_data->m_flRange - data.trace_length;
Vector End_Point = data.src + data.direction * data.trace_length_remaining;
UTIL_TraceLine(data.src, End_Point, 0x4600400B, local, 0, &data.enter_trace);
UTIL_ClipTraceToPlayers(data.src, End_Point * 40.f, 0x4600400B, &data.filter, &data.enter_trace);
if (data.enter_trace.fraction == 1.0f) break;
if ((data.enter_trace.hitgroup <= 7) && (data.enter_trace.hitgroup > 0) && (local->GetTeamNum() != data.enter_trace.m_pEnt->GetTeamNum()))
{
data.trace_length += data.enter_trace.fraction * data.trace_length_remaining;
data.current_damage *= pow(wpn_data->m_flRangeModifier, data.trace_length * 0.002);
ScaleDamage(data.enter_trace.hitgroup, data.enter_trace.m_pEnt, wpn_data->m_flArmorRatio, data.current_damage);
return true;
}
if (!HandleBulletPenetration(wpn_data, data)) break;
}
return false;
}
boost HandleBulletPenetration (CSWeaponInfo * wpn_data, FireBulletData & data)
{
surfacedata_t *enter_surface_data = Interfaces::PhysProps->GetSurfaceData(data.enter_trace.surface.surfaceProps);
int enter_material = enter_surface_data->game.material;
float enter_surf_penetration_mod = enter_surface_data->game.flPenetrationModifier;
data.trace_length += data.enter_trace.fraction * data.trace_length_remaining;
data.current_damage *= pow(wpn_data->m_flRangeModifier, (data.trace_length * 0.002));
if ((data.trace_length > 3000.f) || (enter_surf_penetration_mod < 0.1f))data.penetrate_count = 0;
if (data.penetrate_count <= 0)return false;
Vector dummy;
trace_t trace_exit;
if (!TraceToExit(dummy, data.enter_trace, data.enter_trace.endpos, data.direction, &trace_exit)) return false;
surfacedata_t *exit_surface_data = Interfaces::PhysProps->GetSurfaceData(trace_exit.surface.surfaceProps);
int exit_material = exit_surface_data->game.material;
float exit_surf_penetration_mod = exit_surface_data->game.flPenetrationModifier;
float final_damage_modifier = 0.16f;
float combined_penetration_modifier = 0.0f;
if (((data.enter_trace.contents & CONTENTS_GRATE) != 0) || (enter_material == 89) || (enter_material == 71)) { combined_penetration_modifier = 3.0f; final_damage_modifier = 0.05f; }
else { combined_penetration_modifier = (enter_surf_penetration_mod + exit_surf_penetration_mod) * 0.5f; }
if (enter_material == exit_material)
{
if (exit_material == 87 || exit_material == 85)combined_penetration_modifier = 3.0f;
else if (exit_material == 76)combined_penetration_modifier = 2.0f;
}
float v34 = fmaxf(0.f, 1.0f / combined_penetration_modifier);
float v35 = (data.current_damage * final_damage_modifier) + v34 * 3.0f * fmaxf(0.0f, (3.0f / wpn_data->m_flPenetration) * 1.25f);
float thickness = VectorLength(trace_exit.endpos - data.enter_trace.endpos);
thickness *= thickness;
thickness *= v34;
thickness /= 24.0f;
float lost_damage = fmaxf(0.0f, v35 + thickness);
if (lost_damage > data.current_damage)return false;
if (lost_damage >= 0.0f)data.current_damage -= lost_damage;
if (data.current_damage < 1.0f) return false;
data.src = trace_exit.endpos;
data.penetrate_count--;
return true;
}
/*
* CanHit() - example of how to use the code
* @in point: target hitbox vector
* @out damage_given: amount of damage the shot would do
*/
bool CanHit(const Vector &point, float *damage_given)
{
//Utils::ToLog("CANHIT");
auto *local = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
auto data = FireBulletData(local->GetOrigin() + local->GetViewOffset());
data.filter = CTraceFilter();
data.filter.pSkip = local;
Vector angles;
CalcAngle(data.src, point, angles);
AngleVectors (angles, data.direction);
VectorNormalize(data.direction);
if (SimulateFireBullet(local, (CBaseCombatWeapon*)Interfaces::EntList->GetClientEntityFromHandle((HANDLE)local->GetActiveWeaponHandle()), data))
{
*damage_given = data.current_damage;
//Utils::ToLog("CANHIT END");
return true;
}
return false;
}
Код:
#pragma once
#include "MiscDefinitions.h"
#include "ClientRecvProps.h"
#include "offsets.h"
#include "Vector.h"
#include "bspflags.h"
#include "winwindef.h"
// Entity List
class IClientModeShared
{
public:
};
class IClientEntityList
{
public:
virtual void Function0();
virtual void Function1();
virtual void Function2();
virtual IClientEntity * GetClientEntity(int entnum);
virtual IClientEntity * GetClientEntityFromHandle(HANDLE hEnt) = 0;
virtual int NumberOfEntities(bool bIncludeNonNetworkable) = 0;
virtual int GetHighestEntityIndex(void);
virtual void SetMaxEntities(int maxents);
virtual int GetMaxEntities();
};
struct CViewSetup
{
char _0x0000[16];
__int32 x;
__int32 x_old;
__int32 and;
__int32 y_old;
__int32 width;
__int32 width_old;
__int32 height;
__int32 height_old;
char _0x0030[128];
float fov;
float fovViewmodel;
Vector origin;
Vector angles;
float zNear;
float zFar;
float zNearViewmodel;
float zFarViewmodel;
float m_flAspectRatio;
float m_flNearBlurDepth;
float m_flNearFocusDepth;
float m_flFarFocusDepth;
float m_flFarBlurDepth;
float m_flNearBlurRadius;
float m_flFarBlurRadius;
float m_nDoFQuality;
__int32 m_nMotionBlurMode;
char _0x0104[68];
__int32 m_EdgeBlur;
};
// Panels
class IPanel
{
public:
const char *GetName(unsigned int vguiPanel)
{
typedef const char* (__thiscall* OriginalFn)(PVOID, unsigned int);
return call_vfunc<OriginalFn>(this, Offsets::VMT::Panel_GetName)(this, vguiPanel);
}
};
class IGameEvent {
public:
virtual ~IGameEvent() {};
virtual const char *GetName() const = 0; // get event name
virtual bool IsReliable() const = 0; // if event handled reliable
virtual bool IsLocal() const = 0; // if event is never networked
virtual bool IsEmpty(const char *keyName = NULL) = 0; // check if data field exists
// Data access
virtual bool GetBool(const char *keyName = NULL, bool defaultValue = false) = 0;
virtual int GetInt(const char *keyName = NULL, int defaultValue = 0) = 0;
virtual unsigned __int64 GetUint64(const char *keyName = NULL, unsigned __int64 defaultValue = 0) = 0;
virtual float GetFloat(const char *keyName = NULL, float defaultValue = 0.0f) = 0;
virtual const char *GetString(const char *keyName = NULL, const char *defaultValue = "") = 0;
virtual const wchar_t * GetWString(char const *keyName = NULL, const wchar_t *defaultValue = L"") = 0;
virtual void SetBool(const char *keyName, bool value) = 0;
virtual void SetInt(const char *keyName, int value) = 0;
virtual void SetUint64(const char *keyName, unsigned __int64 value) = 0;
virtual void SetFloat(const char *keyName, float value) = 0;
virtual void SetString(const char *keyName, const char *value) = 0;
virtual void SetWString(const char *keyName, const wchar_t *value) = 0;
};
class IGameEventListener2 {
public:
virtual ~IGameEventListener2(void) {};
virtual void FireGameEvent(IGameEvent *event) = 0;
virtual int GetEventDebugID(void) = 0;
};
class bf_read;
class bf_write;
class IGameEventManager2 {
public:
virtual ~IGameEventManager2(void) {};
virtual int LoadEventsFromFile(const char *filename) = 0;
virtual void Reset() = 0;
virtual bool AddListener(IGameEventListener2 *listener, const char *name, bool bServerSide) = 0;
virtual bool FindListener(IGameEventListener2 *listener, const char *name) = 0;
virtual void RemoveListener(IGameEventListener2 *listener) = 0;
virtual IGameEvent *CreateEvent(const char *name, bool bForce = false, int *pCookie = NULL) = 0;
virtual bool FireEvent(IGameEvent *event, bool bDontBroadcast = false) = 0;
virtual bool FireEventClientSide(IGameEvent *event) = 0;
virtual IGameEvent *DuplicateEvent(IGameEvent *event) = 0;
virtual void FreeEvent(IGameEvent *event) = 0;
virtual bool SerializeEvent(IGameEvent *event, bf_write *buf) = 0;
virtual IGameEvent *UnserializeEvent(bf_read *buf) = 0;
};
class Color
{
public:
Color()
{
*((int *)this) = 0;
}
Color(int r, int g, int b)
{
SetColor(r, g, b, 0);
}
Color(int r, int g, int b, int a)
{
SetColor(r, g, b, a);
}
void SetColor(int r, int g, int b, int a = 0)
{
_color[0] = (unsigned char)r;
_color[1] = (unsigned char)g;
_color[2] = (unsigned char)b;
_color[3] = (unsigned char)a;
}
void GetColor(int &r, int &g, int &b, int &a) const
{
r = _color[0];
g = _color[1];
b = _color[2];
a = _color[3];
}
void SetRawColor(int color32)
{
*((int *)this) = color32;
}
int GetRawColor() const
{
return *((int *)this);
}
inline int r() const { return _color[0]; }
inline int g() const { return _color[1]; }
inline int b() const { return _color[2]; }
inline int a() const { return _color[3]; }
inline float rBase() const { return _color[0] / 255.0f; }
inline float gBase() const { return _color[1] / 255.0f; }
inline float bBase() const { return _color[2] / 255.0f; }
inline float aBase() const { return _color[3] / 255.0f; }
void SetAlpha(int a) { _color[0] = (unsigned char)a; }
int GetAlpha() { return _color[0]; }
unsigned char &operator[](int index)
{
return _color[index];
}
const unsigned char &operator[](int index) const
{
return _color[index];
}
bool operator == (const Color &rhs) const
{
return (*((int *)this) == *((int *)&rhs));
}
bool operator != (const Color &rhs) const
{
return !(operator==(rhs));
}
Color &operator=(const Color &rhs)
{
SetRawColor(rhs.GetRawColor());
return *this;
}
private:
unsigned char _color[4];
};
class IVDebugOverlay
{
public:
virtual void AddEntityTextOverlay(int ent_index, int line_offset, float duration, int r, int g, int b, int a, const char *format, ...) = 0;
virtual void AddBoxOverlay(const Vector& origin, const Vector& mins, const Vector& max, Vector const& orientation, int r, int g, int b, int a, float duration) = 0;
virtual void AddSphereOverlay(const Vector& vOrigin, float flRadius, int nTheta, int nPhi, int r, int g, int b, int a, float flDuration) = 0;
virtual void AddTriangleOverlay(const Vector& p1, const Vector& p2, const Vector& p3, int r, int g, int b, int a, bool noDepthTest, float duration) = 0;
virtual void AddLineOverlay(const Vector& origin, const Vector& dest, int r, int g, int b, bool noDepthTest, float duration) = 0;
virtual void AddTextOverlay(const Vector& origin, float duration, const char *format, ...) = 0;
virtual void AddTextOverlay(const Vector& origin, int line_offset, float duration, const char *format, ...) = 0;
virtual void AddScreenTextOverlay(float flXPos, float flYPos, float flDuration, int r, int g, int b, int a, const char *text) = 0;
virtual void AddSweptBoxOverlay(const Vector& start, const Vector& end, const Vector& mins, const Vector& max, const Vector & angles, int r, int g, int b, int a, float flDuration) = 0;
virtual void AddGridOverlay(const Vector& origin) = 0;
virtual void AddCoordFrameOverlay(const matrix3x4& frame, float flScale, int vColorTable[3][3] = NULL) = 0;
virtual int ScreenPosition(const Vector& point, Vector& screen) = 0;
virtual int ScreenPosition(float flXPos, float flYPos, Vector& screen) = 0;
virtual void *GetFirst(void) = 0;
virtual void *GetNext(void *current) = 0;
virtual void ClearDeadOverlays(void) = 0;
virtual void ClearAllOverlays() = 0;
virtual void AddTextOverlayRGB(const Vector& origin, int line_offset, float duration, float r, float g, float b, float alpha, const char *format, ...) = 0;
virtual void AddTextOverlayRGB(const Vector& origin, int line_offset, float duration, int r, int g, int b, int a, const char *format, ...) = 0;
virtual void AddLineOverlayAlpha(const Vector& origin, const Vector& dest, int r, int g, int b, int a, bool noDepthTest, float duration) = 0;
virtual void AddBoxOverlay2(const Vector& origin, const Vector& mins, const Vector& max, Vector const& orientation, const Color& faceColor, const Color& edgeColor, float duration) = 0;
virtual void PurgeTextOverlays() = 0;
};
// User Cmd's
class CUserCmd
{
public:
virtual ~CUserCmd() {}; //Destructor 0
CUserCmd()
{
Reset();
}
void Reset()
{
command_number = 0;
tick_count = 0;
viewangles.Init();
forwardmove = 0.0f;
sidemove = 0.0f;
upmove = 0.0f;
buttons = 0;
impulse = 0;
weaponselect = 0;
weaponsubtype = 0;
random_seed = 0;
mousedx = 0;
mousedy = 0;
headangles.Init();
headoffset.Init();
hasbeenpredicted = false;
}
CUserCmd& operator =(const CUserCmd& src)
{
if (this == &src)
return *this;
command_number = src.command_number;
tick_count = src.tick_count;
viewangles = src.viewangles;
forwardmove = src.forwardmove;
sidemove = src.sidemove;
upmove = src.upmove;
buttons = src.buttons;
impulse = src.impulse;
weaponselect = src.weaponselect;
weaponsubtype = src.weaponsubtype;
random_seed = src.random_seed;
mousedx = src.mousedx;
mousedy = src.mousedy;
hasbeenpredicted = src.hasbeenpredicted;
headangles = src.headangles;
headoffset = src.headoffset;
return *this;
}
CUserCmd(const CUserCmd& src)
{
*this = src;
}
int command_number;
int tick_count;
Vector viewangles;
Vector aimdirection;
float forwardmove;
float sidemove;
float upmove;
int buttons;
BYTE impulse;
int weaponselect;
int weaponsubtype;
int random_seed;
short mousedx;
short mousedy;
bool hasbeenpredicted;
Vector headangles;
Vector headoffset;
};
class CVerifiedUserCmd
{
public:
CUserCmd m_cmd;
unsigned long m_crc;
};
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Generic CRC functions
//
// $ NoKeywords: $
//=============================================================================//
#ifndef CHECKSUM_CRC_H
#define CHECKSUM_CRC_H
#ifdef _WIN32
#pragma once
#endif
typedef unsigned long CRC32_t;
void CRC32_Init(CRC32_t *pulCRC);
void CRC32_ProcessBuffer(CRC32_t *pulCRC, const void *p, int len);
void CRC32_Final(CRC32_t *pulCRC);
CRC32_t CRC32_GetTableEntry(unsigned int slot);
inline CRC32_t CRC32_ProcessSingleBuffer(const void *p, int len)
{
CRC32_t crc;
CRC32_Init(&crc);
CRC32_ProcessBuffer(&crc, p, len);
CRC32_Final(&crc);
return crc;
}
#endif // CHECKSUM_CRC_H
class CInput
{
public:
void* pvftable; //0x00
bool m_fTrackIRAvailable; //0x04
bool m_fMouseInitialized; //0x05
bool m_fMouseActive; //0x06
bool m_fJoystickAdvancedInit; //0x07
char pad_0x08[0x2C]; //0x08
void* m_pKeys; //0x34
char pad_0x38[0x64]; //0x38
int pad_0x41;
int pad_0x42;
bool m_fCameraInterceptingMouse; //0x9C
bool m_fCameraInThirdPerson; //0x9D
bool m_fCameraMovingWithMouse; //0x9E
Vector m_vecCameraOffset; //0xA0
bool m_fCameraDistanceMove; //0xAC
int m_nCameraOldX; //0xB0
int m_nCameraOldY; //0xB4
int m_nCameraX; //0xB8
int m_nCameraY; //0xBC
bool m_CameraIsOrthographic; //0xC0
Vector m_angPreviousViewAngles; //0xC4
Vector m_angPreviousViewAnglesTilt; //0xD0
float m_flLastForwardMove; //0xDC
int m_nClearInputState; //0xE0
char pad_0xE4[0x8]; //0xE4
CUserCmd* m_pCommands; //0xEC
//CVerifiedUserCmd* m_pVerifiedCommands; //0xF0
class CUserCmd
{
public:
CRC32_t GetChecksum(void) const
{
CRC32_t crc;
CRC32_Init(&crc);
CRC32_ProcessBuffer(&crc, &command_number, sizeof(command_number));
CRC32_ProcessBuffer(&crc, &tick_count, sizeof(tick_count));
CRC32_ProcessBuffer(&crc, &viewangles, sizeof(viewangles));
CRC32_ProcessBuffer(&crc, &aimdirection, sizeof(aimdirection));
CRC32_ProcessBuffer(&crc, &forwardmove, sizeof(forwardmove));
CRC32_ProcessBuffer(&crc, &sidemove, sizeof(sidemove));
CRC32_ProcessBuffer(&crc, &upmove, sizeof(upmove));
CRC32_ProcessBuffer(&crc, &buttons, sizeof(buttons));
CRC32_ProcessBuffer(&crc, &impulse, sizeof(impulse));
CRC32_ProcessBuffer(&crc, &weaponselect, sizeof(weaponselect));
CRC32_ProcessBuffer(&crc, &weaponsubtype, sizeof(weaponsubtype));
CRC32_ProcessBuffer(&crc, &random_seed, sizeof(random_seed));
CRC32_ProcessBuffer(&crc, &mousedx, sizeof(mousedx));
CRC32_ProcessBuffer(&crc, &mousedy, sizeof(mousedy));
CRC32_Final(&crc);
return crc;
}
BYTE u1[4];
int command_number;
int tick_count;
Vector viewangles;
Vector aimdirection;
float forwardmove;
float sidemove;
float upmove;
int buttons;
BYTE impulse;
int weaponselect;
int weaponsubtype;
int random_seed;
short mousedx;
short mousedy;
bool hasbeenpredicted;
Vector headangles;
Vector headoffset;
};
class CVerifiedUserCmd
{
public:
CUserCmd m_cmd;
unsigned long m_crc;
};
CUserCmd* GetUserCmd(int slot, int seq)
{
typedef CUserCmd* (__thiscall* OriginalFn)(PVOID, int, int);
return call_vfunc<OriginalFn>(this, 9)(this, slot, seq);
}
};
class CGlobalVarsBase
{
public:
float realtime;
int framecount;
float absoluteframetime;
float absoluteframestarttimestddev;
float curtime;
float frametime;
int maxClients;
int tickcount;
float interval_per_tick;
float interpolation_amount;
int simTicksThisFrame;
int network_protocol;
void* pSaveData;
bool m_bClient;
int nTimestampNetworkingBase;
int nTimestampRandomizeWindow;
};
struct Ray_t
{
__declspec(align(16)) Vector m_Start;
__declspec(align(16)) Vector m_Delta;
__declspec(align(16)) Vector m_StartOffset;
__declspec(align(16)) Vector m_Extents;
//without your matrix3x4
bool m_IsRay;
bool m_IsSwept;
void Init(Vector& vecStart, Vector& vecEnd)
{
m_Delta = vecEnd - vecStart;
m_IsSwept = (m_Delta.LengthSqr() != 0);
m_Extents.x = m_Extents.y = m_Extents.z = 0.0f;
m_IsRay = true;
m_StartOffset.x = m_StartOffset.y = m_StartOffset.z = 0.0f;
m_Start = vecStart;
}
};
struct cplane_t
{
Vector normal;
float dist;
BYTE type;
BYTE signbits;
BYTE pad[2];
};
class CBaseTrace
{
public:
Vector startpos;
Vector endpos;
cplane_t plane;
float fraction;
int contents;
unsigned short dispFlags;
bool allsolid;
bool startsolid;
};
struct csurface_t
{
const char* name;
short surfaceProps;
unsigned short flags;
};
class CGameTrace : public CBaseTrace
{
public:
bool DidHitWorld() const;
bool DidHitNonWorldEntity() const;
int GetEntityIndex() const;
bool DidHit() const;
public:
float fractionleftsolid;
csurface_t surface;
int hitgroup;
short physicsbone;
unsigned short worldSurfaceIndex;
IClientEntity* m_pEnt;
int hitbox;
char shit[0x24];
};
inline bool CGameTrace::DidHit() const
{
return fraction < 1.0f || allsolid || startsolid;
}
typedef CGameTrace trace_t;
enum TraceType_t
{
TRACE_EVERYTHING = 0,
TRACE_WORLD_ONLY,
TRACE_ENTITIES_ONLY,
TRACE_EVERYTHING_FILTER_PROPS,
};
class ITraceFilter
{
public:
virtual bool ShouldHitEntity(IClientEntity* pEntity, int contentsMask) = 0;
virtual TraceType_t GetTraceType() const = 0;
};
class CTraceFilter : public ITraceFilter
{
public:
bool ShouldHitEntity(IClientEntity* pEntityHandle, int contentsMask)
{
return !(pEntityHandle == pSkip);
}
TraceType_t GetTraceType() const
{
return TRACE_EVERYTHING;
}
void* pSkip;
};
class IEngineTrace
{
public:
int GetPointContents(const Vector &vecAbsPosition, int contentsMask = MASK_ALL, IClientEntity** ppEntity = NULL)
{
typedef int(__thiscall* fnGetPointContents)(void*, const Vector&, int, IClientEntity**);
return call_vfunc<fnGetPointContents>(this, 0)(this, vecAbsPosition, contentsMask, ppEntity);
}
void TraceRay(const Ray_t &ray, unsigned int fMask, ITraceFilter* pTraceFilter, trace_t* pTrace)
{
typedef void(__thiscall* fnTraceRay)(void*, const Ray_t&, unsigned int, ITraceFilter*, trace_t*);
call_vfunc<fnTraceRay>(this, 5)(this, ray, fMask, pTraceFilter, pTrace);
}
void EdgeTraceRay(Ray_t &ray, CTraceFilter &filt, CGameTrace &trace, bool wall = false)
{
typedef void(__thiscall *OrigFn)(void *, Ray_t &, unsigned int, CTraceFilter &, CGameTrace &);
call_vfunc<OrigFn>(this, 5)(this, ray, wall ? 0x200400B : 0x46004003, filt, trace); // 0x46004003 0x4600400B
}
};
struct mstudiobbox_t
{
int bone;
int group;
Vector bbmin;
Vector bbmax;
int szhitboxnameindex;
int unused[8];
//float radius;
char* GetHitboxName(void)
{
if (szhitboxnameindex == 0)
return "";
return ((char*)this) + szhitboxnameindex;
}
};
struct mstudiohitboxset_t
{
int sznameindex;
inline char* const GetName(void) const { return ((char*)this) + sznameindex; }
int numhitboxes;
int hitboxindex;
inline mstudiobbox_t* GetHitbox(int i) const { return (mstudiobbox_t*)(((byte*)this) + hitboxindex) + i; };
};
struct mstudiobone_t
{
int sznameindex;
inline char * const GetName(void) const { return ((char *)this) + sznameindex; }
int parent;
int bonecontroller[6];
Vector pos;
float quat[4];
Vector rot;
Vector posscale;
Vector rotscale;
matrix3x4 poseToBone;
float qAlignment[4];
int flags;
int proctype;
int procindex; // procedural rule
mutable int physicsbone; // index into physically simulated bone
inline void * GetProcedure() const { if (procindex == 0) return NULL; else return (void *)(((byte *)this) + procindex); };
int surfacepropidx; // index into string tablefor property name
inline char * const GetSurfaceProps(void) const { return ((char *)this) + surfacepropidx; }
int contents; // See BSPFlags.h for the contents flags
int unused[8]; // remove as appropriate
};
struct studiohdr_t
{
int id;
int version;
int checksum;
char name[64];
int length;
Vector eyeposition;
Vector illumposition;
Vector hull_min;
Vector hull_max;
Vector view_bbmin;
Vector view_bbmax;
int flags;
int numbones;
int boneindex;
inline mstudiobone_t *GetBone(int i) const { return (mstudiobone_t *)(((byte *)this) + boneindex) + i; };
// inline mstudiobone_t *pBone(int i) const { Assert(i >= 0 && i < numbones); return (mstudiobone_t *)(((byte *)this) + boneindex) + i; };
int numbonecontrollers;
int bonecontrollerindex;
int numhitboxsets;
int hitboxsetindex;
mstudiohitboxset_t* GetHitboxSet(int i) const
{
return (mstudiohitboxset_t*)(((byte*)this) + hitboxsetindex) + i;
}
inline mstudiobbox_t* GetHitbox(int i, int set) const
{
mstudiohitboxset_t const* s = GetHitboxSet(set);
if (!s)
return NULL;
return s->GetHitbox(i);
}
inline int GetHitboxCount(int set) const
{
mstudiohitboxset_t const* s = GetHitboxSet(set);
if (!s)
return 0;
return s->numhitboxes;
}
int numlocalanim;
int localanimindex;
int numlocalseq;
int localseqindex;
mutable int activitylistversion;
mutable int eventsindexed;
int numtextures;
int textureindex;
int numcdtextures;
int cdtextureindex;
int numskinref;
int numskinfamilies;
int skinindex;
int numbodyparts;
int bodypartindex;
int numlocalattachments;
int localattachmentindex;
int numlocalnodes;
int localnodeindex;
int localnodenameindex;
int numflexdesc;
int flexdescindex;
int numflexcontrollers;
int flexcontrollerindex;
int numflexrules;
int flexruleindex;
int numikchains;
int ikchainindex;
int nummouths;
int mouthindex;
int numlocalposeparameters;
int localposeparamindex;
int surfacepropindex;
int keyvalueindex;
int keyvaluesize;
int numlocalikautoplaylocks;
int localikautoplaylockindex;
float mass;
int contents;
int numincludemodels;
int includemodelindex;
mutable void *virtualModel;
int szanimblocknameindex;
int numanimblocks;
int animblockindex;
mutable void *animblockModel;
int bonetablebynameindex;
void *pVertexBase;
void *pIndexBase;
byte constdirectionallightdot;
byte rootLOD;
byte numAllowedRootLODs;
byte unused[1];
int unused4;
int numflexcontrollerui;
int flexcontrolleruiindex;
float flVertAnimFixedPointScale;
int unused3[1];
int studiohdr2index;
int unused2[1];
};
struct surfacephysicsparams_t
{
float friction;
float elasticity;
float density;
float thickness;
float dampening;
};
struct surfaceaudioparams_t
{
float reflectivity; // like elasticity, but how much sound should be reflected by this surface
float hardnessFactor; // like elasticity, but only affects impact sound choices
float roughnessFactor; // like friction, but only affects scrape sound choices
float roughThreshold; // surface roughness > this causes "rough" scrapes, < this causes "smooth" scrapes
float hardThreshold; // surface hardness > this causes "hard" impacts, < this causes "soft" impacts
float hardVelocityThreshold; // collision velocity > this causes "hard" impacts, < this causes "soft" impacts
float highPitchOcclusion; //a value betweeen 0 and 100 where 0 is not occluded at all and 100 is silent (except for any additional reflected sound)
float midPitchOcclusion;
float lowPitchOcclusion;
};
struct surfacesoundnames_t
{
unsigned short walkStepLeft;
unsigned short walkStepRight;
unsigned short runStepLeft;
unsigned short runStepRight;
unsigned short impactSoft;
unsigned short impactHard;
unsigned short scrapeSmooth;
unsigned short scrapeRough;
unsigned short bulletImpact;
unsigned short rolling;
unsigned short breakSound;
unsigned short strainSound;
};
struct surfacegameprops_t
{
public:
float maxSpeedFactor;
float jumpFactor;
float flPenetrationModifier;
float flDamageModifier;
unsigned short material;
byte climbable;
char pad00[0x4];
};
struct surfacedata_t
{
surfacephysicsparams_t physics;
surfaceaudioparams_t audio;
surfacesoundnames_t sounds;
surfacegameprops_t game;
};
class IPhysicsSurfaceProps
{
public:
surfacedata_t * GetSurfaceData (int surfaceDataIndex)
{
typedef surfacedata_t*(__thiscall* fnGetSurfaceData)(void*, int);
return call_vfunc<fnGetSurfaceData>(this, 5)(this, surfaceDataIndex);
}
};
class ConVar
{
public:
void SetValue(const char *value);
void SetValue(float value);
void SetValue(int value);
void SetValue(Color value);
void InternalSetString(const char* str);
char* GetName();
char* GetDefault();
float GetFloat(void) const;
int GetInt (void) const;
Color GetColor(void) const;
const char* GetString(void) const;
char pad_0x0000[0x4]; //0x0000
ConVar* pNext; //0x0004
__int32 bRegistered; //0x0008
char* pszName; //0x000C
char* pszHelpString; //0x0010
__int32 nFlags; //0x0014
char pad_0x0018[0x4]; //0x0018
ConVar* pParent; //0x001C
char* pszDefaultValue; //0x0020
char* strString; //0x0024
__int32 StringLength; //0x0028
float fValue; //0x002C
__int32 nValue; //0x0030
__int32 bHasMin; // 0x0034
float fMinVal; //0x0038
__int32 bHasMax; // 0x003C
float fMaxVal; //0x0040
void* fnChangeCallback; //0x0044
};//Size=0x0048
class SpoofedConvar {
public:
SpoofedConvar();
SpoofedConvar(const char* szCVar);
SpoofedConvar(ConVar* pCVar);
~SpoofedConvar();
bool IsSpoofed();
void Spoof();
void SetFlags(int flags);
int GetFlags();
void SetBool(bool bValue);
void SetInt(int iValue);
void SetFloat(float flValue);
void SetString(const char* szValue);
private:
ConVar* m_pOriginalCVar = NULL;
ConVar* m_pDummyCVar = NULL;
char m_szDummyName[128];
char m_szDummyValue[128];
char m_szOriginalName[128];
char m_szOriginalValue[128];
int m_iOriginalFlags;
};
class MinspecCvar
{
public:
MinspecCvar(const char* szCVar, char* newname, float newvalue);
~ MinspecCvar ();
bool ValidCvar();
void Spoof();
template<typename T>
void SetValue(T value);
int GetInt ();
float GetFloat();
const char* GetString();
private:
ConVar* m_pConVar;
char* m_szOriginalName;
char* m_szReplacementName;
float m_OriginalValue;
float m_newvalue;
};
class IAppSystem
{
public:
virtual ~IAppSystem()
{
}
virtual void func0() = 0;
virtual void func1() = 0;
virtual void func2() = 0;
virtual void func3() = 0;
virtual void func4() = 0;
virtual void func5() = 0;
virtual void func6() = 0;
virtual void func7() = 0;
virtual void func8() = 0;
virtual void func9() = 0;
};
struct CVarDLLIdentifier_t;
class ICVar : public IAppSystem
{
public:
virtual void func10() = 0;
virtual void RegisterConCommand(ConVar *pCommandBase) = 0;
virtual void UnregisterConCommand(ConVar *pCommandBase) = 0;
virtual void func13() = 0;
virtual ConVar * FindVar (const char * var_name) = 0;
// virtual void ConsoleColorPrintf(const Color& clr, const char *pFormat, ...) const = 0;
virtual void func15() = 0;
virtual void func16() = 0;
virtual void func17() = 0;
virtual void func18() = 0;
virtual void func19() = 0;
virtual void func20() = 0;
void const ConsoleColorPrintf(const Color& clr, const char *pFormat, ...)
{
typedef void(__cdecl *OriginalFn)(void*, const Color&, const char *, ...);
if (pFormat == nullptr)
return;
tank buf [8192];
va_list list;
va_start(list, pFormat);
_vsnprintf_s(buf, sizeof(buf) - 1, pFormat, list);
va_end(list);
buf[sizeof(buf) - 1] = 0;
call_vfunc<OriginalFn>(this, 25)(this, clr, buf, list);
}
};
class CTraceFilterNoPlayer : public CTraceFilter
{
public:
CTraceFilterNoPlayer() {}
virtual bool ShouldHitEntity(IClientEntity *pServerEntity, int contentsMask)
{
if (pServerEntity)
return !pServerEntity->IsPlayer();
return false;
}
};
Код:
#pragma once
#include "MiscDefinitions.h"
#include "ClientRecvProps.h"
#include "offsets.h"
#include "Vector.h"
#define TEAM_CS_T 2
#define TEAM_CS_CT 3
#define BONE_USED_BY_HITBOX 0x00000100
#define ptr( x, x1, x2 ) *(x*)( (DWORD)x1 + (DWORD)x2 )
class IClientRenderable;
class IClientNetworkable;
class IClientUnknown;
class IClientThinkable;
class IClientEntity;
class CSWeaponInfo;
class CSWeaponInfo
{
public:
void* pVTable;
char* pWeaponnamefordropinconsolepName; //0x0008
__int32 _pad0 [3];
__int32 iMaxClip1; //0x0014
__int32 iMaxClip2; //0x0018
__int32 iDefaultClip1; //0x001C
__int32 iDefaultClip2; //0x0020
char _0x0024[8];
char* pWorldModel; //0x002C
char* pViewModel; //0x0030
char* pDroppedWorldModel; //0x0034
char _0x0038[80];
char* pAnimationPrefix; //0x0088
char* pPrintName2; //0x008C
char _0x0090[56];
__int32 iWeaponType; //0x00C8
__int32 iWeaponPrice; //0x00CC
__int32 iKillAward; //0x00D0
char* pPrintname; //0x00D4
char _0x00D8[16];
BYTE bFullAuto; //0x00E8
char _0x00E9[3];
__int32 m_iDamage; //0x00EC
float m_flArmorRatio; //0x00F0
char _0x00F4[4];
float m_flPenetration; //0x00F8
char _0x00FC[8];
float m_flRange; //0x0104
float m_flRangeModifier; //0x0108
char _0x010C[28];
__int32 iTeamNum; //0x0128
float flMaxSpeed; //0x012C
float flMaxSpeed2; //0x0130
char _0x0134[136];
__int32 iZoomLevels; //0x01BC
__int32 iZoomFOV[2]; //0x01C0
float flZoomTime[3]; //0x01C8
char _0x01D4[52];
char* pZoomInSound; //0x0208
char* pZoomOutSound; //0x020C
char _0x0210[24];
BYTE bHasBurstmode; //0x0228
BYTE bIsRevolver; //0x0229
char _0x022A[22];
};//Size=0x240
enum class CSGOClassID
{
CAK47 = 1,
CBaseAnimating = 2,
CBaseAnimatingOverlay = 3,
CBaseAttributableItem = 4,
CBaseButton = 5,
CBaseCombatCharacter = 6,
CBaseCombatWeapon = 7,
CBaseCSGrenade = 8,
CBaseCSGrenadeProjectile = 9,
CBaseDoor = 10,
CBaseEntity = 11,
CBaseFlex = 12,
CBaseGrenade = 13,
CBaseParticleEntity = 14,
CBasePlayer = 15,
CBasePropDoor = 16,
CBaseTeamObjectiveResource = 17,
CBaseTempEntity = 18,
CBaseToggle = 19,
CBaseTrigger = 20,
CBaseViewModel = 21,
CBaseVPhysicsTrigger = 22,
CBaseWeaponWorldModel = 23,
CBeam = 24,
CBeamSpotlight = 25,
CBoneFollower = 26,
CBreakableProp = 27,
CBreakableSurface = 28,
CC4 = 29,
CCascadeLight = 30,
CChicken = 31,
CColorCorrection = 32,
CColorCorrectionVolume = 33,
CCSGameRulesProxy = 34,
CCSPlayer = 35,
CCSPlayerResource = 36,
CCSRagdoll = 37,
CCSTeam = 38,
CDEagle = 39,
CDecoyGrenade = 40,
CDecoyProjectile = 41,
CDynamicLight = 42,
CDynamicProp = 43,
CEconEntity = 44,
CEconWearable = 45,
CEmbers = 46,
CEntityDissolve = 47,
CEntityFlame = 48,
CEntityFreezing = 49,
CEntityParticleTrail = 50,
CEnvAmbientLight = 51,
CEnvDetailController = 52,
CEnvDOFController = 53,
CEnvParticleScript = 54,
CEnvProjectedTexture = 55,
CEnvQuadraticBeam = 56,
CEnvScreenEffect = 57,
CEnvScreenOverlay = 58,
CEnvTonemapController = 59,
CEnvWind = 60,
CFEPlayerDecal = 61,
CFireCrackerBlast = 62,
CFireSmoke = 63,
CFireTrail = 64,
CFish = 65,
CFlashbang = 66,
CFogController = 67,
CFootstepControl = 68,
CFunc_Dust = 69,
CFunc_LOD = 70,
CFuncAreaPortalWindow = 71,
CFuncBrush = 72,
CFuncConveyor = 73,
CFuncLadder = 74,
CFuncMonitor = 75,
CFuncMoveLinear = 76,
CFuncOccluder = 77,
CFuncReflectiveGlass = 78,
CFuncRotating = 79,
CFuncSmokeVolume = 80,
CFuncTrackTrain = 81,
CGameRulesProxy = 82,
CHandleTest = 83,
CHEGrenade = 84,
CHostage = 85,
CHostageCarriableProp = 86,
CIncendiaryGrenade = 87,
CInferno = 88,
CInfoLadderDismount = 89,
CInfoOverlayAccessor = 90,
CItem_Healthshot = 91,
CItemDogtags = 92,
CKnife = 93,
CKnifeGG = 94,
CLightGlow = 95,
CMaterialModifyControl = 96,
CMolotovGrenade = 97,
CMolotovProjectile = 98,
CMovieDisplay = 99,
CParticleFire = 100,
CParticlePerformanceMonitor = 101,
CParticleSystem = 102,
CPhysBox = 103,
CPhysBoxMultiplayer = 104,
CPhysicsProp = 105,
CPhysicsPropMultiplayer = 106,
CPhysMagnet = 107,
CPlantedC4 = 108,
CPlasma = 109,
CPlayerResource = 110,
CPointCamera = 111,
CPointCommentaryNode = 112,
CPointWorldText = 113,
CPoseController = 114,
CPostProcessController = 115,
CPrecipitation = 116,
CPrecipitationBlocker = 117,
CPredictedViewModel = 118,
CProp_Hallucination = 119,
CPropDoorRotating = 120,
CPropJeep = 121,
CPropVehicleDriveable = 122,
CRagdollManager = 123,
CRagdollProp = 124,
CRagdollPropAttached = 125,
CRopeKeyframe = 126,
CSCAR17 = 127,
CSceneEntity = 128,
CSensorGrenade = 129,
CSensorGrenadeProjectile = 130,
CShadowControl = 131,
CSlideshowDisplay = 132,
CSmokeGrenade = 133,
CSmokeGrenadeProjectile = 134,
CSmokeStack = 135,
CSpatialEntity = 136,
CSpotlightEnd = 137,
CSprite = 138,
CSpriteOriented = 139,
CSpriteTrail = 140,
CStatueProp = 141,
CSteamJet = 142,
CSun = 143,
CSunlightShadowControl = 144,
CTeam = 145,
CTeamplayRoundBasedRulesProxy = 146,
CTEArmorRicochet = 147,
CTEBaseBeam = 148,
CTEBeamEntPoint = 149,
CTEBeamEnts = 150,
CTEBeamFollow = 151,
CTEBeamLaser = 152,
CTEBeamPoints = 153,
CTEBeamRing = 154,
CTEBeamRingPoint = 155,
CTEBeamSpline = 156,
CTEBloodSprite = 157,
CTEBloodStream = 158,
CTEBreakModel = 159,
CTEBSPDecal = 160,
CTEBubbles = 161,
CTEBubbleTrail = 162,
CTEClientProjectile = 163,
CTEDecal = 164,
CTEDust = 165,
CTEDynamicLight = 166,
CTEEffectDispatch = 167,
CTEEnergySplash = 168,
CTEExplosion = 169,
CTEFireBullets = 170,
CTEFizz = 171,
CTEFootprintDecal = 172,
CTEFoundryHelpers = 173,
CTEGaussExplosion = 174,
CTEGlowSprite = 175,
CTEImpact = 176,
CTEKillPlayerAttachments = 177,
CTELargeFunnel = 178,
CTEMetalSparks = 179,
CTEMuzzleFlash = 180,
CTEParticleSystem = 181,
CTEPhysicsProp = 182,
CTEPlantBomb = 183,
CTEPlayerAnimEvent = 184,
CTEPlayerDecal = 185,
CTEProjectedDecal = 186,
CTERadioIcon = 187,
CTEShatterSurface = 188,
CTEShowLine = 189,
CTesla = 190,
CTESmoke = 191,
CTESparks = 192,
CTESprite = 193,
CTESpriteSpray = 194,
CTest_ProxyToggle_Networkable = 194,
CTestTraceline = 196,
CTEWorldDecal = 197,
CTriggerPlayerMovement = 198,
CTriggerSoundOperator = 199,
CVGuiScreen = 200,
CVoteController = 201,
CWaterBullet = 202,
CWaterLODControl = 203,
CWeaponAug = 204,
CWeaponAWP = 205,
CWeaponBaseItem = 206,
CWeaponBizon = 207,
CWeaponCSBase = 208,
CWeaponCSBaseGun = 209,
CWeaponCycler = 210,
CWeaponElite = 211,
CWeaponFamas = 212,
CWeaponFiveSeven = 213,
CWeaponG3SG1 = 214,
CWeaponGalil = 215,
CWeaponGalilAR = 216,
CWeaponGlock = 217,
CWeaponHKP2000 = 218,
CWeaponM249 = 219,
CWeaponM3 = 220,
CWeaponM4A1 = 221,
CWeaponMAC10 = 222,
CWeaponMag7 = 223,
CWeaponMP5Navy = 224,
CWeaponMP7 = 225,
CWeaponMP9 = 226,
CWeaponNegev = 227,
CWeaponNOVA = 228,
CWeaponP228 = 229,
CWeaponP250 = 230,
CWeaponP90 = 231,
CWeaponSawedoff = 232,
CWeaponSCAR20 = 233,
CWeaponScout = 234,
CWeaponSG550 = 235,
CWeaponSG552 = 236,
CWeaponSG556 = 237,
CWeaponSSG08 = 238,
CWeaponTaser = 239,
CWeaponTec9 = 240,
CWeaponTMP = 241,
CWeaponUMP45 = 242,
CWeaponUSP = 243,
CWeaponXM1014 = 244,
CWorld = 245,
DustTrail = 246,
MovieExplosion = 247,
ParticleSmokeGrenade = 248,
RocketTrail = 249,
SmokeTrail = 250,
SporeExplosion = 251,
SporeTrail = 252
};
enum CSWeaponType
{
WEAPONTYPE_KNIFE = 0,
WEAPONTYPE_PISTOL,
WEAPONTYPE_SUBMACHINEGUN,
WEAPONTYPE_RIFLE,
WEAPONTYPE_SHOTGUN,
WEAPONTYPE_SNIPER_RIFLE,
WEAPONTYPE_MACHINEGUN,
WEAPONTYPE_C4,
WEAPONTYPE_GRENADE,
WEAPONTYPE_UNKNOWN
};
enum moveTypes
{
MOVETYPE_NONE = 0, // never moves
MOVETYPE_ISOMETRIC, // For players -- in TF2 commander view, etc.
MOVETYPE_WALK, // Player only - moving on the ground
MOVETYPE_STEP, // gravity, special edge handling -- monsters use this
MOVETYPE_FLY, // No gravity, but still collides with stuff
MOVETYPE_FLYGRAVITY, // flies through the air + is affected by gravity
MOVETYPE_VPHYSICS, // uses VPHYSICS for simulation
MOVETYPE_PUSH, // no clip to world, push and crush
MOVETYPE_NOCLIP, // No gravity, no collisions, still do velocity/avelocity
MOVETYPE_LADDER, // Used by players only when going onto a ladder
MOVETYPE_OBSERVER, // Observer movement, depends on player's observer mode
MOVETYPE_CUSTOM, // Allows the entity to describe its own physics
MOVETYPE_LAST = MOVETYPE_CUSTOM, // should always be defined as the last item in the list
MOVETYPE_MAX_BITS = 4
};
enum class CSGOHitboxID
{
Head = 0,
Neck,
NeckLower,
Pelvis,
Stomach,
LowerChest,
Chest,
UpperChest,
RightThigh,
LeftThigh,
RightShin,
LeftShin,
RightFoot,
LeftFoot,
RightHand,
LeftHand,
RightUpperArm,
RightLowerArm,
LeftUpperArm,
LeftLowerArm,
Max,
};
enum ItemDefinitionIndex : int
{
WEAPON_DEAGLE = 1,
WEAPON_ELITE = 2,
WEAPON_FIVESEVEN = 3,
WEAPON_GLOCK = 4,
WEAPON_AK47 = 7,
WEAPON_AUG = 8,
WEAPON_AWP = 9,
WEAPON_FAMAS = 10,
WEAPON_G3SG1 = 11,
WEAPON_GALILAR = 13,
WEAPON_M249 = 14,
WEAPON_M4A1 = 16,
WEAPON_MAC10 = 17,
WEAPON_P90 = 19,
WEAPON_UMP45 = 24,
WEAPON_XM1014 = 25,
WEAPON_BIZON = 26,
WEAPON_MAG7 = 27,
WEAPON_NEGEV = 28,
WEAPON_SAWEDOFF = 29,
WEAPON_TEC9 = 30,
WEAPON_TASER = 31,
WEAPON_HKP2000 = 32,
WEAPON_MP7 = 33,
WEAPON_MP9 = 34,
WEAPON_NOVA = 35,
WEAPON_P250 = 36,
WEAPON_SCAR20 = 38,
WEAPON_SG556 = 39,
WEAPON_SSG08 = 40,
WEAPON_KNIFE_CT = 42,
WEAPON_FLASHBANG = 43,
WEAPON_HEGRENADE = 44,
WEAPON_SMOKEGRENADE = 45,
WEAPON_MOLOTOV = 46,
WEAPON_DECOY = 47,
WEAPON_INCGRENADE = 48,
WEAPON_C4 = 49,
WEAPON_KNIFE_T = 59,
WEAPON_M4A1_SILENCER = 60,
WEAPON_USP_SILENCER = 61,
WEAPON_CZ75A = 63,
WEAPON_REVOLVER = 64,
WEAPON_KNIFE_BAYONET = 500,
WEAPON_KNIFE_FLIP = 505,
WEAPON_KNIFE_GUT = 506,
WEAPON_KNIFE_KARAMBIT = 507,
WEAPON_KNIFE_M9_BAYONET = 508,
WEAPON_KNIFE_TACTICAL = 509,
WEAPON_KNIFE_FALCHION = 512,
WEAPON_KNIFE_BOWIE = 514,
WEAPON_KNIFE_BUTTERFLY = 515,
WEAPON_KNIFE_PUSH = 516
};
class ScriptCreatedItem
{
public:
CPNETVAR_FUNC(int*, ItemDefinitionIndex, 0xE67AB3B8); //m_iItemDefinitionIndex
CPNETVAR_FUNC(int*, ItemIDHigh, 0x714778A); //m_iItemIDHigh
CPNETVAR_FUNC(int*, ItemIDLow, 0x3A3DFC74); //m_iItemIDLow
CPNETVAR_FUNC(int*, AccountID, 0x24abbea8); //m_iAccountID
};
class AttributeContainer
{
public:
CPNETVAR_FUNC(ScriptCreatedItem*, m_Item, 0x7E029CE5);
};
class CBaseCombatWeapon
{
public:
CNETVAR_FUNC(float, GetNextPrimaryAttack, 0xDB7B106E); //m_flNextPrimaryAttack
CNETVAR_FUNC(int, GetAmmoInClip, 0x97B6F70C); //m_iClip1
CNETVAR_FUNC(HANDLE, GetOwnerHandle, 0xC32DF98D); //m_hOwner
CNETVAR_FUNC(float, GetAccuracyPenalty, 0xE2958A63); //m_fAccuracyPenalty
CNETVAR_FUNC(Vector, GetOrigin, 0x1231CE10); //m_vecOrigin
CPNETVAR_FUNC(int*, FallbackPaintKit, 0xADE4C870); // m_nFallbackPaintKit
CPNETVAR_FUNC(int*, FallbackSeed, 0xC2D0683D); // m_nFallbackSeed
CPNETVAR_FUNC(float*, FallbackWear, 0xA263576C); //m_flFallbackWear
CPNETVAR_FUNC(int*, FallbackStatTrak, 0x1ED78768); //m_nFallbackStatTrak
CPNETVAR_FUNC(int*, OwnerXuidLow, 0xAD8D897F);
CPNETVAR_FUNC(int*, OwnerXuidHigh, 0x90511E77);
CPNETVAR_FUNC(int*, ViewModelIndex, 0x7F7C89C1);
CPNETVAR_FUNC(int*, ModelIndex, 0x27016F83);
CPNETVAR_FUNC(int*, WorldModelIndex, 0x4D8AD9F3);
CPNETVAR_FUNC(char*, szCustomName, 0x0);
CPNETVAR_FUNC(AttributeContainer*, m_AttributeManager, 0xCFFCE089);
CNETVAR_FUNC(int, GetZoomLevel, 0x26553F1A);
float GetInaccuracy()
{
typedef float(__thiscall* oInaccuracy)(PVOID);
return call_vfunc< oInaccuracy >(this, 469)(this);
}
float GetSpread()
{ return call_vfunc<float(__thiscall*)(void*)>(this, 439)(this); }
int* GetEntityQuality()
{
return (int*)((DWORD)this + 0x2D70 + 0x40 + 0x1DC);
}
int GetWeaponID2()
{
return *(int*)((DWORD)this + 0x00002F88);
}
void PreDataUpdate(int updateType)
{
PVOID pNetworkable = (PVOID)((DWORD)(this) + 0x8);
typedef void(__thiscall* OriginalFn)(PVOID, int);
return call_vfunc<OriginalFn>(pNetworkable, 6)(pNetworkable, updateType);
}
void SetModelIndex(int modelIndex) {
typedef void(__thiscall* OriginalFn)(PVOID, int);
return call_vfunc<OriginalFn>(this, 75)(this, modelIndex);
}
void UpdateAccPenalty()
{
typedef void(__thiscall *OrigFn)(void *);
return call_vfunc<OrigFn>(this, 470)(this);
}
bool IsScoped(int x = 0)
{
return GetZoomLevel() > 0;
}
CSWeaponInfo* GetCSWpnData()
{
if (!this)
return nullptr;
typedef CSWeaponInfo*(__thiscall* OriginalFn)(void*);
return call_vfunc<OriginalFn >(this, 446)(this);
}
};
class CCSBomb
{
public:
CNETVAR_FUNC(HANDLE, GetOwnerHandle, 0xC32DF98D); //m_hOwner 0x29BC
CNETVAR_FUNC(float, GetC4BlowTime, 0xB5E0CA1C); //m_flC4Blow
CNETVAR_FUNC(float, GetC4DefuseCountDown, 0x2994); //m_flDefuseCountDown 0x2994
};
class CLocalPlayerExclusive
{
public:
CNETVAR_FUNC(Vector, GetViewPunchAngle, 0x68F014C0);//m_viewPunchAngle
CNETVAR_FUNC(Vector, GetAimPunchAngle, 0xBF25C290);//m_aimPunchAngle
CNETVAR_FUNC(Vector, GetAimPunchAngleVel, 0x8425E045);//m_aimPunchAngleVel
};
class CollisionProperty
{
public:
CNETVAR_FUNC(Vector, GetMins, 0xF6F78BAB);//m_vecMins
CNETVAR_FUNC(Vector, GetMaxs, 0xE47C6FC4);//m_vecMaxs
CNETVAR_FUNC(unsigned char, GetSolidType, 0xB86722A1);//m_nSolidType
CNETVAR_FUNC(unsigned short, GetSolidFlags, 0x63BB24C1);//m_usSolidFlags
CNETVAR_FUNC(int, GetSurroundsType, 0xB677A0BB); //m_nSurroundType
bool IsSolid()
{
return (GetSolidType() != SOLID_NONE) && ((GetSolidFlags() & FSOLID_NOT_SOLID) == 0);
}
};
class IClientRenderable
{
public:
//virtual void* GetIClientUnknown() = 0;
virtual Vector const& GetRenderOrigin(void) = 0;
virtual Vector const& GetRenderAngles(void) = 0;
virtual bool ShouldDraw(void) = 0;
virtual bool IsTransparent(void) = 0;
virtual bool UsesPowerOfTwoFrameBufferTexture() = 0;
virtual bool UsesFullFrameBufferTexture() = 0;
virtual void GetShadowHandle() const = 0;
virtual void* RenderHandle() = 0;
virtual const model_t* GetModel() const = 0;
virtual int DrawModel(int flags) = 0;
virtual int GetBody() = 0;
virtual void ComputeFxBlend() = 0;
bool SetupBones(matrix3x4 *pBoneToWorldOut, int nMaxBones, int boneMask, float currentTime)
{
typedef bool(__thiscall* oSetupBones)(PVOID, matrix3x4*, int, int, float);
return call_vfunc< oSetupBones>(this, 13)(this, pBoneToWorldOut, nMaxBones, boneMask, currentTime);
}
};
class IClientNetworkable
{
public:
virtual IClientUnknown* GetIClientUnknown() = 0;
virtual void Release() = 0;
virtual ClientClass* GetClientClass() = 0;// FOR NETVARS FIND YOURSELF ClientClass* stuffs
virtual void NotifyShouldTransmit( /* ShouldTransmitState_t state*/) = 0;
virtual void OnPreDataChanged( /*DataUpdateType_t updateType*/) = 0;
virtual void OnDataChanged( /*DataUpdateType_t updateType*/) = 0;
virtual void PreDataUpdate( /*DataUpdateType_t updateType*/) = 0;
virtual void PostDataUpdate( /*DataUpdateType_t updateType*/) = 0;
virtual void unknown();
virtual bool IsDormant(void) = 0;
virtual int GetIndex(void) const = 0;
virtual void ReceiveMessage(int classID /*, bf_read &msg*/) = 0;
virtual void* GetDataTableBasePtr() = 0;
virtual void SetDestroyedOnRecreateEntities(void) = 0;
};
class IClientUnknown
{
public:
virtual void* GetCollideable() = 0;
virtual IClientNetworkable* GetClientNetworkable() = 0;
virtual IClientRenderable* GetClientRenderable() = 0;
virtual IClientEntity* GetIClientEntity() = 0;
virtual IClientEntity* GetBaseEntity() = 0;
virtual IClientThinkable* GetClientThinkable() = 0;
};
class IClientThinkable
{
public:
virtual IClientUnknown* GetIClientUnknown() = 0;
virtual void ClientThink() = 0;
virtual void* GetThinkHandle() = 0;
virtual void SetThinkHandle(void* hThink) = 0;
virtual void Release() = 0;
};
class __declspec (novtable)IClientEntity : public IClientUnknown, public IClientRenderable, public IClientNetworkable, public IClientThinkable
{
public:
public:
virtual void Release(void) = 0;
virtual void blahblahpad(void) = 0;
virtual Vector& GetAbsOrigin(void) const = 0;//in broken place use GetOrigin Below
virtual const Vector& GetAbsAngles(void) const = 0;
int GetGlowIndex()
{
return *(int*)(this + 0xA310);
}
CPNETVAR_FUNC(CLocalPlayerExclusive*, localPlayerExclusive, 0x7177BC3E);// m_Local
CPNETVAR_FUNC(CollisionProperty*, collisionProperty, 0xE477CBD0);//m_Collision
CNETVAR_FUNC(float, GetLowerBodyYaw, 0xE6996CCF); //m_flLowerBodyYawTarget
CNETVAR_FUNC(int, GetFlags, 0xE456D580); //m_fFlags
CNETVAR_FUNC(int, GetAmmoInClip, 0x97B6F70C); //m_iClip
CNETVAR_FUNC(float, GetTargetYaw, 0xE6996CCF);
CNETVAR_FUNC(Vector, GetOrigin, 0x1231CE10); //m_vecOrigin 0x0134
CNETVAR_FUNC(Vector, GetRotation, 0x6BEA197A); //m_angRotation
CNETVAR_FUNC(int, GetTeamNum, 0xC08B6C6E); //m_iTeamNum
CNETVAR_FUNC(int*, GetPointerFlags, 0xE456D580); //m_fFlags
CNETVAR_FUNC(HANDLE, GetOwnerHandle, 0xC32DF98D); //m_hOwner
CNETVAR_FUNC(int, GetMaxHealth, 0xC52E1C28); //m_iMaxHealth
CNETVAR_FUNC(int, GetHealth, 0xA93054E3); //m_iHealth
CNETVAR_FUNC(bool, IsDefusing, 0xA2C14106); //m_bIsDefusing
CNETVAR_FUNC(float, GetFlashDuration, 0x4B5938D5); //m_flFlashDuration
CNETVAR_FUNC(float , GetFlashAlpha, 0xFE79FB98); //m_flFlashMaxAlpha
CNETVAR_FUNC(unsigned char, GetLifeState, 0xD795CCFC); //m_lifeState
CNETVAR_FUNC(HANDLE, GetActiveWeaponHandle, 0xB4FECDA3); //m_hActiveWeapon
CNETVAR_FUNC(int, GetTickBase, 0xD472B079); //m_nTickBase
CNETVAR_FUNC(Vector, GetViewOffset, 0xA9F74931); //m_vecViewOffset[0]
CNETVAR_FUNC(Vector, GetViewPunch, 0x68F014C0);
CNETVAR_FUNC(int, GetMoney, 0xF4B3E183); //m_iAccount
CNETVAR_FUNC(Vector, GetPunch, 0xBF25C290);
CNETVAR_FUNC(Vector, GetVelocity, 0x40C1CA24); //m_vecVelocity[0]
CNETVAR_FUNC(bool, HasGunGameImmunity, 0x6AD6FA0D); //m_bGunGameImmunity
CNETVAR_FUNC(int, ArmorValue, 0x3898634); //m_ArmorValue
CNETVAR_FUNC(bool, HasHelmet, 0x7B97F18A); //m_bHasHelmet
CNETVAR_FUNC(int, GetObserverMode, 0x2441D093); // m_iObserverMode
CNETVAR_FUNC(HANDLE, GetObserverTargetHandle, 0x8660FD83); //m_hObserverTarget
CNETVAR_FUNC(bool, HasDefuser, 0x32D0F325); //m_bHasDefuser
CNETVAR_FUNC(int, GetShotsFired, 0x3F2F6C66); //m_nTickBase
CNETVAR_FUNC(float, GetSimulationTime, 0xC4560E44); //m_flSimulationTime
CNETVAR_FUNC(float, GetAnimTime, 0xD27E8416);
CNETVAR_FUNC(bool, IsScoped, 0x61B9C22C); //m_bIsScoped
bool IsAlive()
{
return (GetLifeState() == LIFE_ALIVE && GetHealth() > 0);
}
int GetMoveType()
{
if (!this)
return 0;
return ptr(int, this, 0x258);
}
QAngle* GetEyeAnglesPointer()
{
return reinterpret_cast<QAngle*>((DWORD)this + (DWORD)0x528C);
}
QAngle GetEyeAngles()
{
return *reinterpret_cast<QAngle*>((DWORD)this + (DWORD)0x528C);
}
QAngle* GetEyeAnglesXY()
{
return (QAngle*)((DWORD)this + GET_NETVAR("DT_CSPlayer", "m_angEyeAngles"));
}
Vector GetBonePos(int i)
{
matrix3x4 boneMatrix[128];
if (this->SetupBones(boneMatrix, 128, BONE_USED_BY_HITBOX, GetTickCount64()))
{
return Vector(boneMatrix[i][0][3], boneMatrix[i][1][3], boneMatrix[i][2][3]);
}
return Vector(0, 0, 0);
}
Vector GetHeadPos()
{
return this->GetBonePos(8);
}
Vector GetHeadAngle()
{
return GetAbsOrigin() + GetViewOffset();
}
int GetId()
{
typedef int(__thiscall* tGetId)(void*);
return call_vfunc<tGetId>(this, 458)(this);
}
bool IsPlayer()
{
return GetClientClass()->m_ClassID == (int)CSGOClassID::CCSPlayer;
}
Vector GetOrigin2() {
return *(Vector*)((DWORD)this + 0x00000134);
}
Vector GetViewAngles2() {
return *(Vector*)((DWORD)this + 0x00000104);
}
Vector GetAbsOrigin2() {
__asm {
MOV ECX, this
MOV EAX, DWORD PTR DS : [ECX]
CALL DWORD PTR DS : [EAX + 0x28]
}
}
Vector GetAbsAngles2() {
__asm {
MOV ECX, this;
MOV EAX, DWORD PTR DS : [ECX];
CALL DWORD PTR DS : [EAX + 0x2C]
}
}
Vector GetEyePosition() {
Vector Origin = *(Vector*)((DWORD)this + 0x00000134);
Vector View = *(Vector*)((DWORD)this + 0x00000104);
return(Origin + View);
}
Vector GetAimPunch() {
return *(Vector*)((DWORD)this + 0x00003018);
}
bool IsImmune() {
return *(bool*)((DWORD)this + 0x000038A0);
}
ClientClass *GetClientClass2() {
PVOID Networkable = (PVOID)((DWORD)(this) + 0x8);
using Original = ClientClass*(__thiscall*)(PVOID);
return call_vfunc<Original>(Networkable, 2)(Networkable);
}
HANDLE GetWeaponHandle() {
return *(HANDLE*)((DWORD)this + 0x00002EE8);
}
char* IClientEntity::GetpWeaponName()
{
if (!this)
return "";
int id = ItemDefinitionIndex();
switch (id) {
case WEAPON_DEAGLE:
return ("Deagle");
case WEAPON_ELITE:
return ("Dual Berettas");
case WEAPON_FIVESEVEN:
return ("Five-SeveN");
case WEAPON_GLOCK:
return ("Glock-18");
case WEAPON_AK47:
return ("AK-47");
case WEAPON_AUG:
return ("AUG");
case WEAPON_REVOLVER:
return ("Revolver");
case WEAPON_AWP:
return ("AWP");
case WEAPON_FAMAS:
return ("FAMAS");
case WEAPON_G3SG1:
return ("G3SG1");
case WEAPON_GALILAR:
return ("Galil");
case WEAPON_M249:
return ("M249");
case WEAPON_M4A1:
return ("M4A1");
case WEAPON_MAC10:
return ("MAC-10");
case WEAPON_P90:
return ("P90");
case WEAPON_UMP45:
return ("UMP-45");
case WEAPON_XM1014:
return ("XM1014");
case WEAPON_BIZON:
return ("PP-Bizon");
case WEAPON_MAG7:
return ("MAG-7");
case WEAPON_NEGEV:
return ("Negev");
case WEAPON_SAWEDOFF:
return ("Sawed-Off");
case WEAPON_TEC9:
return ("Tec-9");
case WEAPON_TASER:
return ("Taser");
case WEAPON_HKP2000:
return ("HKP2000");
case WEAPON_MP7:
return ("MP7");
case WEAPON_MP9:
return ("MP9");
case WEAPON_NOVA:
return ("Nova");
case WEAPON_P250:
return ("P250");
case WEAPON_SCAR20:
return ("SCAR-20");
case WEAPON_SG556:
return ("SG 553");
case WEAPON_SSG08:
return ("SSG 08");
case WEAPONTYPE_KNIFE:
return ("Knife");
case WEAPON_FLASHBANG:
return ("Flashbang");
case WEAPON_HEGRENADE:
return ("HE Grenade");
case WEAPON_SMOKEGRENADE:
return ("Smoke");
case WEAPON_MOLOTOV:
return ("Molotov");
case WEAPON_DECOY:
return ("Decoy");
case WEAPON_INCGRENADE:
return ("Incendiary");
case WEAPON_C4:
return ("C4");
case WEAPON_M4A1_SILENCER:
return ("M4A1-S");
case WEAPON_USP_SILENCER:
return ("HKP2000");
case WEAPON_CZ75A:
return ("CZ75-Auto");
default:
return ("Knife");
}
return "";
}
char* IClientEntity::GetGunIcon()
{
int WeaponId = ItemDefinitionIndex();
switch (WeaponId)
{
case WEAPONTYPE_KNIFE:
case WEAPON_KNIFE_BAYONET:
case WEAPON_KNIFE_BOWIE:
case WEAPON_KNIFE_BUTTERFLY:
case WEAPON_KNIFE_CT:
case WEAPON_KNIFE_FALCHION:
case WEAPON_KNIFE_FLIP:
case WEAPON_KNIFE_GUT:
case WEAPON_KNIFE_KARAMBIT:
case WEAPON_KNIFE_M9_BAYONET:
case WEAPON_KNIFE_T:
case WEAPON_KNIFE_TACTICAL:
case WEAPON_KNIFE_PUSH:
return "]";
case WEAPON_DEAGLE:
return "A";
case WEAPON_ELITE:
return "B";
case WEAPON_FIVESEVEN:
return "C";
case WEAPON_GLOCK:
return "D";
case WEAPON_HKP2000:
return "E";
case WEAPON_P250:
return "F";
case WEAPON_USP_SILENCER:
return "G";
case WEAPON_TEC9:
return "H";
case WEAPON_REVOLVER:
return "J";
case WEAPON_MAC10:
return "K";
case WEAPON_UMP45:
return "L";
case WEAPON_BIZON:
return "M";
case WEAPON_MP7:
return "N";
case WEAPON_MP9:
return "O";
case WEAPON_P90:
return "P";
case WEAPON_GALILAR:
return "Q";
case WEAPON_FAMAS:
return "R";
case WEAPON_M4A1_SILENCER:
return "S";
case WEAPON_M4A1:
return "T";
case WEAPON_AUG:
return "U";
case WEAPON_SG556:
return "V";
case WEAPON_AK47:
return "W";
case WEAPON_G3SG1:
return "X";
case WEAPON_SCAR20:
return "Y";
case WEAPON_AWP:
return "Z";
case WEAPON_SSG08:
return "a";
case WEAPON_XM1014:
return "b";
case WEAPON_SAWEDOFF:
return "c";
case WEAPON_MAG7:
return "d";
case WEAPON_NOVA:
return "e";
case WEAPON_NEGEV:
return "f";
case WEAPON_M249:
return "g";
case WEAPON_TASER:
return "h";
case WEAPON_FLASHBANG:
return "i";
case WEAPON_HEGRENADE:
return "j";
case WEAPON_SMOKEGRENADE:
return "k";
case WEAPON_MOLOTOV:
return "l";
case WEAPON_DECOY:
return "m";
case WEAPON_INCGRENADE:
return "n";
case WEAPON_C4:
return "o";
case WEAPON_CZ75A:
return "I";
default:
return " ";
}
}
};
class CBaseViewModel : public IClientUnknown, public IClientRenderable, public IClientNetworkable
{
public:
inline int GetModelIndex() {
// DT_BaseViewModel -> m_nModelIndex
return *(int*)((DWORD)this + 0x254);
}
inline DWORD GetOwner() {
// DT_BaseViewModel -> m_hOwner
return *(PDWORD)((DWORD)this + 0x29BC);
}
inline DWORD GetWeapon() {
// DT_BaseViewModel -> m_hWeapon
return *(PDWORD)((DWORD)this + 0x29B8);
}
inline void SetWeaponModel(const char* Filename, IClientUnknown* Weapon) {
return call_vfunc<void(__thiscall*)(void*, const char*, IClientUnknown*)>(this, 242)(this, Filename, Weapon);
}
};
typedef unsigned short MaterialHandle_t;