• Amused
  • Angry
  • Annoyed
  • Awesome
  • Bemused
  • Cocky
  • Cool
  • Crazy
  • Crying
  • Down
  • Drunk
  • Embarrased
  • Enraged
  • Friendly
  • Geeky
  • Godly
  • Happy
  • Hateful
  • Hungry
  • Innocent
  • Meh
  • Piratey
  • Poorly
  • Sad
  • Secret
  • Shy
  • Sneaky
  • Tired
  • Wtf
  • At Work
  • CodenzHub
  • Coding
  • Deejaying
  • Donating
  • Drinking
  • Eating
  • Editing
  • Hacking
  • Hate Mailing
  • Jamin'
  • Lagging
  • Live Streaming
  • Lurking
  • No Status
  • Pawning
  • PC Gaming
  • PS Gaming
  • Raging
  • Reversing
  • Sleeping
  • Steam Gaming
  • Trolling
  • TwitchStreamer
  • Vodka!
  • Watching TV/Movie
  • Xbox Gaming
  • Youtuber
  • Zombies
  • Results 1 to 10 of 10
    1. #1
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      maptwo3's Avatar
      Join Date
      May 2012
      Posts
      21
      Thanks (-->)
      2
      Thanks (<--)
      0

      C# Aimbot Not Finding Enemies[SOLVED]

      Silent VPN
      The program finds itself but it won't find the enemies. I've look over Fleep's source code and I cannot figure out what's wrong with it. If anyone could take a look at my code, that would be great. Here it is:

      PlayerInfo.cs
      Code:
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      
      namespace Assault_Cube_Aimbot
      {
        public class PlayerDataAddr
        {
          public int xMouse;
          public int yMouse;
          public int xPos;
          public int yPos;
          public int zPos;
          public int health;
      
          public PlayerDataAddr(int _xMouse, int _yMouse, int _xPos, int _yPos, int _zPos, int _health)
          {
            xMouse = _xMouse;
            yMouse = _yMouse;
            xPos = _xPos;
            yPos = _yPos;
            zPos = _zPos;
            health = _health;
          }
        }
      
        public struct PlayerData
        {
          public int baseAddress;
          public int&#91;] multiLevel;
          public PlayerDataAddr offsets;
        }
      
        public struct PlayerDataVec
        {
          public float xMouse;
          public float yMouse;
          public float xPos;
          public float yPos;
          public float zPos;
          public int health;
        }
      }
      Form1.cs
      Code:
      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Data;
      using System.Drawing;
      using System.Linq;
      using System.Text;
      using System.Windows.Forms;
      using ProcessMemoryReaderLib;
      using System.Globalization;
      using System.Diagnostics;
      
      namespace Assault_Cube_Aimbot
      {
        public partial class Form1 : Form
        {
          Process&#91;] MyProcess;
          ProcessModule mainModule;
          ProcessMemoryReader Mem = new ProcessMemoryReader();
          PlayerData MainPlayer = new PlayerData();
      
          #region ---------Addressess-------------
          int MainPlayerBase = 0x4DF73C;
          int&#91;] MainPlayerMultiLvl = new int&#91;] { 0x30 };
          PlayerDataAddr MainPlayerOffsets = new PlayerDataAddr(0x10, 0x14, 0x4, 0xC, 0x8, 0xC4);
      
          #region ---------ENEMY Addressess-------------
          List&lt;PlayerData&gt; EnemyAddresses = new List&lt;PlayerData&gt;();
          int&#91;] enOneMultiLevel = new int&#91;] { 0x4, 0x364, 0x8, 0x30 };
          #endregion
          #endregion
      
          float PI = 3.14159265f;
      
          bool GameFound = false;
          bool FocusingOnEnemy = false;
          int FocusTarget = -1;
      
          public Form1()
          {
            InitializeComponent();
          }
      
          private void GameChoiceCB_SelectedIndexChanged(object sender, EventArgs e)
          {
            try
            {
              for (int i = 0; i &lt; MyProcess.Length; i++)
              {
                if (GameChoiceCB.SelectedItem.ToString().Contains(MyProcess[i].ProcessName))
                {
                  MyProcess[0] = Process.GetProcessById(int.Parse(GameChoiceCB.Text.Replace(MyProcess[i].ProcessName + "-", "")));
                  mainModule = MyProcess[0].MainModule;
                  Mem.ReadProcess = MyProcess[0];
                  Mem.OpenProcess();
                  GameFound = true;
      
                  MainPlayer.baseAddress = MainPlayerBase;
                  MainPlayer.multiLevel = MainPlayerMultiLvl;
                  MainPlayer.offsets = new PlayerDataAddr(MainPlayerOffsets.xMouse, MainPlayerOffsets.yMouse, MainPlayerOffsets.xPos, MainPlayerOffsets.zPos, MainPlayerOffsets.yPos, MainPlayerOffsets.health);
                  SetupEnemyVars();
                }
              }
            }
            catch(Exception ex)
            {
              MessageBox.Show("Could not connect to process" + ex.Message);
            }
          }
      
          private void GameChoiceCB_MouseClick(object sender, MouseEventArgs e)
          {
            GameChoiceCB.Items.Clear();
            MyProcess = Process.GetProcesses();
            for (int i = 0; i &lt; MyProcess.Length; i++)
            {
              GameChoiceCB.Items.Add(MyProcess[i].ProcessName + "-" + MyProcess[i].Id);
            }
          }
      
          private void SetupEnemyVars()
          {
            PlayerData En1 = new PlayerData();
            En1.baseAddress = MyProcess[0].MainModule.BaseAddress.ToInt32() + 0x000E4E08;
            En1.multiLevel = enOneMultiLevel;
            En1.offsets = MainPlayer.offsets;
            EnemyAddresses.Add(En1);
          }
      
          private void Form1_Load(object sender, EventArgs e)
          {
            processTMR.Enabled = true;
          }
      
          private void processTMR_Tick(object sender, EventArgs e)
          {
            if (GameFound)
            {
              int playerBase = Mem.ReadMultiLevelPointer(MainPlayer.baseAddress, 4, MainPlayer.multiLevel);
              XPosLBL.Text = "Xpos: " + Mem.ReadFloat(playerBase + MainPlayer.offsets.xPos);
              YPosLBL.Text = "Ypos: " + Mem.ReadFloat(playerBase + MainPlayer.offsets.yPos);
              ZPosLBL.Text = "Zpos: " + Mem.ReadFloat(playerBase + MainPlayer.offsets.zPos);
      
              int hotKey = ProcessMemoryReaderApi.GetKeyState(02); //RIGHT MOUSE
              if ((hotKey &amp; 0x8000) != 0)
              {
                FocusingOnEnemy = true;
                Aimbot();
              }
              else
              {
                FocusingOnEnemy = false;
                FocusTarget = -1;
              }
            }
            
            try
            {
              if (MyProcess != null)
              {
                if (MyProcess[0].HasExited)
                  GameFound = false;
              }
            }
      
            catch (Exception ex)
            {
              MessageBox.Show("There was an error " + ex.Message);
            }
          }
      
          private PlayerDataVec GetPlayerData(PlayerData updatePlayer)
          {
            PlayerDataVec playerRet = new PlayerDataVec();
            int playerBase = Mem.ReadMultiLevelPointer(updatePlayer.baseAddress, 4, updatePlayer.multiLevel);
            playerRet.xMouse = Mem.ReadFloat(playerBase + updatePlayer.offsets.xMouse);
            playerRet.yMouse = Mem.ReadFloat(playerBase + updatePlayer.offsets.yMouse);
            playerRet.xPos = Mem.ReadFloat(playerBase + updatePlayer.offsets.xPos);
            playerRet.yPos = Mem.ReadFloat(playerBase + updatePlayer.offsets.yPos);
            playerRet.zPos = Mem.ReadFloat(playerBase + updatePlayer.offsets.zPos);
            playerRet.health = Mem.ReadInt(playerBase + updatePlayer.offsets.health);
      
            return playerRet;
          }
      
          private void Aimbot()
          {
            PlayerDataVec playerDataVec = GetPlayerData(MainPlayer);
            List&lt;PlayerDataVec&gt; enemiesDataVec = new List&lt;PlayerDataVec&gt;();
      
            for (int i = 0; i &lt; EnemyAddresses.Count; i++)
            {
              PlayerDataVec enemyDataVector = GetPlayerData(EnemyAddresses[i]);
              enemiesDataVec.Add(enemyDataVector);
            }
      
            if (playerDataVec.health &gt; 0)
            {
              int target = 0;
              if (FocusingOnEnemy &amp;&amp; FocusTarget != -1)
              {
                if (enemiesDataVec[FocusTarget].health &gt; 0)
                  target = FocusTarget;
                else target = FindClosestEnemyIndex(enemiesDataVec.ToArray(), playerDataVec);
      
                if (target != -1)
                {
                  FocusTarget = target;
                  if (enemiesDataVec[target].health &gt; 0)
                    AimAtTarget(enemiesDataVec[target], playerDataVec);
                }
              }
            }
          }
      
          private void AimAtTarget(PlayerDataVec enemyDataVector, PlayerDataVec playerDataVector)
          {
            float pitchX = (float)Math.Atan2(enemyDataVector.zPos - playerDataVector.zPos,
              Get3dDistance(enemyDataVector, playerDataVector))
              * 180 / PI;
      
            float yawY = -(float)Math.Atan2(enemyDataVector.xPos - playerDataVector.xPos, enemyDataVector.yPos - playerDataVector.yPos)
              / PI * 180 + 180;
      
            int playerBase = Mem.ReadMultiLevelPointer(MainPlayer.baseAddress, 4, MainPlayer.multiLevel);
      
            Mem.WriteFloat(playerBase + MainPlayer.offsets.xMouse, yawY);
            Mem.WriteFloat(playerBase + MainPlayer.offsets.yMouse, pitchX);
          }
      
          private int FindClosestEnemyIndex(PlayerDataVec&#91;] enemiesDataVec, PlayerDataVec myPosition)
          {
            float&#91;] distances = new float[enemiesDataVec.Length];
            for (int i = 0; i &lt; enemiesDataVec.Length; i++)
            {
              if (enemiesDataVec[i].health &gt; 0)
                distances[i] = Get3dDistance(enemiesDataVec[i], myPosition);
              else
                distances[i] = float.MaxValue;
            }
      
            float&#91;] newDistances = new float[distances.Length];
            Array.Copy(distances, newDistances, distances.Length);
            Array.Sort(newDistances);
      
            for (int i = 0; i &lt; distances.Length; i++)
            {
              if (distances[i] == newDistances[0])
                return i;
            }
            return -1;
          }
          private float Get3dDistance(PlayerDataVec to, PlayerDataVec from)
          {
            return (float)(Math.Sqrt(
              ((to.xPos - from.xPos) * (to.xPos - from.xPos)) +
              ((to.yPos - from.yPos) * (to.yPos - from.yPos)) +
              ((to.zPos - from.zPos) * (to.zPos - from.zPos))));
          }
        }
      }
      I really don't see what I did wrong, but Fleep's aimbot works just fine for me, but mine cannot find the enemy.

      Thanks.

      Virus scan:
      https://www.virustotal.com/file/a157...is/1343041946/
      Attached Files Attached Files
      Donate  

    2. #2
      Hacker
      Learning to hack games!
       
      Pawning
       
      Fleep's Avatar
      Join Date
      May 2012
      Posts
      626
      Thanks (-->)
      208
      Thanks (<--)
      743
      Hey mapTwo Ive had a quick look and still cant see the problem myself, if you still havent fixed it please upload your solution in a zip and il take a look at it.

      Fleep

    3. #3
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      maptwo3's Avatar
      Join Date
      May 2012
      Posts
      21
      Thanks (-->)
      2
      Thanks (<--)
      0
      The solution is up now. Thanks for looking.

    4. #4
      Hacker
      Learning to hack games!
       
      Pawning
       
      Fleep's Avatar
      Join Date
      May 2012
      Posts
      626
      Thanks (-->)
      208
      Thanks (<--)
      743
      Ok then I believe that is fixed here is the only small mistake you had within your Aimbot() method, my comments should clear that up.

      Code:
          private void Aimbot()
          {
            PlayerDataVec playerDataVec = GetPlayerData(MainPlayer);
            List&lt;PlayerDataVec&gt; enemiesDataVec = new List&lt;PlayerDataVec&gt;();
      
            for (int i = 0; i &lt; EnemyAddresses.Count; i++)
            {
              PlayerDataVec enemyDataVector = GetPlayerData(EnemyAddresses[i]);
              enemiesDataVec.Add(enemyDataVector);
            }
      
            if (playerDataVec.health &gt; 0)
            {
              int target = 0;
              if (FocusingOnEnemy &amp;&amp; FocusTarget != -1)
              {
                if (enemiesDataVec[FocusTarget].health &gt; 0)
                  target = FocusTarget;
                else target = FindClosestEnemyIndex(enemiesDataVec.ToArray(), playerDataVec);
                //This wasnt supposed to be here but below where i put it :) 
                //if (target != -1)
                //{
                //  FocusTarget = target;
                //  if (enemiesDataVec[target].health &gt; 0)
                //    AimAtTarget(enemiesDataVec[target], playerDataVec);
                //}
              }
              //was missing this else also
              else
                target = FindClosestEnemyIndex(enemiesDataVec.ToArray(), playerDataVec);
      
      
              if (target != -1)
              {
                FocusTarget = target;
                if (enemiesDataVec[target].health &gt; 0)
                  AimAtTarget(enemiesDataVec[target], playerDataVec);
              }
      
      
            }
          }
      Otherwise good code throughout

      Fleep

    5. #5
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      maptwo3's Avatar
      Join Date
      May 2012
      Posts
      21
      Thanks (-->)
      2
      Thanks (<--)
      0
      That did it. Thanks for the help. One thing I was wondering though. Do you know if it's possible to not have all the enemy bots values hard coded? That way you can play against a bunch more but not have to go through and find all their locations?

    6. #6
      Hacker
      Learning to hack games!
       
      Pawning
       
      Fleep's Avatar
      Join Date
      May 2012
      Posts
      626
      Thanks (-->)
      208
      Thanks (<--)
      743
      Quote Originally Posted by maptwo3
      That did it. Thanks for the help. One thing I was wondering though. Do you know if it's possible to not have all the enemy bots values hard coded? That way you can play against a bunch more but not have to go through and find all their locations?
      Yes I'm sure that can be done but I havent myself, although I think that will only work when you share the games memory with a DLL. So your pretty much stuck to C++ with code injection.

      Fleep

    7. #7
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      maptwo3's Avatar
      Join Date
      May 2012
      Posts
      21
      Thanks (-->)
      2
      Thanks (<--)
      0
      Ok. Do you think that will be included in your "more complex" C++ version?

    8. #8
      Hacker
      Learning to hack games!
       
      Pawning
       
      Fleep's Avatar
      Join Date
      May 2012
      Posts
      626
      Thanks (-->)
      208
      Thanks (<--)
      743
      Quote Originally Posted by maptwo3
      Ok. Do you think that will be included in your "more complex" C++ version?
      If I can figure out how to do it then yes.

      Fleep

    9. #9
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      maptwo3's Avatar
      Join Date
      May 2012
      Posts
      21
      Thanks (-->)
      2
      Thanks (<--)
      0
      Sounds good. Also just wanted to say thanks for the tutorials.

    10. #10
      Hacker
      Learning to hack games!
       
      Pawning
       
      Fleep's Avatar
      Join Date
      May 2012
      Posts
      626
      Thanks (-->)
      208
      Thanks (<--)
      743
      Silent VPN
      Quote Originally Posted by maptwo3
      Sounds good. Also just wanted to say thanks for the tutorials.
      Your welcome, I remember you being one of my first subscribers so Im happy to help out.
      Locking this now as solved
      Fleep

    Similar Game Hacker Threads

    1. [Help] How to get the pointer to all bots/enemies
      By ranseier in forum Assault Cube Hacks
      Replies: 7
      Last Post: 11-25-2015, 12:35 AM
    2. [Help] Loop through enemies
      By RaZor1994 in forum C#
      Replies: 15
      Last Post: 08-14-2015, 01:35 PM
    3. [SOLVED] Aimbot Math
      By Solaire in forum Hacking Help
      Replies: 4
      Last Post: 11-16-2014, 04:03 PM
    4. Replies: 2
      Last Post: 07-30-2013, 10:37 AM
    5. [Help] New video (aimbot) Need Help!!![SOLVED]
      By NickTheGreek in forum GH Tutorials Help
      Replies: 13
      Last Post: 06-09-2012, 05:34 AM