Code for fixing some cheats.
We are looking for a function that returns an offset m_iItemDefinitionIndex and change the data type from int to short
Example
before
int & CBaseCombatWeapon :: GetWeaponID ()
{
return * (int *) ((DWORD) this + offsets.m_iItemDefinitionIndex);
}
after
short & CBaseCombatWeapon :: GetWeaponID ()
{
return * (short *) ((DWORD) this + offsets.m_iItemDefinitionIndex);
}
Now go to the function FrameStageNotify and see the index 36 change it to 37
Example
before
origFrameStageNotify = H::Client->DetoursHook(H::Initialise::FrameStageNotify, 36);
after
origFrameStageNotify = H::Client->DetoursHook(H::Initialise::FrameStageNotify, 37);
Next, we look for the class or structure of WeaponInfo_t (CSWeaponInfo) and change it on it
Example
before
struct WeaponInfo_t
{
virtual ~WeaponInfo_t() {};
char _0x0000[ 20 ];
__int32 max_clip; //0x0014
char _0x0018[ 12 ];
__int32 max_reserved_ammo; //0x0024
char _0x0028[ 96 ];
char* hud_name; //0x0088
char* weapon_name; //0x008C
char _0x0090[ 60 ]; // From this moment went the update new functions were added
};
after
struct WeaponInfo_t
{
virtual ~WeaponInfo_t() {};
char _0x0000[ 20 ];
__int32 max_clip; //0x0014
char _0x0018[ 12 ];
__int32 max_reserved_ammo; //0x0024
char _0x0028[ 96 ];
char* hud_name; //0x0088
char* weapon_name; //0x008C
char _0x0090[ 60 ];
__int32 type; //0x00CC
__int32 price; //0x00D0
__int32 reward; //0x00D4
char _0x00D8[ 20 ];
BYTE full_auto; //0x00EC
char _0x00ED[ 3 ];
__int32 damage; //0x00F0
float armor_ratio; //0x00F4
__int32 bullets; //0x00F8
float penetration; //0x00FC
char _0x0100[ 8 ];
float range; //0x0108
float range_modifier; //0x010C
char _0x0110[ 16 ];
BYTE silencer; //0x0120
char _0x0121[ 15 ];
float max_speed; //0x0130
float max_speed_alt; //0x0134
char _0x0138[ 76 ];
__int32 recoil_seed; //0x0184
char _0x0188[ 32 ];
};