Guest User

All Clients Grid Example

a guest
Feb 15th, 2014
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.50 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.IO;
  11. using PC_Memory_Editor___Trainer_Library;
  12.  
  13. namespace Youtube_datagrid_tutorial___clients_table
  14. {
  15.     public partial class Form1 : Form
  16.     {
  17.         MW2TopTenWORLDMemEditor MemEditor = new MW2TopTenWORLDMemEditor();
  18.  
  19.         public Form1()
  20.         {
  21.             InitializeComponent();
  22.         }
  23.  
  24.         public void GetNames()
  25.         {
  26.             long client0Name = 0x01AA1A2C;
  27.            
  28.             for (int i = 0; i < 18; i++)
  29.             {
  30.                 long allClientsOffset = client0Name + (0x6CD8 * i);
  31.                 MemEditor.ReadString("iw4mp", allClientsOffset, 15);
  32.                 string Name = File.ReadAllText(@"tmp.txt");
  33.                 File.Delete(@"tmp.txt");
  34.                 dataGridView1.Rows[i].Cells[1].Value = Name;
  35.             }
  36.             System.Threading.Thread.Sleep(100);
  37.         }
  38.        
  39.         public void GetGOD()
  40.         {
  41.             long client0Health = 0x018DC174;
  42.  
  43.             for (int i = 0; i < 18; i++)
  44.             {
  45.                 long allClientsOffset = client0Health + (0x4E8 * i);
  46.                
  47.                 MemEditor.ReadByte("iw4mp", allClientsOffset, 4);
  48.  
  49.                 string Status = File.ReadAllText(@"tmp.txt");
  50.  
  51.                 File.Delete(@"tmp.txt");
  52.  
  53.                 //byte[] NormalHealth = new byte[] { 0x64, 0x00, 0x00, 0x00 };
  54.  
  55.                 if (Status.Contains("64000000"))
  56.                 {
  57.                     dataGridView1.Rows[i].Cells[2].Value = "false";
  58.                 }
  59.                 else
  60.                 {
  61.                     if (Status.Contains("00000000"))
  62.                     {
  63.                         dataGridView1.Rows[i].Cells[2].Value = "false";
  64.                     }
  65.             else
  66.             {
  67.                     dataGridView1.Rows[i].Cells[2].Value = "true";
  68.                 }
  69.                 }
  70.             }
  71.             System.Threading.Thread.Sleep(100);
  72.         }
  73.         private void connectToModernWarfare2ToolStripMenuItem_Click(object sender, EventArgs e)
  74.         {
  75.             //PS3 Connect code here
  76.             MemEditor.Connect("iw4mp", "Congratulations :)", "Oops :(");
  77.         }
  78.  
  79.         private void Form1_Load(object sender, EventArgs e)
  80.         {
  81.             dataGridView1.RowCount = 18;
  82.             //
  83.             for (int i = 0; i < 18; i++)
  84.             {
  85.                 dataGridView1.Rows[i].Cells[0].Value = i;
  86.             }
  87.         }
  88.  
  89.         private void button1_Click(object sender, EventArgs e)
  90.         {
  91.             GetNames();
  92.             GetGOD();
  93.         }
  94.  
  95.         private void giveToolStripMenuItem_Click(object sender, EventArgs e)
  96.         {
  97.             int currentIndex = dataGridView1.CurrentRow.Index;
  98.  
  99.             long GodOffset = 0x018DC174;
  100.  
  101.             long SelectedClientOffset = GodOffset + (0x4E8 * currentIndex);
  102.  
  103.             MemEditor.WriteInt("iw4mp", SelectedClientOffset, -1);
  104.  
  105.             GetGOD();
  106.         }
  107.  
  108.         private void removeToolStripMenuItem_Click(object sender, EventArgs e)
  109.         {
  110.             int currentIndex = dataGridView1.CurrentRow.Index;
  111.  
  112.             long GodOffset = 0x018DC174;
  113.  
  114.             long SelectedClientOffset = GodOffset + (0x4E8 * currentIndex);
  115.  
  116.             MemEditor.WriteInt("iw4mp", SelectedClientOffset, 100);
  117.  
  118.             GetGOD();
  119.         }
  120.     }
  121. }
Advertisement
Add Comment
Please, Sign In to add comment