AgaHackTools.Example.Shared.LocalPlayer.GetActiveWeapon C# (CSharp) Method

GetActiveWeapon() public method

public GetActiveWeapon ( ISmartMemory memUtils ) : CSGOWeapon
memUtils ISmartMemory
return AgaHackTools.Example.Shared.Structs.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 == null || CSGOData.Entity[handle - 1].Address == 0)
                    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 };
            }
        }