C++ | X,Y,Z Coordinates, Dynamic values.

c, c++, php, html, sql ..etc discussion. also includes codes and source codes.

C++ | X,Y,Z Coordinates, Dynamic values.

Postby rassle » Sat Mar 07, 2015 6:04 pm

Hey, i began programming in C++ in october, but as i got exams, i stopped for a while and restarted a few days ago. I am stuck on an idea since i dont know how to put it down in code, my target game is DIRT 3, but im having problems with it so lets stick with something else, for instance > Counter Strike 1.6.

I tried to make a simple money hack but the console just opens and immediately closes, heres the code.

Code: Select all
#include <iostream>
#include <Windows.h>

// FindWindow();
// GetWindowThreadProcessId()
// OpenProcess();
// WriteProcessMemory();
// CloseHandle();

using namespace std;

int main()
{
   int newValue = 16000;

   HWND hWnd = FindWindow(0, "Counter-Strike");
   if (hWnd == 0) {
      cout << "Cannot find window" << endl;
   }
   else {
      DWORD pId;
      GetWindowThreadProcessId(hWnd, &pId);
      HANDLE hProc = OpenProcess(PROCESS_VM_WRITE, FALSE, pId);

      if (!hProc) {
         cout << "Cannot open process." << endl;
      }
      else {
         int isSuccessful = WriteProcessMemory(hProc, (LPVOID)0x14b6d20, &newValue, (DWORD)sizeof(newValue), NULL);

         if (isSuccessful > 0) {
            cout << "Operation succeeded";
         }
         else {
            cout << "Operation failed";
         }

         CloseHandle(hProc);

      }
   }
   return 0;
}


Lately i've been trying to find X,Y,Z coordinates for the player, which then i could overwrite by WriteProcessMemory and the player could be teleported. However, by using cheat engine for years i know the HEX Values are NEVER going to be the same for something like coordinates, and lets say money, therefor making the values DYNAMIC and not STATIC. And i've got no clue how to put it into a code for it to find the dynamic values every time you restart the game. And how would i be able to make something like this teleport hack function on an online game?

DIRT 3 would be perfect since i've seen a coder named "bandiitc" do all kinds of crazy stuff in the game, and upon contacting him, he told me to use cheat engine for memory reading and editing, thats what i have been doing, but im stuck because of lack of knowledge.

Looking forward to get some help.
rassle
Newbie..
Newbie..
 
Posts: 3
Joined: Sat Mar 07, 2015 5:46 pm

Re: C++ | X,Y,Z Coordinates, Dynamic values.

Postby Sethioz » Sat Mar 07, 2015 9:13 pm

I know almost nothing about programming in C, so can't help there, but teleport is quite simple.

I had issues with this too, but in most games, when your player / vehicle stands still, value is STILL changing, so you have to consider that when searching.
Usually when moving North on map, value increases.
and almost in every game, you only need 1 axis, others are separated by like +4 bytes usually, so get one, you get them all.

and for static, do a pointer scan.
some use some custom injector to prevent stuff from changing, but i recommend pointer scan, easiest way to have "static" address.
i have tutorials on youtube.com/sethioz if you dont know how to do basics in CE (such as pointer scanning).
User avatar
Sethioz
Admin
Admin
 
Posts: 4754
Joined: Fri Jul 27, 2007 5:11 pm
Location: unknown

Re: C++ | X,Y,Z Coordinates, Dynamic values.

Postby rassle » Sat Mar 07, 2015 11:20 pm

Some questions STILL occur to me. Every single time you restart the game, the address changes, so if i create a trainer in CE which im going to do because it is way simpler, the address is dynamic and how the code would work if the address is totally different from last time. Im kinda lost because in the tutorials you didnt mention anything about this, this is a headsqueeze. If you can tell me more about this im sure ill go far with my ideas. But, as we all know, we want to make trainers that function online aswell, which is what my goal is, are they going to work, whats there to know, do's and donts?

Thanks in advance.
rassle
Newbie..
Newbie..
 
Posts: 3
Joined: Sat Mar 07, 2015 5:46 pm

Re: C++ | X,Y,Z Coordinates, Dynamic values.

Postby rassle » Sun Mar 08, 2015 8:39 pm

So, im having trouble with POINTER SCANNING in CE. Today i tried on Watch Dogs to make an unlimited pistol ammo trainer. I found the pistol ammo address, scanned it, restarted the game, found a new address, and whenever i re-scan with the new address, it gives me no results. Now, should point out that it happens on every game i've tried so far. If im doing something wrong, please correct me. And, today upon trying to use CE with DiRT 3, the game instantly closes since it detects it as it seems, what alternate program would be recommended to use for memory reading and editing? And/if the program doesnt have a trainer generator like CE does, how would i compile it?

P.S, consider my last reply's LAST question about functionality online.

Thanks in advance.
rassle
Newbie..
Newbie..
 
Posts: 3
Joined: Sat Mar 07, 2015 5:46 pm

Re: C++ | X,Y,Z Coordinates, Dynamic values.

Postby Sethioz » Tue Mar 10, 2015 5:07 pm

1. keep it in the topic, you opened topic with coordinates and C++, but now you're talking about pointer scanning in CE. way too much offtopic.

anyway, yes you're doing something horribly wrong. pointer scans work fine in watch dogs, my trainer is based on pointer scans and it works fine. watch the video i have on youtube. adjust settings where necessary.
User avatar
Sethioz
Admin
Admin
 
Posts: 4754
Joined: Fri Jul 27, 2007 5:11 pm
Location: unknown


Return to Programming / Coding / Debugging

Who is online

Users browsing this forum: No registered users and 2 guests

cron