Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // <Snow>
- bool featureXmas = false;
- bool featureXmasUpdated = false;
- void EnableSnow(bool bEnable)
- {
- auto SnowPtn = Memory::findAOB("74 25 B9 40 ? ? ? E8 ? ? C4 FF");
- char * SnowPtr = reinterpret_cast<char*>(SnowPtn);
- static void * nop_location = SnowPtr;
- // Original Memory
- static uint8_t original1[20] = { 0 };
- // Initialize
- static bool bInitialized = false;
- if (!bInitialized)
- {
- if (nop_location != nullptr)
- {
- // Unprotect Memory
- unsigned long OldProtection;
- VirtualProtect(nop_location, 20, PAGE_EXECUTE_READWRITE, &OldProtection);
- // Backup original Memory
- memcpy(&original1, nop_location, 20);
- // Reprotect Memory
- VirtualProtect(nop_location, 20, OldProtection, NULL);
- bInitialized = true;
- }
- else
- {
- notifyTop("Enabling Snow is not supported on this version of GTA V", 5000, 0);
- return;
- }
- }
- if (bEnable) {
- // nop bytes
- if (nop_location != nullptr)
- memset(nop_location, 0x90, 20);
- // Set Xmas Weather
- GAMEPLAY::SET_WEATHER_TYPE_NOW_PERSIST("XMAS");
- // enable Tracks
- GRAPHICS::_SET_FORCE_PED_FOOTSTEPS_TRACKS(1);
- GRAPHICS::_SET_FORCE_VEHICLE_TRAILS(1);
- }
- else {
- // Unprotect Memory
- unsigned long OldProtection;
- VirtualProtect(nop_location, 20, PAGE_EXECUTE_READWRITE, &OldProtection);
- // Restore original memory
- memcpy(nop_location, &original1, 20);
- // Reprotect Memory
- VirtualProtect(nop_location, 20, OldProtection, NULL);
- // Set Clear Weather
- GAMEPLAY::SET_WEATHER_TYPE_NOW_PERSIST("CLEAR");
- // remove Tracks
- GRAPHICS::_SET_FORCE_PED_FOOTSTEPS_TRACKS(0);
- GRAPHICS::_SET_FORCE_VEHICLE_TRAILS(0);
- }
- }
- // < /Snow>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement