public static float GetHealth(ProcessMemory processMemory) { long baseAddress = processMemory.BaseToLong() + BaseAddress; float health = processMemory.Read(baseAddress, offsetsHealth); return(health * 100); }
public static void ExplosionDamage(ProcessMemory processMemory, bool enabled) { int instructionCounter = 3; long[] explosionDamageAddress = { 0xECE52, 0xEC7F3, 0xEC805 }; byte?[,] assemblyOriginalInstructions = { { 0xD9, 0x5E, 0x24, null }, { 0xD9, 0x56, 0x24, null }, { 0xC7, 0x46, 0x24, 0 } }; byte?[,] assemblyModifiedInstructions = { { nop, nop, nop, null, null, null, null }, { nop, nop, nop, null, null, null, null }, { nop, nop, nop, nop, nop, nop, nop } }; while (instructionCounter-- > 0) { explosionDamageAddress[instructionCounter] += processMemory.BaseToLong(); byte[] assemblyInstruction = enabled ? GetByteArray(assemblyOriginalInstructions, instructionCounter) : GetByteArray(assemblyModifiedInstructions, instructionCounter); processMemory.Write((int)explosionDamageAddress[instructionCounter], assemblyInstruction, (uint)assemblyInstruction.Length); } }
public static void SetGivenAmmunition(ProcessMemory processMemory, Weapon weapon, int quantity) { int baseAddress = 0x004DA7F4; byte[] ammoByte = BitConverter.GetBytes(quantity); int offset = default; switch (weapon) { case Weapon.Beretta92F: offset = 0x4C; break; case Weapon.Beretta92F_Silenced: offset = 0x80; break; case Weapon.Heckler_KochMP5: offset = 0xE8; break; case Weapon.SPAS12: offset = 0x150; break; case Weapon.Uzi: offset = 0xB4; break; case Weapon.MAC11: offset = 0x1B8; break; case Weapon.M16: offset = 0x11C; break; case Weapon.M79_Grenade_Launcher: offset = 0x184; break; } long newAddrress = processMemory.BaseToLong() + baseAddress; if (offset > 0) { processMemory.Write(newAddrress, ammoByte, new int[] { offset }); } }
public static void ShotDamage(ProcessMemory processMemory, bool enabled) { int shotBaseAddress = 0xECAE6; long newShotDamageAddress = processMemory.BaseToLong() + shotBaseAddress; byte[] assemblyInstruction = enabled ? new byte[] { 0xD9, 0x56, 0x24 } : nopInstruction; processMemory.Write((int)newShotDamageAddress, assemblyInstruction, (uint)assemblyInstruction.Length); }
public static void SetGivenHealth(ProcessMemory processMemory, int percentage) { if (percentage > 100 ^ percentage < 0) { throw new ArgumentOutOfRangeException("Percentage has to be between 0 and 100."); } byte[] percentageByte = BitConverter.GetBytes(percentage / 100f); long baseAddress = processMemory.BaseToLong() + BaseAddress; processMemory.Write(baseAddress, percentageByte, offsetsHealth); }
public static void SetInfiniteAmmunition(ProcessMemory processMemory, bool isInfinite) { int baseAddress = 0x102179; long newAddrress = processMemory.BaseToLong() + baseAddress; byte[] assemblyInstruction; if (isInfinite) { assemblyInstruction = BitConverter.GetBytes(0x90); } else { assemblyInstruction = BitConverter.GetBytes(0x4A); } processMemory.Write((int)newAddrress, assemblyInstruction, 1); }
public static void PlayerCrashVehicleDamage(ProcessMemory processMemory, bool enabled) { int carDamageBaseAddress = 0xEC7F3; long newCarDamageAddress = processMemory.BaseToLong() + carDamageBaseAddress; byte[] assemblyInstruction; if (enabled) { assemblyInstruction = new byte[] { 0xD9, 0x56, 0x24 } } ; else { assemblyInstruction = nopInstruction; } processMemory.Write((int)newCarDamageAddress, assemblyInstruction, (uint)assemblyInstruction.Length); }