AgaHackTools.Example.Shared.Structs.Player.GetActiveWeapon C# (CSharp) Method

GetActiveWeapon() public method

public GetActiveWeapon ( ISmartMemory memUtils ) : CSGOWeapon
memUtils ISmartMemory
return CSGOWeapon
        public CSGOWeapon GetActiveWeapon(ISmartMemory memUtils)
        {
            try
            {
                if (this.m_hActiveWeapon == 0xFFFFFFFF)
                    return new CSGOWeapon() { m_iWeaponID = 0 };

                uint handle = this.m_hActiveWeapon & 0xFFF;
                if (handle < 1 || handle > 2048  || CSGOData.Entity[handle - 1].Address == 0|| CSGOData.Entity[handle - 1].Address == null)
                    return new CSGOWeapon() { m_iWeaponID = 0 };
                int weapAddress = CSGOData.Entity[handle - 1].Address;
                return memUtils.Read<CSGOWeapon>((IntPtr)weapAddress);
            }
            catch
            {
                //Console.WriteLine("");
                return new CSGOWeapon() { m_iWeaponID = 0 };
            }
        }