Get vehicle pos with c++

H4X0R

Member
Joined
Aug 12, 2013
Messages
16
Reaction score
0
Hi.

I'm trying to return the vehicle pos to my console app, but I don't really know what to write in ReadProcessMemory to get that value.

Here is my code, can anyone please give me an example to return X Pos of a vehicle?
http://pastebin.com/uQz8V6bx

The addresses can be found at 0x668 post:
<!-- l topic3309.html#p17820<!-- l
 

H4X0R

Member
Joined
Aug 12, 2013
Messages
16
Reaction score
0
And how do I send a client message to player ingame through c++ console app?
 

0x_

Wtf I'm not new....
Administrator
Joined
Feb 18, 2013
Messages
1,119
Reaction score
168
Code:
int _tmain(int argc, _TCHAR* argv[])
{
	HWND sampWindow = FindWindow(0, _T("GTA:SA:MP"));
	HANDLE hProcess;
	DWORD PID, CVehicleAddress;
	float output;

	if(!sampWindow)
	{
		cout << "SA:MP IS CLOSED!n";
		cin.get();
		return true;
	}
	else cout << "SA:MP IS OPEN!n";

	GetWindowThreadProcessId(sampWindow, &PID);
	hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, PID);
	if(!hProcess) cout << "Cannot open process!";
	
	

	ReadProcessMemory(hProcess, (LPCVOID) CVehicle, &CVehicleAddress, sizeof(CVehicleAddress), NULL);

	if(CVehicleAddress >= 0) {
		DWORD matrixPointer;
		ReadProcessMemory(hProcess, (LPCVOID) (CVehicleAddress + 20) , &matrixPointer, sizeof(matrixPointer), NULL);


		ReadProcessMemory(hProcess, (LPCVOID) (matrixPointer + 56) , &output, sizeof(output), NULL);

		cout << "Your fPosZ: " << (float) output << "n";
	}
	CloseHandle(hProcess);
	cin.get();
	return true;
}

Should work didnt tested it, but anyways first learn how to read basic memory, writing in chat is another thing.
 

H4X0R

Member
Joined
Aug 12, 2013
Messages
16
Reaction score
0
Thank you so much, it worked :happy: :happy::happy:
 

H4X0R

Member
Joined
Aug 12, 2013
Messages
16
Reaction score
0
One more question, how can I teleport a train? (example please)
The code (modified to write & not read) above only seem to teleport player & normal vehicles, and not train/tram

I've searched a bit around, but I don't find anything =/
 

Wut

Well-known member
Joined
Mar 1, 2013
Messages
338
Reaction score
1
I am not a very good C++ developer, but what is int _tmain(int argc, _TCHAR* argv[])
?

I only know int main()..

Sorry for newbie question..
 
Top