Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool featureXmas = false;
- bool featureXmasUpdated = false;
- bool VehicleTracks = false;
- bool PedTracks = false;
- bool VehicleTrackDepth = false;
- bool PedTrackDepth = false;
- // <Snow>
- void EnableTracks(bool tracksVehicle = false, bool tracksPeds = false, bool deepTracksVehicle = false, bool deepTracksPed = false)
- {
- static auto VAR_FeetSnowTracks_call = Memory::findPattern("\x80\x3D\x00\x00\x00\x00\x00\x48\x8B\xD9\x74\x37", "xx?????xxxxx");
- if (!VAR_FeetSnowTracks_call)
- {
- return;
- }
- static auto VAR_FeetSnowTracks = VAR_FeetSnowTracks_call + (*(int32_t *)(VAR_FeetSnowTracks_call + 2)) + 7;
- //
- static auto VAR_VehicleSnowTracks_call = Memory::findPattern("\x40\x38\x3D\x00\x00\x00\x00\x48\x8B\x42\x20", "xxx????xxxx");
- if (!VAR_VehicleSnowTracks_call)
- {
- return;
- }
- static auto VAR_VehicleSnowTracks = VAR_VehicleSnowTracks_call + (*(int32_t *)(VAR_VehicleSnowTracks_call + 3)) + 7;
- //
- VirtualProtect((void*)VAR_FeetSnowTracks, 1, PAGE_EXECUTE_READWRITE, nullptr);
- VirtualProtect((void*)VAR_VehicleSnowTracks, 1, PAGE_EXECUTE_READWRITE, nullptr);
- // Enable/Disable Vehicle/Foot Snow tracks
- *(uint8_t *)VAR_FeetSnowTracks = tracksVehicle;
- *(uint8_t *)VAR_VehicleSnowTracks = tracksPeds;
- // Switch for big/small tracks
- static auto vehicleTrackTypes = Memory::findPattern("\xB9\x00\x00\x00\x00\x84\xC0\x44\x0F\x44\xF1", "x????xxxxxx");
- if (!vehicleTrackTypes)
- {
- return;
- }
- VirtualProtect((void*)vehicleTrackTypes, 1, PAGE_EXECUTE_READWRITE, nullptr);
- *(uint8_t *)(vehicleTrackTypes + 1) = deepTracksVehicle ? 0x13 : 0x14;
- static auto pedTrackTypes = Memory::findPattern("\xB9\x00\x00\x00\x00\x84\xC0\x0F\x44\xD9\x48\x8B\x4F\x30", "x????xxxxxxxxx");
- if (!pedTrackTypes)
- {
- return;
- }
- VirtualProtect((void*)pedTrackTypes, 1, PAGE_EXECUTE_READWRITE, nullptr);
- *(uint8_t *)(pedTrackTypes + 1) = deepTracksPed ? 0x13 : 0x14;
- }
- // Snow
- void EnableSnow(bool bEnable)
- {
- // Snow Address
- static auto addr = Memory::findPattern("\x74\x25\xB9\x00\x00\x00\x00\xE8\x00\x00\x00\x00", "xxx????x????");
- // Outdated
- if (!addr)
- {
- notifyTop("Enabling Snow is not possbile on this version of GTA V", 5000, 0);
- featureXmas = false; // Disable snow
- return;
- }
- // Original Memory
- static uint8_t original[20] = { 0 };
- static size_t num = sizeof(original);
- // Initialize
- static bool bInitialized = false;
- if (!bInitialized)
- {
- bInitialized = true;
- // Unprotect Memory
- VirtualProtect((void*)addr, num, PAGE_EXECUTE_READWRITE, nullptr);
- // Copy original Memory
- memcpy(&original, (void*)addr, num);
- }
- if (bEnable)
- {
- // Weather
- GAMEPLAY::SET_WEATHER_TYPE_NOW_PERSIST("XMAS");
- // NOP
- memset((void*)addr, 0x90, num);
- // Tracks on
- EnableTracks(VehicleTracks, PedTracks, VehicleTrackDepth, PedTrackDepth);
- // Notification
- notifyTop("Snow Enabled", 5000, 0);
- }
- else
- {
- // Weather
- GAMEPLAY::CLEAR_WEATHER_TYPE_PERSIST();
- GAMEPLAY::SET_WEATHER_TYPE_NOW("CLEAR");
- // Reset original memory
- memcpy((void*)addr, &original, num);
- // Tracks off
- EnableTracks();
- // Notification
- notifyTop("Snow Disabled", 5000, 0);
- }
- }
- //your menu
- { "Christmas", "XMAS", &featureXmas, &featureXmasUpdated },
- //your ontick function
- if (featureXmasUpdated)
- {
- featureXmasUpdated = false;
- if (featureXmas) {
- VehicleTracks = featureXmas;
- PedTracks = featureXmas;
- VehicleTrackDepth = featureXmas;
- PedTrackDepth = featureXmas;
- EnableSnow(featureXmas);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement