Hey!
Just letting you all know that I have recently released a trainer / hack for Need for Speed : Most Wanted that allows you to hack your money up to $999,999,999...
The C++ Source Code is included aswell...
You can check it here : https://www.youtube.com/watch?v=6thoAaxqC5s
This Blog is about Games , Programming , Modding , Coding , YouTube , Videos , Movies...
Showing posts with label Enjoy. Show all posts
Showing posts with label Enjoy. Show all posts
Monday, April 14, 2014
Saturday, February 22, 2014
[C++ TUT] Win32 (GUI) Programming - Creating a Window
Hey guys!
Today I will be teaching on how to use the Win32 WINAPI in C++ to create a GUI...
Ever wondered how so many programs are made in C++ and have a GUI? ... Because of this :P...
In C++ you can also NOT use the CommControls(); (which we will talk about a few tutorials ahead) and design your own... so let´s start...
First ..
Q : Can´t I simply drag and drop stuff like in C# , VB... ?
A : NO! C++ Does not have a designer, it is a 'professional' language and does not belong to any framework...
In this tutorial we will just create a blank window ... next tutorial we will add some controls and learn how to use them.
So let´s start!
Create a Win32 Project (or WinProject) , make sure its a Windows Application and that is setted as 'Empty Project'
Head over to your Source Files and add a .cpp file.. name it whatever you want!
In your new file include the Windows.h!
#include <Windows.h>
That contains nearly anything you need for a basic Win32 C++ GUI Programming...
Okay..
Now you are going to name your program class!
LPCWSTR g_szClassName = L"MainWindow_Class";
Again you can name it whatever you want!
Okay, now you want to create your function that handles the program close and destroy (and in future will handle buttons and stuff..)
First here is just the whole function.... then I will explain it further
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg , WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
Okay so lets start.... well the actual function is just how it is! Its just how it is defined...
so
switch (msg) //This 'handles' anything that we will be later recieving from the WinMain!
{
case WM_CLOSE: //if we close the window
DestroyWindow(hwnd); // destroy it!
break;
case WM_DESTROY: //if we destroy the window
PostQuitMessage(0); //tell the computer that the program has quitted
break;
default: //returning to default
return DefWindowProc(hwnd, msg, wParam, lParam); //return the default window process
}
return 0; //out of the switch return 0 ( null )
Okay!
Now its the actual 'GUI' Designing... its not really designing cuz it will be blank :P
So here is the function and I will later explain it
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
MSG msg;
HWND hwnd;
ZeroMemory(&wc, sizeof(&wc));
wc.style = 0;
wc.lpszClassName = g_szClassName;
wc.lpszMenuName = NULL;
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.hIconSm = LoadIcon(NULL, IDC_ICON);
wc.hIcon = LoadIcon(NULL, IDC_ICON);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wc.cbWndExtra = 0;
wc.cbSize = sizeof(WNDCLASSEX);
wc.cbClsExtra = 0;
if (!RegisterClassEx(&wc))
{
LPCWSTR Error01 = L"Could not register class!";
LPCWSTR Error01_Caption = L"Error";
MessageBox(NULL, Error01, Error01_Caption, MB_OK | MB_ICONERROR);
}
LPCWSTR WindowTitle = L"EXAMPLE WINDOW!";
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, g_szClassName, WindowTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 500, 300, NULL, NULL, hInstance, NULL);
if (hwnd == NULL)
{
LPCWSTR Error02 = L"Could not create Window!";
LPCWSTR Error02_Caption = L"Error";
MessageBox(NULL, Error02 , Error02_Caption , MB_OK | MB_ICONERROR);
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
Okay! So now I will comment it out...
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
MSG msg;
HWND hwnd;
ZeroMemory(&wc, sizeof(&wc)); //We are cleaning the memory so we know we are really starting from scratch
wc.style = 0; //the style of the window is null (default)
wc.lpszClassName = g_szClassName; //the class of the window we are setting it as g_szClassName
wc.lpszMenuName = NULL; //we really dont have a menu name ...
wc.lpfnWndProc = WndProc; //In here we are setting the process which will later recieve the messages
wc.hInstance = hInstance; //defining the hInstance
wc.hIconSm = LoadIcon(NULL, IDC_ICON); //defining the icon shown in the taskbar
wc.hIcon = LoadIcon(NULL, IDC_ICON); //defining the actual icon
wc.hCursor = LoadCursor(NULL, IDC_ARROW); //defining the program cursor
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); In here we are just setting the bg as white
wc.cbWndExtra = 0; // NULL
wc.cbSize = sizeof(WNDCLASSEX); // This im really not sure
wc.cbClsExtra = 0; // NULL
if (!RegisterClassEx(&wc))
{
LPCWSTR Error01 = L"Could not register class!";
LPCWSTR Error01_Caption = L"Error";
MessageBox(NULL, Error01, Error01_Caption, MB_OK | MB_ICONERROR);
} //Attempt to register our class.. if it fails then tells us it failed!
LPCWSTR WindowTitle = L"EXAMPLE WINDOW!"; //our title
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, g_szClassName, WindowTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 500, 300, NULL, NULL, hInstance, NULL); //creating our window into the hwnd
if (hwnd == NULL)
{
LPCWSTR Error02 = L"Could not create Window!";
LPCWSTR Error02_Caption = L"Error";
MessageBox(NULL, Error02 , Error02_Caption , MB_OK | MB_ICONERROR);
} //if window creation failed (hwnd is empty) tell us so!
ShowWindow(hwnd, nCmdShow); //Show the window
UpdateWindow(hwnd); // Update the window with the elements (none in this case)
while(GetMessage(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
} //keep translating and sending messages to our WndProc func
return msg.wParam; //returning the msg wParam
}
Okay! So thats it.. very simple right??
I hope you guys have enjoyed and now understand the basics of WIN32 C++ programming...
FULL Source : http://pastebin.com/vSzsnTQR
Video : http://www.youtube.com/watch?v=PFvhXzpXRYg
Embed :
Today I will be teaching on how to use the Win32 WINAPI in C++ to create a GUI...
Ever wondered how so many programs are made in C++ and have a GUI? ... Because of this :P...
In C++ you can also NOT use the CommControls(); (which we will talk about a few tutorials ahead) and design your own... so let´s start...
First ..
Q : Can´t I simply drag and drop stuff like in C# , VB... ?
A : NO! C++ Does not have a designer, it is a 'professional' language and does not belong to any framework...
In this tutorial we will just create a blank window ... next tutorial we will add some controls and learn how to use them.
So let´s start!
Create a Win32 Project (or WinProject) , make sure its a Windows Application and that is setted as 'Empty Project'
Head over to your Source Files and add a .cpp file.. name it whatever you want!
In your new file include the Windows.h!
#include <Windows.h>
That contains nearly anything you need for a basic Win32 C++ GUI Programming...
Okay..
Now you are going to name your program class!
LPCWSTR g_szClassName = L"MainWindow_Class";
Again you can name it whatever you want!
Okay, now you want to create your function that handles the program close and destroy (and in future will handle buttons and stuff..)
First here is just the whole function.... then I will explain it further
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg , WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
Okay so lets start.... well the actual function is just how it is! Its just how it is defined...
so
switch (msg) //This 'handles' anything that we will be later recieving from the WinMain!
{
case WM_CLOSE: //if we close the window
DestroyWindow(hwnd); // destroy it!
break;
case WM_DESTROY: //if we destroy the window
PostQuitMessage(0); //tell the computer that the program has quitted
break;
default: //returning to default
return DefWindowProc(hwnd, msg, wParam, lParam); //return the default window process
}
return 0; //out of the switch return 0 ( null )
Okay!
Now its the actual 'GUI' Designing... its not really designing cuz it will be blank :P
So here is the function and I will later explain it
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
MSG msg;
HWND hwnd;
ZeroMemory(&wc, sizeof(&wc));
wc.style = 0;
wc.lpszClassName = g_szClassName;
wc.lpszMenuName = NULL;
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.hIconSm = LoadIcon(NULL, IDC_ICON);
wc.hIcon = LoadIcon(NULL, IDC_ICON);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wc.cbWndExtra = 0;
wc.cbSize = sizeof(WNDCLASSEX);
wc.cbClsExtra = 0;
if (!RegisterClassEx(&wc))
{
LPCWSTR Error01 = L"Could not register class!";
LPCWSTR Error01_Caption = L"Error";
MessageBox(NULL, Error01, Error01_Caption, MB_OK | MB_ICONERROR);
}
LPCWSTR WindowTitle = L"EXAMPLE WINDOW!";
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, g_szClassName, WindowTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 500, 300, NULL, NULL, hInstance, NULL);
if (hwnd == NULL)
{
LPCWSTR Error02 = L"Could not create Window!";
LPCWSTR Error02_Caption = L"Error";
MessageBox(NULL, Error02 , Error02_Caption , MB_OK | MB_ICONERROR);
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
Okay! So now I will comment it out...
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
MSG msg;
HWND hwnd;
ZeroMemory(&wc, sizeof(&wc)); //We are cleaning the memory so we know we are really starting from scratch
wc.style = 0; //the style of the window is null (default)
wc.lpszClassName = g_szClassName; //the class of the window we are setting it as g_szClassName
wc.lpszMenuName = NULL; //we really dont have a menu name ...
wc.lpfnWndProc = WndProc; //In here we are setting the process which will later recieve the messages
wc.hInstance = hInstance; //defining the hInstance
wc.hIconSm = LoadIcon(NULL, IDC_ICON); //defining the icon shown in the taskbar
wc.hIcon = LoadIcon(NULL, IDC_ICON); //defining the actual icon
wc.hCursor = LoadCursor(NULL, IDC_ARROW); //defining the program cursor
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); In here we are just setting the bg as white
wc.cbWndExtra = 0; // NULL
wc.cbSize = sizeof(WNDCLASSEX); // This im really not sure
wc.cbClsExtra = 0; // NULL
if (!RegisterClassEx(&wc))
{
LPCWSTR Error01 = L"Could not register class!";
LPCWSTR Error01_Caption = L"Error";
MessageBox(NULL, Error01, Error01_Caption, MB_OK | MB_ICONERROR);
} //Attempt to register our class.. if it fails then tells us it failed!
LPCWSTR WindowTitle = L"EXAMPLE WINDOW!"; //our title
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, g_szClassName, WindowTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 500, 300, NULL, NULL, hInstance, NULL); //creating our window into the hwnd
if (hwnd == NULL)
{
LPCWSTR Error02 = L"Could not create Window!";
LPCWSTR Error02_Caption = L"Error";
MessageBox(NULL, Error02 , Error02_Caption , MB_OK | MB_ICONERROR);
} //if window creation failed (hwnd is empty) tell us so!
ShowWindow(hwnd, nCmdShow); //Show the window
UpdateWindow(hwnd); // Update the window with the elements (none in this case)
while(GetMessage(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
} //keep translating and sending messages to our WndProc func
return msg.wParam; //returning the msg wParam
}
Okay! So thats it.. very simple right??
I hope you guys have enjoyed and now understand the basics of WIN32 C++ programming...
FULL Source : http://pastebin.com/vSzsnTQR
Video : http://www.youtube.com/watch?v=PFvhXzpXRYg
Location:
Aveiro District, Portugal
Saturday, February 15, 2014
[C#/Tut] How to make a All Clients dataGrid Tool
Hey everyone!
I Have been inactive for some (a long) time...
Today I am here with a tutorial... I will be teaching you on how to make a All clients grid tool in C#!
I will be making it for MW2 PC (using my PC Library) anyways you can make it for ANY! Platform.. you just need to change the Platform read and write code with yours....
Per example if your on PS3 load ps3tmapi_net.dll and PS3Lib.dll and use the read and write codes...
or If you are on PC but you don´t use my library (you use default ReadProcessMemory and WriteProcessMemory) just replace them :)!
So just to start... :
PC Memory Editor Library (the one that I made and used on this tutorial) : https://www.mediafire.com/?5hb7mwnz770tim7
PC Memory Editor Library codes :
PC Memory Editor Library Tut : http://mw2toptenworld.blogspot.pt/2014/01/release-tut-net-c-vb-pc-trainer-memory.html
PS3 Lib´s : http://www.mediafire.com/?idmw4wlv4eyea0k and ?????????? (ps3tmapi_net.dll)
PS3 Lib codes :
Default PC C# Codes : http://www.jarloo.com/reading-and-writing-to-memory/ (i recommend my lib ;) )
for any other platform just google around!!
So let´s Start!
First just declare the normal stuff (for PS3Lib , ps3tmapi_net or my lib.. if your doing in non-lib PC C# Code then just ignore this step...)
using PC_Memory_Editor___Trainer_Library;
under partial class
MW2TopTenWORLDMemEditor MemEditor = new MW2TopTenWORLDMemEditor();
Second drag a dataGridView from the toolbox , uncheck the togglables 'Allow Delete, Allow Adding and Allow Editing'
Add a button called 'Get Client´s' and in front of the button a label saying 'NOTE : Left click and then right click a client to acess its mod menu'
Add to the dataGrid the rows that you want (I added # , Clients Name and God Mode)
Go to 'Form1_Load' and add these :
dataGridView1.RowCount = 18; <- change 18 with how many players there are (max players) in the game you are modding...
and (if you added the column # )
for (int i = 0; i < 18; i++)
{
dataGridView1.Rows[i].Cells[0].Value = i;
}
^^This code will add to the cell 0 (#) the number 0 then on the next one 1 ... till 17 (we are enumerating the clients)
k! Now go to the button 1 code and add this..
GetNames();
GetGOD();
Obviously if your doing more stuff like 'Unlimited Ammo' also add GetAmmo();
You don´t need to do a GetAmmo for each mod! only for the mods that you want to display as true or false in the grid! :)
Now you obviously want to create some voids for those functions so right after (under) your
public Form1()
{
}
add :
public void GetNames()
{
}
and
public void GetGOD()
{
}
Okay, now we are going to code the GetNames() function....
so add this into it
long client0Name = 0x01AA1A2C; <- defining the client 0 name offset (if on PS3 change to uint)
for (int i = 0; i < 18; i++)
{
long allClientsOffset = client0Name + (0x6CD8 * i); <- adding the interval (defined on the offsets list)
MemEditor.ReadString("iw4mp", allClientsOffset, 15); <- PC Mem Editor Lib Read String func
string Name = File.ReadAllText(@"tmp.txt"); <- Getting the readed memory
File.Delete(@"tmp.txt");<- Deleting the readed memory
dataGridView1.Rows[i].Cells[1].Value = Name; <- Writing the readed memory onto the grid
}
System.Threading.Thread.Sleep(100); <- Telling the program to pause for 100 milisseconds (to prevent crashing
Now if you make a change name button dont forget to add 'GetNames();' to the end of it so it will automatcly refresh names :)!
Okay so now for GetGOD();
long client0Health = 0x018DC174; <- defining client 0 health offset
for (int i = 0; i < 18; i++)
{
long allClientsOffset = client0Health + (0x4E8 * i); <- adding the interval (defined on offsets list)
MemEditor.ReadByte("iw4mp", allClientsOffset, 4); <- reading 4 bytes for each client (00 00 00 00)
string Status = File.ReadAllText(@"tmp.txt"); <- getting the readed memory
File.Delete(@"tmp.txt"); <- deleting the readed memory
if (Status.Contains("64000000")) <- checking if health is 100 (0x64)
{
dataGridView1.Rows[i].Cells[2].Value = "false";
}
else
{
if (Status.Contains("00000000")) <- checking if health is null (player not in game)
{
dataGridView1.Rows[i].Cells[2].Value = "false";
}
else <- else.. (than 100 and null = god)
{
dataGridView1.Rows[i].Cells[2].Value = "true";
}
}
}
System.Threading.Thread.Sleep(100); <- pausing the program for 100 milisseconds
Okay! That is easy :)
Now
create a context menu strip and add whatever mods you want to it..
I addded : GOD Mode -> Give , Remove
onto the dataGridView properties select contextMenuStrip -> contextMenuStrip1
now just code the Give and Remove functions! :)
(click each of them to access their void)
private void giveToolStripMenuItem_Click(object sender, EventArgs e)
{
int currentIndex = dataGridView1.CurrentRow.Index; <- obtaining current grid index
long GodOffset = 0x018DC174; <- client 0 offset
long SelectedClientOffset = GodOffset + (0x4E8 * currentIndex); <- calculating selected client offset
MemEditor.WriteInt("iw4mp", SelectedClientOffset, -1); <- writing god (on PS3 would be 0xFF , 0xFF)
GetGOD(); <- Refreshing GOD Status
}
private void removeToolStripMenuItem_Click(object sender, EventArgs e)
{
int currentIndex = dataGridView1.CurrentRow.Index; <- obtaining current grid index
long GodOffset = 0x018DC174; <- client 0 offset
long SelectedClientOffset = GodOffset + (0x4E8 * currentIndex); <- calculating selected client offset
MemEditor.WriteInt("iw4mp", SelectedClientOffset, 100); <- removing god (on PS3 would be 0x64 , 0x00 or 0x00 , 0x64)
GetGOD(); <- Refreshing GOD Status
}
Well thats it!
Full paste bin source : http://pastebin.com/H0DeVfWS
Video : http://www.youtube.com/watch?v=vJYCDc6-6EE
Embed :
I Have been inactive for some (a long) time...
Today I am here with a tutorial... I will be teaching you on how to make a All clients grid tool in C#!
I will be making it for MW2 PC (using my PC Library) anyways you can make it for ANY! Platform.. you just need to change the Platform read and write code with yours....
Per example if your on PS3 load ps3tmapi_net.dll and PS3Lib.dll and use the read and write codes...
or If you are on PC but you don´t use my library (you use default ReadProcessMemory and WriteProcessMemory) just replace them :)!
So just to start... :
PC Memory Editor Library (the one that I made and used on this tutorial) : https://www.mediafire.com/?5hb7mwnz770tim7
PC Memory Editor Library codes :
Write Functions :
WriteInt - Writes an Integer number to the desired offset
MemEditor.WriteInt(string ProcessName, long OffsetToWrite, long WhatToWrite);
Example : MemEditor.WriteInt("iw4mp", 0x01B2C8723, 999999999); //or ..723, Convert.ToInt64(textBox1.Text);
WriteFloat - Writes a Float value to the desired offset
MemEditor.WriteFloat(string ProcessName, long OffsetToWrite, string WhatToWrite);
WriteString - Writes text to the desired offset
MemEditor.WriteString(string ProcessName, long OffsetToWrite, string WhatToWrite);
WriteByte - Writes a byte to the desired offset
MemEditor.WriteByte(string ProcessName, long OffsetToWrite, byte[] Buffer);
WriteDouble - Writes a double to the desired offset
MemEditor.WriteDouble(string ProcessName, long OffsetToWrite, double WhatToWrite);
READ Functions :
How to use : (make sure you have using System.IO;)
READCODE;
textBoxX.Clear();
textBoxX.Text = Convert.ToString(File.ReadAllText(@"tmp.txt");
File.Delete(@"tmp.txt");
ReadInt - Reads an integer from desired offset to a file
MemEditor.ReadInt(string ProcessName, long OffsetToWrite, int LengthToRead); (usually set length as 9!)
ReadFloat - Reads a float from desired offset to a file
MemEditor.ReadFloat(string ProcessName, long OffsetToWrite, int LengthToRead); (usually set length as 4)
ReadString - Reads text from desired offset to a file
MemEditor.ReadString(string ProcessName, long OffsetToWrite, int LengthToRead); (usually set length as whatever the max chars for what you reading is! (example max chars for class name is 15)
ReadByte - Reads byte from desired offset to a file
MemEditor.ReadByte(string ProcessName, long OffsetToWrite, int LengthToRead);
ReadDouble - Reads a double from desired offset to a file
MemEditor.ReadDouble(string ProcessName, long OffsetToWrite, int LengthToRead);
PC Memory Editor Library Tut : http://mw2toptenworld.blogspot.pt/2014/01/release-tut-net-c-vb-pc-trainer-memory.html
PS3 Lib´s : http://www.mediafire.com/?idmw4wlv4eyea0k and ?????????? (ps3tmapi_net.dll)
PS3 Lib codes :
PS3TMAPI.ProcessSetMemory(0, PS3TMAPI.UnitType.PPU, ProcessID, 0, Address, bytes);
byte[] iMCSx = new byte[0x20];
PS3TMAPI.ProcessGetMemory(0, PS3TMAPI.UnitType.PPU, ProcessID, 0, Address, ref iMCSx);
Default PC C# Codes : http://www.jarloo.com/reading-and-writing-to-memory/ (i recommend my lib ;) )
for any other platform just google around!!
So let´s Start!
First just declare the normal stuff (for PS3Lib , ps3tmapi_net or my lib.. if your doing in non-lib PC C# Code then just ignore this step...)
using PC_Memory_Editor___Trainer_Library;
under partial class
MW2TopTenWORLDMemEditor MemEditor = new MW2TopTenWORLDMemEditor();
Second drag a dataGridView from the toolbox , uncheck the togglables 'Allow Delete, Allow Adding and Allow Editing'
Add a button called 'Get Client´s' and in front of the button a label saying 'NOTE : Left click and then right click a client to acess its mod menu'
Add to the dataGrid the rows that you want (I added # , Clients Name and God Mode)
Go to 'Form1_Load' and add these :
dataGridView1.RowCount = 18; <- change 18 with how many players there are (max players) in the game you are modding...
and (if you added the column # )
for (int i = 0; i < 18; i++)
{
dataGridView1.Rows[i].Cells[0].Value = i;
}
^^This code will add to the cell 0 (#) the number 0 then on the next one 1 ... till 17 (we are enumerating the clients)
k! Now go to the button 1 code and add this..
GetNames();
GetGOD();
Obviously if your doing more stuff like 'Unlimited Ammo' also add GetAmmo();
You don´t need to do a GetAmmo for each mod! only for the mods that you want to display as true or false in the grid! :)
Now you obviously want to create some voids for those functions so right after (under) your
public Form1()
{
}
add :
public void GetNames()
{
}
and
public void GetGOD()
{
}
Okay, now we are going to code the GetNames() function....
so add this into it
long client0Name = 0x01AA1A2C; <- defining the client 0 name offset (if on PS3 change to uint)
for (int i = 0; i < 18; i++)
{
long allClientsOffset = client0Name + (0x6CD8 * i); <- adding the interval (defined on the offsets list)
MemEditor.ReadString("iw4mp", allClientsOffset, 15); <- PC Mem Editor Lib Read String func
string Name = File.ReadAllText(@"tmp.txt"); <- Getting the readed memory
File.Delete(@"tmp.txt");<- Deleting the readed memory
dataGridView1.Rows[i].Cells[1].Value = Name; <- Writing the readed memory onto the grid
}
System.Threading.Thread.Sleep(100); <- Telling the program to pause for 100 milisseconds (to prevent crashing
Now if you make a change name button dont forget to add 'GetNames();' to the end of it so it will automatcly refresh names :)!
Okay so now for GetGOD();
long client0Health = 0x018DC174; <- defining client 0 health offset
for (int i = 0; i < 18; i++)
{
long allClientsOffset = client0Health + (0x4E8 * i); <- adding the interval (defined on offsets list)
MemEditor.ReadByte("iw4mp", allClientsOffset, 4); <- reading 4 bytes for each client (00 00 00 00)
string Status = File.ReadAllText(@"tmp.txt"); <- getting the readed memory
File.Delete(@"tmp.txt"); <- deleting the readed memory
if (Status.Contains("64000000")) <- checking if health is 100 (0x64)
{
dataGridView1.Rows[i].Cells[2].Value = "false";
}
else
{
if (Status.Contains("00000000")) <- checking if health is null (player not in game)
{
dataGridView1.Rows[i].Cells[2].Value = "false";
}
else <- else.. (than 100 and null = god)
{
dataGridView1.Rows[i].Cells[2].Value = "true";
}
}
}
System.Threading.Thread.Sleep(100); <- pausing the program for 100 milisseconds
Okay! That is easy :)
Now
create a context menu strip and add whatever mods you want to it..
I addded : GOD Mode -> Give , Remove
onto the dataGridView properties select contextMenuStrip -> contextMenuStrip1
now just code the Give and Remove functions! :)
(click each of them to access their void)
private void giveToolStripMenuItem_Click(object sender, EventArgs e)
{
int currentIndex = dataGridView1.CurrentRow.Index; <- obtaining current grid index
long GodOffset = 0x018DC174; <- client 0 offset
long SelectedClientOffset = GodOffset + (0x4E8 * currentIndex); <- calculating selected client offset
MemEditor.WriteInt("iw4mp", SelectedClientOffset, -1); <- writing god (on PS3 would be 0xFF , 0xFF)
GetGOD(); <- Refreshing GOD Status
}
private void removeToolStripMenuItem_Click(object sender, EventArgs e)
{
int currentIndex = dataGridView1.CurrentRow.Index; <- obtaining current grid index
long GodOffset = 0x018DC174; <- client 0 offset
long SelectedClientOffset = GodOffset + (0x4E8 * currentIndex); <- calculating selected client offset
MemEditor.WriteInt("iw4mp", SelectedClientOffset, 100); <- removing god (on PS3 would be 0x64 , 0x00 or 0x00 , 0x64)
GetGOD(); <- Refreshing GOD Status
}
Well thats it!
Full paste bin source : http://pastebin.com/H0DeVfWS
Video : http://www.youtube.com/watch?v=vJYCDc6-6EE
Location:
Aveiro District, Portugal
Subscribe to:
Comments (Atom)