Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Threading;
- using System.Diagnostics;
- using System.Runtime.InteropServices;
- namespace GodMode
- {
- class Program
- {
- /*
- "gta-sa.exe"+0076F3B8
- Offset: 540
- */
- // get key press states
- [DllImport("user32.dll")]
- static extern short GetAsyncKeyState(int vKey);
- // game exe name
- static string processName = "gta-sa";
- // addresses & offsets
- static int playerAddress = 0x76F3B8;
- static int playerHealthOffset = 0x540;
- // toggles
- static bool godMode;
- static void Main(string[] args) // Main Function
- {
- // attach to process
- VAMemory vam = new VAMemory(processName);
- // get base address of the process
- int baseAddress = (int)Process.GetProcessesByName(processName)[0].MainModule.BaseAddress;
- // get player base address by adding base address & player address
- int playerBaseAddress = vam.ReadInt32((IntPtr)baseAddress + playerAddress);
- // get player health address by adding player base address & player health offset
- int playerHealthAddress = playerBaseAddress + playerHealthOffset;
- // read player health at player health address
- var playerHealth = vam.ReadFloat((IntPtr)playerHealthAddress);
- // log current player health in console
- Console.WriteLine("Current Player Health: " + playerHealth);
- while (true) // infinite loop
- {
- if (GetAsyncKeyState(74) != 0) // check if J key is pressed
- {
- godMode = !godMode; // toggle god mode state
- Console.WriteLine("God Mode: " + godMode); // log current god mode state
- Console.Beep(godMode ? 5000 : 500, 250); // sound to distinguish god mode state in-game
- Thread.Sleep(250); // sleep to delay key press
- }
- if (godMode) // if god mode loop
- {
- vam.WriteFloat((IntPtr)playerHealthAddress, 100); // constantly write 100 (max health value) at player health address for god mode
- }
- Thread.Sleep(10); // sleep to reduce cpu load
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment