Skip to content

Instantly share code, notes, and snippets.

@AmyrAhmady
Created March 25, 2020 07:25
Show Gist options
  • Save AmyrAhmady/7ade7c145d220f73fd7a48358a55052a to your computer and use it in GitHub Desktop.
Save AmyrAhmady/7ade7c145d220f73fd7a48358a55052a to your computer and use it in GitHub Desktop.
enum eWeaponType : unsigned int
{
WEAPON_UNARMED = 0x0,
WEAPON_BRASSKNUCKLE = 0x1,
WEAPON_GOLFCLUB = 0x2,
WEAPON_NIGHTSTICK = 0x3,
WEAPON_KNIFE = 0x4,
WEAPON_BASEBALLBAT = 0x5,
WEAPON_SHOVEL = 0x6,
WEAPON_POOLCUE = 0x7,
WEAPON_KATANA = 0x8,
WEAPON_CHAINSAW = 0x9,
WEAPON_DILDO1 = 0xA,
WEAPON_DILDO2 = 0xB,
WEAPON_VIBE1 = 0xC,
WEAPON_VIBE2 = 0xD,
WEAPON_FLOWERS = 0xE,
WEAPON_CANE = 0xF,
WEAPON_GRENADE = 0x10,
WEAPON_TEARGAS = 0x11,
WEAPON_MOLOTOV = 0x12,
WEAPON_ROCKET = 0x13,
WEAPON_ROCKET_HS = 0x14,
WEAPON_FREEFALL_BOMB = 0x15,
WEAPON_PISTOL = 0x16,
WEAPON_PISTOL_SILENCED = 0x17,
WEAPON_DESERT_EAGLE = 0x18,
WEAPON_SHOTGUN = 0x19,
WEAPON_SAWNOFF = 0x1A,
WEAPON_SPAS12 = 0x1B,
WEAPON_MICRO_UZI = 0x1C,
WEAPON_MP5 = 0x1D,
WEAPON_AK47 = 0x1E,
WEAPON_M4 = 0x1F,
WEAPON_TEC9 = 0x20,
WEAPON_COUNTRYRIFLE = 0x21,
WEAPON_SNIPERRIFLE = 0x22,
WEAPON_RLAUNCHER = 0x23,
WEAPON_RLAUNCHER_HS = 0x24,
WEAPON_FTHROWER = 0x25,
WEAPON_MINIGUN = 0x26,
WEAPON_SATCHEL_CHARGE = 0x27,
WEAPON_DETONATOR = 0x28,
WEAPON_SPRAYCAN = 0x29,
WEAPON_EXTINGUISHER = 0x2A,
WEAPON_CAMERA = 0x2B,
WEAPON_NIGHTVISION = 0x2C,
WEAPON_INFRARED = 0x2D,
WEAPON_PARACHUTE = 0x2E,
WEAPON_UNUSED = 0x2F,
WEAPON_ARMOUR = 0x30,
WEAPON_FLARE = 0x3A
};
class CWeaponInfo
{
public:
unsigned int m_nWeaponFire; // see eWeaponFire
float m_fTargetRange; // max targeting range
float m_fWeaponRange; // absolute gun range / default melee attack range
int m_nModelId1; // modelinfo id
int m_nModelId2; // second modelinfo id
unsigned int m_nSlot;
struct
{
unsigned int bCanAim : 1;
unsigned int bAimWithArm : 1;
unsigned int b1stPerson : 1;
unsigned int bOnlyFreeAim : 1;
unsigned int bMoveAim : 1; // can move when aiming
unsigned int bMoveFire : 1; // can move when firing
unsigned int b06 : 1; // this bitfield is not used
unsigned int b07 : 1; // this bitfield is not used
unsigned int bThrow : 1;
unsigned int bHeavy : 1; // can't run fast with this weapon
unsigned int bContinuosFire : 1;
unsigned int bTwinPistol : 1;
unsigned int bReload : 1; // this weapon can be reloaded
unsigned int bCrouchFire : 1; // can reload when crouching
unsigned int bReload2Start : 1; // reload directly after firing
unsigned int bLongReload : 1;
unsigned int bSlowdown : 1;
unsigned int bRandSpeed : 1;
unsigned int bExpands : 1;
} m_nFlags;
unsigned int m_dwAnimGroup; // instead of storing pointers directly to anims, use anim association groups
unsigned short m_nAmmoClip; // ammo in one clip
unsigned short m_nDamage; // damage inflicted per hit
CVector m_vecFireOffset; // offset from weapon origin to projectile starting point
unsigned int m_nSkillLevel; // what's the skill level of this weapontype
unsigned int m_nReqStatLevel; // what stat level is required for this skill level
float m_fAccuracy; // modify accuracy of weapon
float m_fMoveSpeed; // how fast can move with weapon
float m_fAnimLoopStart; // start of animation loop
float m_fAnimLoopEnd; // end of animation loop
unsigned int m_nAnimLoopFire; // time in animation when weapon should be fired
unsigned int m_nAnimLoop2Start; // start of animation2 loop
unsigned int m_nAnimLoop2End; // end of animation2 loop
unsigned int m_nAnimLoop2Fire; // time in animation2 when weapon should be fired
float m_fBreakoutTime; // time after which player can break out of attack and run off
float m_fSpeed; // speed of projectile
float m_fRadius; // radius affected
float m_fLifespan; // time taken for shot to dissipate
float m_fSpread; // angle inside which shots are created
unsigned short m_nAimOffsetIndex; // index into array of aiming offsets
unsigned char m_nBaseCombo; // base combo for this melee weapon
unsigned char m_nNumCombos; // how many further combos are available
};
CWeaponInfo *CWeaponInfo__GetWeaponInfo(eWeaponType weaponType, unsigned char skill)
{
return ((CWeaponInfo *(__cdecl *)(eWeaponType, unsigned char))0x743C60)(weaponType, skill);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment