Results 1 to 13 of 13
  1. #1
    samlarenskoog's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Posts
    104
    Reputation
    25
    Thanks
    57
    My Mood
    Cheerful

    AssaultCube Ammo Memory Reading

    Hey guys! I am trying to make a program that reads the ammo, i think something is wrong with the offsets and base address. It would be insanely helpful if someone could help me

    Code:
    #include <iostream>
    #include <Windows.h>
    
    using namespace std;
    
    
    
    int main()
    {
    	HWND hwnd = FindWindow(NULL, "AssaultCube");
    
    	if (!hwnd)
    	{
    		cout << "Window could not be found.\n";
    		system("PAUSE");
    	}
    	else
    	{
    		cout << "Window found\n";
    
    		DWORD pId;
    
    		GetWindowThreadProcessId(hwnd, &pId);
    
    		HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);
    
    		if (!hProc)
    		{
    			cout << "Process could not be opened\n";
    			system("PAUSE");
    		}
    		else
    		{
    			cout << "Process opened, all access.\n";
    
    			DWORD address = 0x004DF73C;
    			DWORD pointed1, pointed2, pointed3;
    			WORD offset1 = 0x0;
    			WORD offset2 = 0x14;
    			WORD offset3 = 0x378;
    			int currentAmmo;
    
    			while (1) {
    				ReadProcessMemory(hProc, (LPCVOID)(address), &pointed1, 4, NULL);
    				ReadProcessMemory(hProc, (LPCVOID)(pointed1 + offset1), &pointed2, 4, NULL);
    				ReadProcessMemory(hProc, (LPCVOID)(pointed2 + offset2), &pointed3, 4, NULL);
    				ReadProcessMemory(hProc, (LPCVOID)(pointed3 + offset3), &currentAmmo, 4, NULL);
    				
    
    				cout << "Your current ammo is " << currentAmmo << endl;
    				Sleep(9999);
    			}
    
    
    		}
    	}
    	cin.get();
    	return 0;
    }

  2. #2
    Sammy's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Location
    Vaero
    Posts
    1,102
    Reputation
    224
    Thanks
    228
    Quote Originally Posted by samlarenskoog View Post
    Hey guys! I am trying to make a program that reads the ammo, i think something is wrong with the offsets and base address. It would be insanely helpful if someone could help me

    Code:
    #include <iostream>
    #include <Windows.h>
    
    using namespace std;
    
    
    
    int main()
    {
    	HWND hwnd = FindWindow(NULL, "AssaultCube");
    
    	if (!hwnd)
    	{
    		cout << "Window could not be found.\n";
    		system("PAUSE");
    	}
    	else
    	{
    		cout << "Window found\n";
    
    		DWORD pId;
    
    		GetWindowThreadProcessId(hwnd, &pId);
    
    		HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);
    
    		if (!hProc)
    		{
    			cout << "Process could not be opened\n";
    			system("PAUSE");
    		}
    		else
    		{
    			cout << "Process opened, all access.\n";
    
    			DWORD address = 0x004DF73C;
    			DWORD pointed1, pointed2, pointed3;
    			WORD offset1 = 0x0;
    			WORD offset2 = 0x14;
    			WORD offset3 = 0x378;
    			int currentAmmo;
    
    			while (1) {
    				ReadProcessMemory(hProc, (LPCVOID)(address), &pointed1, 4, NULL);
    				ReadProcessMemory(hProc, (LPCVOID)(pointed1 + offset1), &pointed2, 4, NULL);
    				ReadProcessMemory(hProc, (LPCVOID)(pointed2 + offset2), &pointed3, 4, NULL);
    				ReadProcessMemory(hProc, (LPCVOID)(pointed3 + offset3), ¤tAmmo, 4, NULL);
    				
    
    				cout << "Your current ammo is " << currentAmmo << endl;
    				Sleep(9999);
    			}
    
    
    		}
    	}
    	cin.get();
    	return 0;
    }
    Could you explain what actually isn't working? Compile error? Crashes? Anything?

  3. #3
    samlarenskoog's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Posts
    104
    Reputation
    25
    Thanks
    57
    My Mood
    Cheerful
    Quote Originally Posted by Sir Sam View Post
    Could you explain what actually isn't working? Compile error? Crashes? Anything?
    Its the address that is the problem, I think I need a base address. I have no idea how to get it though, shouldn't it work if the address I use is static?

  4. #4
    Sammy's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Location
    Vaero
    Posts
    1,102
    Reputation
    224
    Thanks
    228
    Quote Originally Posted by samlarenskoog View Post
    Its the address that is the problem, I think I need a base address. I have no idea how to get it though, shouldn't it work if the address I use is static?
    you'll need to find a base address yes, a green addr in cheat engine. Do you got that? Save it and reload the game to see if it still shows the right value

  5. The Following User Says Thank You to Sammy For This Useful Post:

    samlarenskoog (06-15-2016)

  6. #5
    samlarenskoog's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Posts
    104
    Reputation
    25
    Thanks
    57
    My Mood
    Cheerful
    Quote Originally Posted by Sir Sam View Post
    you'll need to find a base address yes, a green addr in cheat engine. Do you got that? Save it and reload the game to see if it still shows the right value
    Aren't the base address and offsets the same for everyone? Are there any places online where I can find for example csgo base addresses?

  7. #6
    Sammy's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Location
    Vaero
    Posts
    1,102
    Reputation
    224
    Thanks
    228
    Quote Originally Posted by samlarenskoog View Post
    Aren't the base address and offsets the same for everyone? Are there any places online where I can find for example csgo base addresses?
    I think the best is to find them yourselves. Do some cheat engine tutorials and learn about multilevel pointers.

  8. #7
    samlarenskoog's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Posts
    104
    Reputation
    25
    Thanks
    57
    My Mood
    Cheerful
    Quote Originally Posted by Sir Sam View Post
    I think the best is to find them yourselves. Do some cheat engine tutorials and learn about multilevel pointers.
    Does adding offsets work on both of these ways?

    ReadProcessMemory(hProc, (LPCVOID)(address), &pointed1, 4, NULL);
    ReadProcessMemory(hProc, (LPCVOID)(pointed1 + offset1), &pointed2, 4, NULL);
    ReadProcessMemory(hProc, (LPCVOID)(pointed2 + offset2), &pointed3, 4, NULL);
    ReadProcessMemory(hProc, (LPCVOID)(pointed3 + offset3), &currentAmmo, 4, NULL);
    ---------------------------------------------------------------------------------------------------
    ReadProcessMemory(hProc, (LPCVOID)(address + offset1 + offset2+ offset3), &currentAmmo, 4, NULL);

  9. #8
    Sammy's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Location
    Vaero
    Posts
    1,102
    Reputation
    224
    Thanks
    228
    Quote Originally Posted by samlarenskoog View Post
    Does adding offsets work on both of these ways?

    ReadProcessMemory(hProc, (LPCVOID)(address), &pointed1, 4, NULL);
    ReadProcessMemory(hProc, (LPCVOID)(pointed1 + offset1), &pointed2, 4, NULL);
    ReadProcessMemory(hProc, (LPCVOID)(pointed2 + offset2), &pointed3, 4, NULL);
    ReadProcessMemory(hProc, (LPCVOID)(pointed3 + offset3), ¤tAmmo, 4, NULL);
    ---------------------------------------------------------------------------------------------------
    ReadProcessMemory(hProc, (LPCVOID)(address + offset1 + offset2+ offset3), ¤tAmmo, 4, NULL);

    Alright I'm a little rusty on c++ and memory editing but yea, I do think this is a correct way to get the right address. Do you know how to find a multilevel pointer with cheat engine?

  10. #9
    samlarenskoog's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Posts
    104
    Reputation
    25
    Thanks
    57
    My Mood
    Cheerful
    Quote Originally Posted by Sir Sam View Post
    Alright I'm a little rusty on c++ and memory editing but yea, I do think this is a correct way to get the right address. Do you know how to find a multilevel pointer with cheat engine?
    Yes, but I dont really know if something is wrong with the code

  11. #10
    Sammy's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Location
    Vaero
    Posts
    1,102
    Reputation
    224
    Thanks
    228
    Quote Originally Posted by samlarenskoog View Post
    Yes, but I dont really know if something is wrong with the code
    I recommend learning about multi level pointers from cheat engine

  12. #11
    Hacker Fail's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    C++
    Posts
    2,136
    Reputation
    242
    Thanks
    12,562
    You don´t need to use offsets to get this address and you don´t need to do this externally.

    For example :

    Code:
    #define Ammo 0x4637E9 // FF 0E
    
    ReadMemory((void*)Ammo,0x90,2);
    Member Level 1 since November, 2011
    Contributor since March, 2015
    Game Hacking Team : 06/14/2017

     

  13. #12
    romponu's Avatar
    Join Date
    Jun 2014
    Gender
    male
    Posts
    14
    Reputation
    10
    Thanks
    2
    My Mood
    Amazed
    Google "Assault Cube Addys" and your answer will be the first thing that will pop up. Also, make the names of the dword and offset vars more understandable then just 1,2,3.

  14. #13
    Sammy's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Location
    Vaero
    Posts
    1,102
    Reputation
    224
    Thanks
    228
    Quote Originally Posted by romponu View Post
    Google "Assault Cube Addys" and your answer will be the first thing that will pop up. Also, make the names of the dword and offset vars more understandable then just 1,2,3.
    He is just trying to learn at the moment, although it's a good tip. Not very necessary in this case.

Similar Threads

  1. [Help Request] Memory reading, structures, and pointers
    By abduct in forum C++/C Programming
    Replies: 8
    Last Post: 05-17-2013, 02:40 AM
  2. [Preview] Memory Reading Aimbot.
    By Autoithacks in forum CounterStrike (CS) 1.6 Hacks / Counter Strike: Source (CSS) Hacks
    Replies: 3
    Last Post: 01-27-2013, 02:26 AM
  3. [Solved] Problem With Memory Reading
    By Pwnographer in forum Visual Basic Programming
    Replies: 16
    Last Post: 07-29-2012, 10:48 PM
  4. [Request] C# Memory Reading
    By rabir007 in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 3
    Last Post: 07-08-2012, 02:54 PM
  5. [Request] Open process memory [read/wirte to it]
    By wolfguardiann in forum Visual Basic Programming
    Replies: 18
    Last Post: 07-01-2011, 08:25 PM