HI leute,
seit vorgestern habe ich angefangen mich fest mit c++ zu beschäftigen. Mein Ziel ist ein CHARM oder wie das heißt halt bei Multiplayern Models hervorheben. Beispiel wie man oft bei CS/S sieht Blaue oder Rote Models. Oder Aimbot. Aber ich hab an GTA:SA gedacht, weil man das sehr schnell starten kann. Und warum nicht für sa:mp aimbot?
Aber na klar muss man sich von unten nach oben durch arbeiten^^ fing ich mit Basics und memorys an. War schon mir schwer genug weil es kaum Tutorials für Memory read und writes gab. Naja zu mindest ohne Erklärung.. (copy & paste)
hier bis jetzt was ich tat aber per console
Hier wird einfach von Little Fighter 2(Weil man wenig suchen muss ;) und beide charactere steuern kann) HP und MP gelesen und in console angezeigt. Falls es sich ändert wird neu angezeigt.
Aber jetzt wollte ich gerne ein Fenster, weil es schöner aussieht.
Das habe ich gemacht. Aber ich weiß nicht wie ich jede sekunde text ändern kann. Also ich möchte nur wenn es neue werte findet dann dahin auch schreibt.
Beispiel Player 1 current HP: 500
er verliert dann und wert ist 400
Player 1 current HP: 400
Hab das bis jetzt nicht hingekriegt.. message box zeigt aber neue werte immer an.
EDIT: hmm komischerweise hab ich jetzt nur noch bugs. Console wird nicht angezeigt.
Und Player 1 current HP: 0 kommt immer 0 raus :S
seit vorgestern habe ich angefangen mich fest mit c++ zu beschäftigen. Mein Ziel ist ein CHARM oder wie das heißt halt bei Multiplayern Models hervorheben. Beispiel wie man oft bei CS/S sieht Blaue oder Rote Models. Oder Aimbot. Aber ich hab an GTA:SA gedacht, weil man das sehr schnell starten kann. Und warum nicht für sa:mp aimbot?
Aber na klar muss man sich von unten nach oben durch arbeiten^^ fing ich mit Basics und memorys an. War schon mir schwer genug weil es kaum Tutorials für Memory read und writes gab. Naja zu mindest ohne Erklärung.. (copy & paste)
hier bis jetzt was ich tat aber per console
Code:
#include <windows.h>
#include <iostream>
using namespace std;
int hp1 = 500;
int mp1 = 500;
int tbuf;
int hp11;
int mp11;
void WriteMem(char* window, LPCVOID address, int value)
{
HWND hWnd = FindWindow(0, window);
DWORD proc_id;
GetWindowThreadProcessId(hWnd, &proc_id);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id);
BYTE newdata[]={value};
DWORD newdatasize = sizeof(newdata);
WriteProcessMemory(hProcess, (LPVOID)address, &newdata, newdatasize, 0);
CloseHandle(hProcess);
}
void ReadMem(char *window, LPCVOID dAddr)
{
HWND hWnd = FindWindow(0, window);
DWORD proc_id;
GetWindowThreadProcessId(hWnd, &proc_id);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id);
ReadProcessMemory(hProcess, dAddr, &tbuf, 4, NULL);
}
int main()
{
ReadMem("Little Fighter 2", (LPCVOID)0x01CDFCFC);
hp11 = tbuf;
ReadMem("Little Fighter 2", (LPCVOID)0x01CDFD08);
mp11 = tbuf;
cout<<"Player 1 current HP: ";
cout<<hp11;
hp1 = hp11;
cout<<"\n";
cout<<"Player 1 current MP: ";
cout<<mp11;
mp1 = mp11;
cout<<"\n\n";
while(1)
{
ReadMem("Little Fighter 2", (LPCVOID)0x01CDFCFC);
hp11 = tbuf;
ReadMem("Little Fighter 2", (LPCVOID)0x01CDFD08);
mp11 = tbuf;
if (hp1 != hp11 | mp1 != mp11 )
{
cout<<"Player 1 current HP: ";
cout<<hp11;
hp1 = hp11;
cout<<"\n";
cout<<"Player 1 current MP: ";
cout<<mp11;
mp1 = mp11;
cout<<"\n\n";
}
//WriteMem("Little Fighter 2",(LPCVOID)0x0044E4BC,900);
Sleep(1000);
}
}
Aber jetzt wollte ich gerne ein Fenster, weil es schöner aussieht.
Code:
#define STRICT
#include <windows.h>
#include <iostream>
#include <cstring>
using namespace std;
int hp1 = 500;
int mp1 = 500;
int tbuf;
int hp11;
int mp11;
void WriteMem(char* window, LPCVOID address, int value)
{
HWND hWnd = FindWindow(0, window);
DWORD proc_id;
GetWindowThreadProcessId(hWnd, &proc_id);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id);
BYTE newdata[]={value};
DWORD newdatasize = sizeof(newdata);
WriteProcessMemory(hProcess, (LPVOID)address, &newdata, newdatasize, 0);
CloseHandle(hProcess);
}
void ReadMem(char *window, LPCVOID dAddr)
{
HWND hWnd = FindWindow(0, window);
DWORD proc_id;
GetWindowThreadProcessId(hWnd, &proc_id);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id);
ReadProcessMemory(hProcess, dAddr, &tbuf, 4, NULL);
}
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
const char szAppName[] = "Little Fighter 2";
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
MSG msg;
HWND hWnd;
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszClassName = szAppName;
wc.lpszMenuName = NULL;
RegisterClass(&wc);
hWnd = CreateWindow( szAppName,
szAppName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hWnd, iCmdShow);
UpdateWindow(hWnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hDC;
char szText[5];
hDC = BeginPaint(hWnd, &ps);
{
ReadMem("Little Fighter 2", (LPCVOID)0x01CDFCFC);
hp11 = tbuf;
ReadMem("Little Fighter 2", (LPCVOID)0x01CDFD08);
mp11 = tbuf;
sprintf(szText,"Player 1 current HP: %d",hp11);
//MessageBox(NULL, szText, "Ha, ha, ha, ha...", MB_ICONINFORMATION);
TextOut(hDC, 50, 50, szText, 25);
sprintf(szText2,"Player 1 current MP: %d",mp11);
TextOut(hDC, 50, 70, szText2, 25);
Sleep(10);
}
EndPaint(hWnd, &ps);
return 0;
}
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
Beispiel Player 1 current HP: 500
er verliert dann und wert ist 400
Player 1 current HP: 400
Hab das bis jetzt nicht hingekriegt.. message box zeigt aber neue werte immer an.
EDIT: hmm komischerweise hab ich jetzt nur noch bugs. Console wird nicht angezeigt.
Und Player 1 current HP: 0 kommt immer 0 raus :S