Guest User

Untitled

a guest
Apr 24th, 2023
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. #define WIN32_LEAN_AND_MEAN
  2. #include <Windows.h>
  3.  
  4. #include <cstdint>
  5. #include <thread>
  6.  
  7. #include "offsets.h"
  8.  
  9. //offsets in offsets.h
  10.  
  11. //hack function
  12. void BunnyHop(const HMODULE instance) noexcept
  13. {
  14. const auto client = reinterpret_cast<std::uintptr_t>(GetModuleHandle("client.dll"));
  15.  
  16. //hack loop
  17. while (!GetAsyncKeyState(VK_END))
  18. {
  19. std::this_thread::sleep_for(std::chrono::milliseconds(1));
  20.  
  21. //make sure space is pressed
  22. if (!GetAsyncKeyState(VK_SPACE))
  23. continue;
  24.  
  25. //get local player
  26. const auto localPlayer = *reinterpret_cast<std::uintptr_t*>(client + offset::dwLocalPlayer);
  27.  
  28. //is valid
  29. if (!localPlayer)
  30. continue;
  31.  
  32. const auto health = *reinterpret_cast<std::int32_t*>(localPlayer + offset::m_iHealth);
  33.  
  34. //is alive
  35. if (!health)
  36. continue;
  37.  
  38. const auto flags = *reinterpret_cast<std::int32_t*>(localPlayer + offset::m_fFlags);
  39.  
  40. //on ground
  41. (flags & (1 << 0)) ?
  42. *reinterpret_cast<std::uintptr_t*>(client + offset::dwForceJump) = 6 : //force jump
  43. *reinterpret_cast<std::uintptr_t*>(client + offset::dwForceJump) = 4; //reset
  44. }
  45.  
  46. //uninject
  47. FreeLibraryAndExitThread(instance, 0);
  48. }
  49.  
  50. // entry point
  51.  
  52. int __stdcall DllMain(
  53. const HMODULE instance,
  54. const std::uintptr_t reason,
  55. const void* reserved
  56. )
  57. {
  58. //DLL_PROCESS_ATTACH
  59. if (reason == 1)
  60. {
  61. DisableThreadLibraryCalls(instance);
  62.  
  63. //create Hack Thread
  64. const auto thread = CreateThread(
  65. nullptr,
  66. 0,
  67. reinterpret_cast<LPTHREAD_START_ROUTINE>(BunnyHop),
  68. instance,
  69. 0,
  70. nullptr
  71. );
  72.  
  73. if (thread)
  74. CloseHandle(thread);
  75. }
  76. return 1;
  77. }
Add Comment
Please, Sign In to add comment