DWORD ParkedLimit = 1000; // лимит парковки на карте = 185
DWORD ParkedInView = 127; // лимит парковки в зоне видимости = 10, максимум = 127
template<typename T>void Patch(DWORD Address, T Value) {
auto Pointer = (T *)Address;
unsigned long Protect;
VirtualProtect(Pointer, sizeof(T), PAGE_READWRITE, &Protect);
* Pointer = Value;
VirtualProtect(Pointer, sizeof(T), Protect, &Protect);
}
struct RwV3d {
float x, y, z;
};
class CCarGenerator {
public:
DWORD id;
RwV3d pos;
DWORD angle;
WORD color1;
WORD color2;
BYTE forceSpawn;
BYTE alarm;
BYTE doorLock;
BYTE field_1B;
WORD minDelay;
WORD maxDelay;
DWORD timeNextGen;
DWORD ProcessedVehicleHandle;
WORD enabled;
BYTE field_2A;
BYTE field_2B;
};
CCarGenerator * CarGenerator; // новый блок парковки
CarGenerator = new CCarGenerator[ParkedLimit]; // выделение памяти на 1000 машин
// перенаправление со старого блока на новый
Patch(0x4537A9, (DWORD)CarGenerator);
Patch(0x5A6C5F, (DWORD)CarGenerator);
Patch(0x5A6CC3, (DWORD)CarGenerator);
Patch(0x5A69DB, (DWORD)CarGenerator);
Patch(0x5A6B16, (DWORD)CarGenerator);
Patch(0x5A69E6, (DWORD)&CarGenerator->pos.x);
Patch(0x5A6B22, (DWORD)&CarGenerator->pos.x);
Patch(0x5A69F1, (DWORD)&CarGenerator->pos.y);
Patch(0x5A6B2A, (DWORD)&CarGenerator->pos.y);
Patch(0x5A69FC, (DWORD)&CarGenerator->pos.z);
Patch(0x5A6B35, (DWORD)&CarGenerator->pos.z);
Patch(0x5A6A07, (DWORD)&CarGenerator->angle);
Patch(0x5A6B40, (DWORD)&CarGenerator->angle);
Patch(0x5A6A14, (DWORD)&CarGenerator->color1);
Patch(0x5A6B4C, (DWORD)&CarGenerator->color1);
Patch(0x5A6A21, (DWORD)&CarGenerator->color2);
Patch(0x5A6B5C, (DWORD)&CarGenerator->color2);
Patch(0x5A6A2A, (DWORD)&CarGenerator->forceSpawn);
Patch(0x5A6B65, (DWORD)&CarGenerator->forceSpawn);
Patch(0x5A6A33, (DWORD)&CarGenerator->alarm);
Patch(0x5A6B6E, (DWORD)&CarGenerator->alarm);
Patch(0x5A6A3C, (DWORD)&CarGenerator->doorLock);
Patch(0x5A6B77, (DWORD)&CarGenerator->doorLock);
Patch(0x5A6A49, (DWORD)&CarGenerator->minDelay);
Patch(0x5A6B85, (DWORD)&CarGenerator->minDelay);
Patch(0x5A6A56, (DWORD)&CarGenerator->maxDelay);
Patch(0x5A6B95, (DWORD)&CarGenerator->maxDelay);
Patch(0x5A6A61, (DWORD)&CarGenerator->timeNextGen);
Patch(0x5A6BA1, (DWORD)&CarGenerator->timeNextGen);
Patch(0x5A6A6C, (DWORD)&CarGenerator->ProcessedVehicleHandle);
Patch(0x5A6BAC, (DWORD)&CarGenerator->ProcessedVehicleHandle);
Patch(0x5A6A79, (DWORD)&CarGenerator->enabled);
Patch(0x5A6BB8, (DWORD)&CarGenerator->enabled);
Patch(0x5A6A85, (DWORD)&CarGenerator->field_2A);
Patch(0x5A6BC1, (DWORD)&CarGenerator->field_2A);
Patch(0x5A6C16, (DWORD)ParkedLimit); // перезапись лимита парковки
Patch(0x5A71D0, (BYTE)ParkedInView); // перезапись лимита парковки в зоне видимости