Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "plugin.h"
- #include "common.h"
- #include "CBaseModelInfo.h"
- #include "CCarAI.h"
- #include "CCarCtrl.h"
- #include "CDarkel.h"
- #include "CHud.h"
- #include "CCheat.h"
- #include "CPed.h"
- #include "CPlayerPed.h"
- #include "CPedModelInfo.h"
- #include "CModelInfo.h"
- #include "CObject.h"
- #include "CPickup.h"
- #include "CPickups.h"
- #include "CTheZones.h"
- #include "CVector.h"
- #include "CVehicle.h"
- #include "CVehicleModelInfo.h"
- #include "CPool.h"
- #include "CPools.h"
- #include "CStats.h"
- #include "CStreaming.h"
- #include "CWeaponModelInfo.h"
- #include <string>
- #include <algorithm>
- #include <array>
- #include <functional>
- #include <iostream>
- #include <sstream>
- #include <string>
- #include <vector>
- #import <msxml6.dll> raw_interfaces_only
- // using namespace MSXML2;
- using namespace plugin;
- enum ePoliceCarOccupants : unsigned int {
- FOUR_OCCUPANTS,
- DRIVER_AND_GUNMAN,
- ONE_OCCUPANT,
- TWO_OCCUPANTS,
- EMPTY_VEHICLE
- };
- enum ePedInCar : unsigned int {
- FIREMEN_IN_CAR,
- MEDICS_IN_CAR,
- SWAT_IN_CAR,
- COPS_IN_CAR,
- ARMY_IN_CAR,
- FBI_IN_CAR,
- COP_BIKER,
- TRAIN_DRIVER,
- RANDOM_PED_MODEL
- };
- enum eRoadblockCops : unsigned int {
- ROADBLOCK_SWAT,
- ROADBLOCK_ARMY,
- ROADBLOCK_FBI,
- ROADBLOCK_COP,
- ROADBLOCK_DEF
- };
- enum eLawEnforcementVehicle : unsigned int {
- LAW_VEHICLE,
- CIV_VEHICLE
- };
- enum eUGLevelName : unsigned int {
- UG_COUNTRY_SIDE,
- UG_LOS_SANTOS,
- UG_SAN_FIERRO,
- UG_LAS_VENTURAS,
- UG_LIBERTY_CITY,
- UG_VICE_CITY,
- UG_ATLANTIS,
- UG_BULLWORTH,
- UG_MAIN_LAND_LIBERTY,
- UG_THE_DESERT
- };
- enum eDriverModelForCar : unsigned int {
- LIMO_DRIVER,
- TAXI_DRIVER,
- HOTDOG_DELIVERY,
- SECURITY_GUARD,
- PIZZA_DELIVERY,
- FREEWAY_BIKE_DRIVER,
- BICYCLE_DRIVER,
- DRIVER_DEFAULT
- };
- enum ePlaneMission : unsigned int {
- PLANE_ATTACK_PLAYER = 0x23,
- PLANE_FLY_IN_DIRECTION = 0x24,
- PLANE_FOLLOW_ENTITY = 0x25,
- PLANE_ATTACK_PLAYER_USING_DOG_FIGHT = 0x3F
- };
- enum eHeliMission : unsigned int {
- HELI_ATTACK_PLAYER = 0x17,
- HELI_FOLLOW_ENTITY = 0x27,
- POLICE_HELI_CHASE_ENTITY = 0x28,
- HELI_LAND_AT_COORDS = 0x2F,
- HELI_KEEP_ENTITY_IN_VIEW = 0x33,
- MAKE_HELI_COME_CRASHING_DOWN = 0x3A
- };
- char MaxStars;
- ushort MaxChaos = -1;
- int _cheatStringHashes;
- int maxChaosPntr;
- int maxWantedStarsPntr;
- int _playerStatsInteger;
- int bribesCollected;
- int StarLimit = 0x0C; int BribesCollected; byte heliSpeed = 0; bool addNewsHeli = false; bool enableJurisdiction = 1;
- int pedModel; int pedModelCase; int roadblockPed; int roadblockPedCase; int jurisdiction; int voice1; int voice2;
- int copCarByTown; int copPedByTown;
- uint lowestCase; uint highestCase; char maxSwitchTableValues; int SwitchTableStart;
- int vehType; int city;
- int table1; int table2; int table3; int table4; int table9;
- int table1Pos; int table2Pos; int table3Pos; int table4Pos; int table9Pos; int vehTypeBike;
- DWORD copBikeByTown = plugin::patch::GetUInt(0x407C7C + 1);
- DWORD copBikePed = plugin::patch::GetUInt(0x407C6B + 1);
- int LoadedObjectInfo = plugin::patch::GetUInt(0x4044C7 + 3);
- class WantedLevelEditor {
- public:
- WantedLevelEditor() {
- // plugin::patch::Nop(0x41C140, 2); plugin::patch::Nop(0x41C142, 2); // NOP shotgunChance
- std::array<byte, 65536> TABLE_1; std::array<byte, 65536> TABLE_2;
- std::array<byte, 65536> TABLE_3; std::array<byte, 65536> TABLE_4; std::array<byte, 65536> TABLE_9;
- TABLE_1.fill(3); TABLE_2.fill(8); TABLE_3.fill(4); TABLE_4.fill(1);
- TABLE_9.fill(6);
- plugin::patch::SetUInt(0x41C0A6, 0x2246BF0F); plugin::patch::SetUInt(0x613A68, 0x2247BF0F);
- plugin::patch::SetUInt(0x46130F, 0x2247BF0F); plugin::patch::SetUInt(0x6D2370, 0x2241BF0F);
- plugin::patch::SetUChar(0x41C0A6 + 4, 5); plugin::patch::SetUChar(0x613A68 + 4, 5);
- plugin::patch::SetUChar(0x46130F + 4, 5); plugin::patch::SetUChar(0x6D2370 + 4, 5);
- plugin::patch::SetUInt(0x41C0A6 + 5, -400); plugin::patch::SetUInt(0x613A68 + 5, -400);
- plugin::patch::SetUInt(0x46130F + 5, -400); plugin::patch::SetUInt(0x6D2370 + 5, -400);
- plugin::patch::SetUInt(0x41C0B0, 65535); plugin::patch::SetUInt(0x613A72, 65535);
- plugin::patch::SetUInt(0x461319, 65535); plugin::patch::SetUInt(0x6D237A, 65535);
- plugin::patch::SetUInt(0x6D16EE, 0x2246BF0F);
- plugin::patch::SetUChar(0x6D16EE + 0x0D, 5);
- plugin::patch::SetUInt(0x6D16EE + 0x0E, -400);
- plugin::patch::SetUInt(0x6D1700 + 1, 65535);
- // ; CCarCtrl::ChoosePoliceCarModel();
- plugin::patch::SetUInt(0x421980, 0xE8FF6A53); plugin::patch::SetUInt(0x421984, 0x0014C8A8);
- // ; CCopPed::CCopPed(CPed *ped, int copType);
- plugin::patch::SetUInt(0x5DDC86, 0x2024448B); plugin::patch::SetUInt(0x5DDC8A, 0xF883DB33);
- TABLE_2[7] = 0; TABLE_2[16] = 1; // MODEL_FIRETRUCK ; MODEL_AMBULAN
- TABLE_1[27] = 0; TABLE_2[27] = 2; TABLE_3[27] = 0; TABLE_4[27] = 0; // MODEL_ENFORCER
- TABLE_1[30] = 1; TABLE_2[30] = 3; // MODEL_PREDATOR
- TABLE_1[32] = 2; TABLE_2[32] = 4; TABLE_4[32] = 0; // MODEL_RHINO
- TABLE_1[33] = 3; TABLE_2[33] = 4; TABLE_3[33] = 1; TABLE_4[33] = 0; // MODEL_BARRACKS
- TABLE_1[90] = 0; TABLE_2[90] = 5; TABLE_3[90] = 2; TABLE_4[90] = 0; // MODEL_FBIRANCH
- TABLE_1[97] = 3; TABLE_2[97] = 3; TABLE_4[97] = 0; // MODEL_POLMAV
- TABLE_1[123] = 2; TABLE_2[123] = 6; TABLE_4[123] = 0; // MODEL_COPBIKE
- TABLE_1[196] = 3; TABLE_2[196] = 3; TABLE_3[196] = 3; TABLE_4[196] = 0; // MODEL_COPCARLA
- TABLE_1[197] = 3; TABLE_2[197] = 3; TABLE_3[197] = 3; TABLE_4[197] = 0; // MODEL_COPCARSF
- TABLE_1[198] = 3; TABLE_2[198] = 3; TABLE_3[198] = 3; TABLE_4[198] = 0; // MODEL_COPCARLV
- TABLE_1[199] = 3; TABLE_2[199] = 3; TABLE_3[199] = 3; TABLE_4[199] = 0; // MODEL_COPCARRU
- TABLE_4[128] = 0; TABLE_4[201] = 0;
- TABLE_9[16] = 0; // MODEL_AMBULAN
- TABLE_9[20] = 1; TABLE_9[38] = 1; // MODEL_TAXI ; MODEL_CABBIE
- TABLE_9[27] = 2; // MODEL_ENFORCER
- TABLE_9[57] = 3; // MODEL_CADDY
- TABLE_9[188] = 4; // MODEL_HOTDOG
- TABLE_9[196] = 5; TABLE_9[197] = 5; TABLE_9[198] = 5; TABLE_9[199] = 5; // copCars
- plugin::patch::SetPointer(0x41C0BD, &TABLE_1); plugin::patch::SetPointer(0x613A7F, &TABLE_2);
- plugin::patch::SetPointer(0x461322, &TABLE_3); plugin::patch::SetPointer(0x6D2383, &TABLE_4);
- plugin::patch::SetPointer(0x6D1711 + 3, &TABLE_9);
- // star7
- _cheatStringHashes = plugin::patch::GetUInt(0x438510 + 3);
- maxChaosPntr = plugin::patch::GetUInt(0x561C7A + 2);
- maxWantedStarsPntr = plugin::patch::GetUInt(0x48CB51 + 2);
- MaxStars = 11; // privateData
- plugin::patch::SetUInt(_cheatStringHashes + 0x014, 0); plugin::patch::SetUInt(_cheatStringHashes + 0x108, 0);
- plugin::patch::SetUShort(maxChaosPntr, MaxChaos);
- plugin::patch::SetUInt(0x561EF7 + 6, MaxChaos); plugin::patch::SetUInt(maxWantedStarsPntr, MaxStars);
- plugin::patch::SetUInt(0x561C70 + 6, MaxStars); plugin::patch::SetUInt(0x561EED + 6, MaxStars);
- plugin::patch::SetUChar(0x58DFE2 + 2, MaxStars); plugin::patch::SetUChar(0x72DF29 + 1, MaxStars);
- // jumpChange:
- plugin::patch::SetUInt(0x41CAB0, 0x7B870F); plugin::patch::SetUInt(0x561E77, 0x70870F);
- plugin::patch::SetUShort(0x5624A4, 0x5277); plugin::patch::SetUShort(0x6C74E3, 0x2377);
- plugin::patch::SetUShort(0x41FD01, 0x0E77); plugin::patch::SetUShort(0x41C9E0, 0x2977);
- plugin::patch::SetUShort(0x41CB80, 0x4F77); plugin::patch::SetUShort(0x4352F1, 0x0E77);
- plugin::patch::SetUShort(0x435331, 0x0E77); plugin::patch::Nop(0x561FB6, 2);
- plugin::patch::Nop(0x6C6DF4, 6); // newsHeli
- plugin::patch::Nop(0x6B3810, 6); // newsHeli
- plugin::patch::Nop(0x562381, 7); // newsHeli
- plugin::patch::Nop(0x6B3C01, 7); // newsHeli
- plugin::patch::Nop(0x561C84, 7); // newsHeli
- plugin::patch::Nop(0x421A20, 5); // [star6 - 1 veh instead of 2 - tank only]
- plugin::patch::Nop(0x4219B7, 2); // [star4 - swat vehicles only]
- plugin::patch::Nop(0x561FB6, 2); // helisAfterStar6
- plugin::patch::SetUChar(0x4417E6 + 3, -1); // leaveTown
- Events::gameProcessEvent += [] {
- CWanted::bUseNewsHeliInAdditionToPolice = addNewsHeli; // privateData
- CPed *playa = FindPlayerPed();
- CVehicle *veh = FindPlayerVehicle(-1, true);
- CWanted *Wanted = playa->m_pPlayerData->m_pWanted;
- DWORD star = Wanted->m_nWantedLevel;
- DWORD zone = CTheZones::m_CurrLevel;
- // std::string STARS = std::to_string(star);
- // std::string TOWN = std::to_string(zone);
- for (int i = 0; i < CPools::ms_pPedPool->m_nSize; i++) {
- CPed *ped = CPools::ms_pPedPool->GetAt(i);
- if (ped) {
- if (ped->m_nPhysicalFlags.bAttachedToEntity) {
- }
- }
- }
- for (int i = 0; i < CPools::ms_pVehiclePool->m_nSize; i++) {
- CVehicle *veh = CPools::ms_pVehiclePool->GetAt(i);
- if (veh) {
- if (veh->m_nVehicleSubClass == VEHICLE_HELI) {
- if (veh->m_nCreatedBy == PERMANENT_VEHICLE) {
- DWORD newsHeliModel = plugin::patch::GetUInt(0x6C7A5E + 1);
- if (veh->m_nModelIndex != newsHeliModel) {
- veh->m_autoPilot.field_49 = heliSpeed; // privateData
- CDarkel::RegisterCarBlownUpByPlayer(veh, 1);
- if (veh->m_pDriver) {
- if (veh->m_pDriver->m_nPedState == PEDSTATE_DEAD) {
- veh->m_fHealth -= 2.5;
- if (veh->m_autoPilot.m_nCarMission == 57 || veh->m_autoPilot.m_nCarMission == 58) {
- veh->m_autoPilot.m_nCarMission = 58;
- }
- }
- } else {
- DWORD TABLE_1_begin = plugin::patch::GetUInt(0x41C0BA + 3);
- DWORD table1_index = veh->m_nModelIndex - 0x190 + TABLE_1_begin;
- byte table1_pos = plugin::patch::GetChar(table1_index);
- veh->m_nCreatedBy = RANDOM_VEHICLE;
- CCarAI::AddPoliceCarOccupants(veh, 1);
- veh->m_nCreatedBy = PERMANENT_VEHICLE;
- if (veh->m_nVehicleWeaponInUse == CAR_WEAPON_NOT_USED) {
- veh->m_autoPilot.m_nCarMission = POLICE_HELI_CHASE_ENTITY;
- veh->m_autoPilot.m_nCruiseSpeed = 0x64;
- } else {
- if (veh->m_nVehicleWeaponInUse == CAR_WEAPON_DOUBLE_ROCKET) {
- veh->m_autoPilot.m_nCarMission = HELI_ATTACK_PLAYER;
- veh->m_autoPilot.m_nCruiseSpeed = 0x64;
- // veh->m_autoPilot.m_aPathFindNodesInfo[6].m_wAreaId = 1000;
- }
- }
- }
- }
- }
- }
- }
- }
- // int brb = CStats::StatTypesInt[STAT_NUMBER_OF_POLICE_BRIBES];
- _playerStatsInteger = plugin::patch::GetUInt(0x558E59 + 3);
- bribesCollected = plugin::patch::GetUInt(_playerStatsInteger + STAT_NUMBER_OF_POLICE_BRIBES * 4);
- if (MaxStars < StarLimit) {
- plugin::patch::SetUInt(0x561C70 + 6, MaxStars); plugin::patch::SetUInt(0x561EED + 6, MaxStars);
- plugin::patch::SetUChar(0x58DFE2 + 2, MaxStars);
- } else {
- plugin::patch::SetUInt(0x561C70 + 6, 11); plugin::patch::SetUInt(0x561EED + 6, 11);
- plugin::patch::SetUChar(0x58DFE2 + 2, 11);
- }
- if (MaxStars == 4 || MaxStars == 5) {
- plugin::patch::SetUChar(0x561F80 + 3, MaxStars); plugin::patch::SetUChar(0x561F60 + 3, MaxStars);
- plugin::patch::SetUChar(0x561F40 + 3, MaxStars);
- } else {
- plugin::patch::SetUChar(0x561F80 + 3, 6); plugin::patch::SetUChar(0x561F60 + 3, 5);
- plugin::patch::SetUChar(0x561F40 + 3, 4);
- }
- if (Wanted->m_nChaosLevel >= MaxChaos) {
- if (Wanted->m_nWantedLevel != MaxStars) {
- plugin::patch::SetUInt(0x561CA5 + 1, MaxChaos); plugin::patch::SetUInt(0x5624F8 + 2, MaxChaos + 20);
- plugin::patch::SetUChar(0x561CCD + 3, MaxStars); Wanted->CheatWantedLevel(MaxStars);
- }
- } else {
- if (Wanted->m_nChaosLevel >= 16700) {
- if (Wanted->m_nWantedLevel != 11) {
- plugin::patch::SetUInt(0x561CA5 + 1, 17100); plugin::patch::SetUInt(0x5624F8 + 2, 17120);
- plugin::patch::SetUChar(0x561CCD + 3, 11); Wanted->CheatWantedLevel(11);
- }
- } else {
- if (Wanted->m_nChaosLevel >= 14200) {
- if (Wanted->m_nWantedLevel != 10) {
- plugin::patch::SetUInt(0x561CA5 + 1, 14600); plugin::patch::SetUInt(0x5624F8 + 2, 14620);
- plugin::patch::SetUChar(0x561CCD + 3, 10); Wanted->CheatWantedLevel(10);
- }
- } else {
- if (Wanted->m_nChaosLevel >= 11700) {
- if (Wanted->m_nWantedLevel != 9) {
- plugin::patch::SetUInt(0x561CA5 + 1, 12100); plugin::patch::SetUInt(0x5624F8 + 2, 12120);
- plugin::patch::SetUChar(0x561CCD + 3, 9); Wanted->CheatWantedLevel(9);
- }
- } else {
- if (Wanted->m_nChaosLevel >= 9200) {
- if (Wanted->m_nWantedLevel != 8) {
- plugin::patch::SetUInt(0x561CA5 + 1, 9600); plugin::patch::SetUInt(0x5624F8 + 2, 9620);
- plugin::patch::SetUChar(0x561CCD + 3, 8); Wanted->CheatWantedLevel(8);
- }
- } else {
- if (Wanted->m_nChaosLevel >= 6700) {
- if (Wanted->m_nWantedLevel != 7) {
- plugin::patch::SetUInt(0x561CA5 + 1, 7100); plugin::patch::SetUInt(0x5624F8 + 2, 7120);
- plugin::patch::SetUChar(0x561CCD + 3, 7); Wanted->CheatWantedLevel(7);
- }
- } else {
- if (Wanted->m_nChaosLevel >= 4600) {
- if (Wanted->m_nWantedLevel != 6) {
- plugin::patch::SetUInt(0x561CA5 + 1, 4600); plugin::patch::SetUInt(0x5624F8 + 2, 4620);
- plugin::patch::SetUChar(0x561CCD + 3, 6); Wanted->CheatWantedLevel(6);
- }
- }
- }
- }
- }
- }
- }
- }
- int ChaosValues[] = { 0, 50, 180, 550, 1200, 2400, 4600, 7100, 9600, 12100, 14600, 17100 };
- if (CCheat::m_CheatString[1] == 'R' && CCheat::m_CheatString[2] == 'A' &&
- CCheat::m_CheatString[3] == 'T' && CCheat::m_CheatString[4] == 'S') {
- if (CCheat::m_CheatString[0] <= '9') {
- byte currentLevel = CCheat::m_CheatString[0] - 0x30;
- DWORD chaosElem = ChaosValues[currentLevel];
- if (Wanted->m_nWantedLevel != currentLevel) {
- plugin::patch::SetUInt(0x561CA5 + 1, chaosElem); plugin::patch::SetUInt(0x5624F8 + 2, chaosElem + 20);
- plugin::patch::SetUChar(0x561CCD + 3, currentLevel); Wanted->CheatWantedLevel(currentLevel);
- CHud::SetHelpMessage("Wanted Level Cheat", 1, 0, 1);
- }
- }
- else {
- if (CCheat::m_CheatString[0] == 'S' && CCheat::m_CheatString[1] == 'R' &&
- CCheat::m_CheatString[2] == 'A' && CCheat::m_CheatString[3] == 'T' &&
- CCheat::m_CheatString[4] == 'S') {
- byte Digits = CCheat::m_CheatString[6] - 0x30; Digits *= 0x0A;
- byte Digit = CCheat::m_CheatString[5] - 0x30;
- byte currentLevel = Digits + Digit;
- DWORD chaosElem = ChaosValues[currentLevel];
- if (Wanted->m_nWantedLevel != currentLevel) {
- if (star <= 6) {
- currentLevel = 6;
- }
- plugin::patch::SetUInt(0x561CA5 + 1, chaosElem);
- plugin::patch::SetUInt(0x5624F8 + 2, chaosElem + 20);
- plugin::patch::SetUChar(0x561CCD + 3, currentLevel);
- Wanted->CheatWantedLevel(currentLevel);
- CHud::SetHelpMessage("Wanted Level Cheat", 1, 0, 1);
- }
- }
- }
- }
- // plugin::Random(0, 7);
- // char gv = plugin::GetGameVersion();
- // MessageBoxA(NULL, "This is my MsgBox WOO ", "My MsgBox", MB_OK);
- // unsigned char wlStar = rand() % 6;
- //--------------------------------------------Data--------------------------------------------
- if (star <= 3) {
- } else {
- if (star == 4) {
- } else {
- if (star == 5) {
- } else {
- if (star == 6) {
- } else {
- if (star == 7) {
- } else {
- if (star == 8) {
- } else {
- if (star == 9) {
- } else {
- if (star == 10) {
- }
- }
- }
- }
- }
- }
- }
- }
- //--------------------------------------------Data--------------------------------------------
- WORD vehModelID = 5683;
- WORD pedModelID = MODEL_WMOMIB;
- eWeaponType weponType = WEAPON_AK47;
- // DWORD gunModelID = MODEL_AK47;
- byte Occupants = FOUR_OCCUPANTS;
- byte vehColour1 = 0;
- byte vehColour2 = 0;
- WORD heliPilot = MODEL_LAPDM1;
- WORD heliModel = MODEL_HUNTER;
- byte heliOccupants = DRIVER_AND_GUNMAN;
- byte heliColour = 0;
- WORD boatDriverID = MODEL_WMYSGRD;
- WORD boatModelID = MODEL_SQUALO;
- byte boatOccupants = DRIVER_AND_GUNMAN;
- byte boatColour = 0;
- WORD planePilotID = MODEL_LAPDM1;
- WORD planeModelID = MODEL_RUSTLER;
- byte planeOccupants = DRIVER_AND_GUNMAN;
- byte planeColour = 0;
- WORD bikerID = MODEL_WMOSCI;
- WORD bikeModelID = MODEL_NRG500;
- byte bikeOccupants = TWO_OCCUPANTS;
- byte bikeColour1 = 0;
- byte bikeColour2 = 0;
- DWORD gunModelID = CPickups::ModelForWeapon(weponType);
- table1 = plugin::patch::GetUInt(0x41C0BD); table2 = plugin::patch::GetUInt(0x613A7F);
- table3 = plugin::patch::GetUInt(0x461322); table4 = plugin::patch::GetUInt(0x6D2383);
- table9 = plugin::patch::GetUInt(0x6D1711 + 3);
- lowestCase = 0 - plugin::patch::GetUInt(0x611904 + 1);
- maxSwitchTableValues = plugin::patch::GetUChar(0x611909 + 2);
- highestCase = lowestCase + maxSwitchTableValues++;
- SwitchTableStart = plugin::patch::GetUInt(0x61190E + 3);
- // if (CStreaming::ms_streamingBufferSize >= vehModelID && CStreaming::ms_streamingBufferSize >= pedModelID &&
- // CStreaming::ms_streamingBufferSize >= gunModelID) {
- CBaseModelInfo *Model1 = reinterpret_cast<CBaseModelInfo *>(CModelInfo::ms_modelInfoPtrs[vehModelID]);
- CBaseModelInfo *Model2 = reinterpret_cast<CBaseModelInfo *>(CModelInfo::ms_modelInfoPtrs[pedModelID]);
- CBaseModelInfo *Model3 = reinterpret_cast<CBaseModelInfo *>(CModelInfo::ms_modelInfoPtrs[gunModelID]);
- if (Model1 > 0 && Model2 > 0 && Model3 > 0) {
- int modelType1 = Model1->GetModelType(); int modelType2 = Model2->GetModelType();
- int modelType3 = Model3->GetModelType();
- if (modelType1 == MODEL_INFO_VEHICLE && modelType2 == MODEL_INFO_PED && modelType3 == MODEL_INFO_WEAPON) {
- int vehLoadS = CStreaming::ms_aInfoForModel[vehModelID].m_nLoadState;
- int pedLoadS = CStreaming::ms_aInfoForModel[pedModelID].m_nLoadState;
- int gunLoadS = CStreaming::ms_aInfoForModel[gunModelID].m_nLoadState;
- if (vehLoadS == LOADSTATE_LOADED && pedLoadS == LOADSTATE_LOADED && gunLoadS == LOADSTATE_LOADED) {
- plugin::patch::SetUChar(0x5DDCCC + 1, weponType); plugin::patch::SetUChar(0x68BBB6 + 1, weponType);
- plugin::patch::SetUChar(0x5DDDA0 + 1, weponType); plugin::patch::SetUChar(0x5DDDA9 + 1, weponType);
- plugin::patch::SetUChar(0x5DDDE0 + 1, weponType); plugin::patch::SetUChar(0x5DDDE9 + 1, weponType);
- plugin::patch::SetUChar(0x5DDE20 + 1, weponType); plugin::patch::SetUChar(0x5DDE29 + 1, weponType);
- plugin::patch::SetUChar(0x6150BD + 1, weponType); plugin::patch::SetUChar(0x615085 + 1, weponType);
- plugin::patch::SetUChar(0x6150F3 + 1, weponType); plugin::patch::SetUChar(0x615114 + 1, weponType);
- plugin::patch::SetUChar(0x41C311 + 1, weponType);
- // modelInfo
- CVehicleModelInfo *vehModelInfo = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::ms_modelInfoPtrs[vehModelID]);
- vehModelInfo->m_nCurrentPrimaryColor = vehColour1;
- vehModelInfo->m_nCurrentSecondaryColor = vehColour2;
- vehModelInfo->m_nCurrentQuaternaryColor = vehColour1;
- vehModelInfo->m_nCurrentTertiaryColor = vehColour2;
- byte colVar = vehModelInfo->m_nNumColorVariations; byte num = 0;
- while (colVar >= num) {
- vehModelInfo->m_anPrimaryColors[num] = vehColour1; num++;
- vehModelInfo->m_anPrimaryColors[num] = vehColour2; num++;
- }
- vehModelInfo->m_nCompRules = 0;
- vehModelInfo->m_nFlags = 0;
- vehModelInfo->ms_compsUsed[0] = -1;
- vehModelInfo->ms_compsUsed[1] = -1;
- vehModelInfo->ms_compsUsed[2] = 0;
- vehModelInfo->ms_compsUsed[3] = 0;
- vehModelInfo->field_30 = 0;
- vehModelInfo->field_51 = 0;
- vehModelInfo->m_fDrawDistance = 2000.0;
- //
- // switchCases
- table1Pos = vehModelID - 0x190 + table1; table2Pos = vehModelID - 0x190 + table2;
- table3Pos = vehModelID - 0x190 + table3; table4Pos = vehModelID - 0x190 + table4;
- table9Pos = vehModelID - 0x190 + table9;
- // door check
- if (Occupants == FOUR_OCCUPANTS) {
- if (vehModelInfo->m_nNumDoors == 1) {
- plugin::patch::SetUChar(table1Pos, ONE_OCCUPANT);
- } else {
- if (vehModelInfo->m_nNumDoors == 2 || vehModelInfo->m_nNumDoors == 3) {
- plugin::patch::SetUChar(table1Pos, TWO_OCCUPANTS);
- } else {
- if (vehModelInfo->m_nNumDoors >= 4) {
- plugin::patch::SetUChar(table1Pos, Occupants);
- }
- }
- }
- } else {
- if (Occupants == TWO_OCCUPANTS) {
- if (vehModelInfo->m_nNumDoors == 1) {
- plugin::patch::SetUChar(table1Pos, ONE_OCCUPANT);
- }
- } else {
- if (Occupants == ONE_OCCUPANT || Occupants == DRIVER_AND_GUNMAN) {
- plugin::patch::SetUChar(table1Pos, Occupants);
- }
- }
- }
- if (star <= 3) {
- plugin::patch::SetUChar(table9Pos, 5);
- pedModel = COPS_IN_CAR; roadblockPed = ROADBLOCK_COP;
- pedModelCase = 0x613A8A; roadblockPedCase = 0x461378;
- jurisdiction = 0x5DDCA8;
- if (zone == UG_COUNTRY_SIDE) {
- CPedModelInfo *csherModelInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_CSHER]);
- voice1 = csherModelInfo->m_nVoice1; voice2 = csherModelInfo->m_nVoice2;
- }
- else {
- if (zone == UG_LOS_SANTOS) {
- CPedModelInfo *lsCopModelInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_LAPD1]);
- voice1 = lsCopModelInfo->m_nVoice1; voice2 = lsCopModelInfo->m_nVoice2;
- }
- else {
- if (zone == UG_SAN_FIERRO) {
- CPedModelInfo *sfCopModelInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_SFPD1]);
- voice1 = sfCopModelInfo->m_nVoice1; voice2 = sfCopModelInfo->m_nVoice2;
- }
- else {
- if (zone == UG_LAS_VENTURAS) {
- CPedModelInfo *lvCopModelInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_LVPD1]);
- voice1 = lvCopModelInfo->m_nVoice1; voice2 = lvCopModelInfo->m_nVoice2;
- }
- else {
- CPedModelInfo *dsherModelInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_DSHER]);
- voice1 = dsherModelInfo->m_nVoice1; voice2 = dsherModelInfo->m_nVoice2;
- }
- }
- }
- }
- pedModelCase = 0x613A8A; roadblockPedCase = 0x461378;
- jurisdiction = 0x5DDD8F;
- } else {
- if (star == 4) {
- plugin::patch::SetUChar(table9Pos, 2);
- CPedModelInfo *swatModelInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_SWAT]);
- voice1 = swatModelInfo->m_nVoice1; voice2 = swatModelInfo->m_nVoice2;
- pedModel = SWAT_IN_CAR; roadblockPed = ROADBLOCK_SWAT;
- pedModelCase = 0x613AA5; roadblockPedCase = 0x46132D;
- jurisdiction = 0x5DDD8F;
- } else {
- if (star == 5) {
- CPedModelInfo *fbiModelInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_FBI]);
- voice1 = fbiModelInfo->m_nVoice1; voice2 = fbiModelInfo->m_nVoice2;
- pedModel = FBI_IN_CAR; roadblockPed = ROADBLOCK_FBI;
- pedModelCase = 0x613AB4; roadblockPedCase = 0x461347;
- jurisdiction = 0x5DDDCF;
- } else {
- if (star >= 6) {
- CPedModelInfo *armyModelInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_ARMY]);
- voice1 = armyModelInfo->m_nVoice1; voice2 = armyModelInfo->m_nVoice2;
- pedModel = ARMY_IN_CAR; roadblockPed = ROADBLOCK_ARMY;
- pedModelCase = 0x613AC3; roadblockPedCase = 0x461361;
- jurisdiction = 0x5DDE0F;
- }
- }
- }
- }
- CPedModelInfo *pedMod = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[pedModelID]);
- pedMod->m_fDrawDistance = 2000.0;
- pedMod->m_nFlags = 64;
- pedMod->m_nPedType = PED_TYPE_COP;
- pedMod->m_nStatType = 1;
- pedMod->m_nCarsCanDriveMask = 0x1FFF;
- pedMod->m_nPedFlags = 0;
- pedMod->m_nPedAudioType = PED_TYPE_EMG;
- pedMod->m_nVoice1 = voice1;
- pedMod->m_nVoice2 = voice2;
- pedMod->m_nVoiceId = voice1;
- plugin::patch::SetUChar(table2Pos, pedModel);
- plugin::patch::SetUChar(table3Pos, roadblockPed);
- plugin::patch::SetUChar(table4Pos, LAW_VEHICLE);
- if (vehModelID >= lowestCase && vehModelID < highestCase) {
- plugin::patch::SetUChar(vehModelID - lowestCase + SwitchTableStart, DRIVER_DEFAULT);
- }
- // CPopulation::AddPedInCar();
- plugin::patch::SetUInt(0x613BE8, pedModelCase); plugin::patch::SetUInt(0x613BEC, pedModelCase);
- plugin::patch::SetUInt(0x613BF0, pedModelCase); plugin::patch::SetUInt(0x613BF4, pedModelCase);
- plugin::patch::SetUInt(0x613BF8, 0x613A96);
- // jurisdiction
- if (enableJurisdiction == true) {
- plugin::patch::SetUInt(0x5DDE5C, jurisdiction);
- } else {
- if (enableJurisdiction == false) {
- plugin::patch::SetUInt(0x5DDE5C, 0x5DDCA8);
- }
- }
- vehType = CModelInfo::IsVehicleModelType(vehModelID);
- if (vehType == VEHICLE_AUTOMOBILE || vehType == VEHICLE_MTRUCK ||
- vehType == VEHICLE_BIKE || vehType == VEHICLE_BMX || vehType == VEHICLE_QUAD) {
- copCarByTown = plugin::patch::GetUInt(0x407C8D + 3);
- copPedByTown = plugin::patch::GetUInt(0x407C94 + 3);
- city = CTheZones::m_CurrLevel * 4; copCarByTown += city; copPedByTown += city;
- plugin::patch::SetUInt(copCarByTown, vehModelID); plugin::patch::SetUInt(0x4219B9 + 1, vehModelID);
- plugin::patch::SetUInt(0x4219E5 + 1, vehModelID); plugin::patch::SetUInt(0x421A29 + 2, vehModelID);
- //------------------------roadblock--------------
- plugin::patch::SetUInt(0x461BE6 + 1, vehModelID); plugin::patch::SetUInt(0x461BCB + 1, vehModelID);
- plugin::patch::SetUInt(0x461BB0 + 1, vehModelID);
- //------------------------roadblock--------------
- }
- // peds
- plugin::patch::SetUInt(copPedByTown, pedModelID); plugin::patch::SetUInt(0x5DDD8F + 1, pedModelID);
- plugin::patch::SetUInt(0x5DDDCF + 1, pedModelID); plugin::patch::SetUInt(0x5DDE0F + 1, pedModelID);
- //-------------roadblockPed----------------------
- plugin::patch::SetUInt(0x461335 + 4, pedModelID); plugin::patch::SetUInt(0x46134F + 4, pedModelID);
- plugin::patch::SetUInt(0x461369 + 4, pedModelID);
- //-------------roadblockPed---------------------
- // CPedModelInfo *fbiPed = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_SFR3]);
- // plugin::patch::SetUInt(0x6CD942, fbiPed->m_nVoice1);
- // plugin::patch::SetUInt(0x6CD78C, fbiPed->m_nVoice2);
- // plugin::patch::SetUInt(0x6C8F12, fbiPed->m_nVoiceId);
- } else {
- CStreaming::RequestModel(vehModelID, true);
- CStreaming::RequestModel(pedModelID, true);
- CStreaming::RequestModel(gunModelID, true);
- // CStreaming::LoadRequestedModels();
- }
- CBaseModelInfo *Model6 = reinterpret_cast<CBaseModelInfo *>(CModelInfo::ms_modelInfoPtrs[bikeModelID]);
- CBaseModelInfo *Model7 = reinterpret_cast<CBaseModelInfo *>(CModelInfo::ms_modelInfoPtrs[bikerID]);
- if (Model6 > 0 && Model7 > 0) {
- int modelType6 = Model6->GetModelType(); int modelType7 = Model7->GetModelType();
- if (modelType6 == MODEL_INFO_VEHICLE && modelType7 == MODEL_INFO_PED) {
- int bikeLoadS = CStreaming::ms_aInfoForModel[bikeModelID].m_nLoadState;
- int bikeLoadSatte = CStreaming::ms_aInfoForModel[bikerID].m_nLoadState;
- if (bikeLoadS == LOADSTATE_LOADED && bikeLoadSatte == LOADSTATE_LOADED) {
- int vehTypeBike = CModelInfo::IsVehicleModelType(bikeModelID);
- if (vehTypeBike == VEHICLE_AUTOMOBILE || vehTypeBike == VEHICLE_MTRUCK ||
- vehTypeBike == VEHICLE_BIKE || vehTypeBike == VEHICLE_BMX || vehTypeBike == VEHICLE_QUAD) {
- // modelInfo
- CPedModelInfo *defBikerModInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_LAPDM1]);
- CPedModelInfo *bikerModInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[bikerID]);
- bikerModInfo->m_fDrawDistance = defBikerModInfo->m_fDrawDistance;
- bikerModInfo->m_nFlags = defBikerModInfo->m_nFlags;
- bikerModInfo->m_nPedType = defBikerModInfo->m_nPedType;
- bikerModInfo->m_nStatType = defBikerModInfo->m_nStatType;
- bikerModInfo->m_nCarsCanDriveMask = defBikerModInfo->m_nCarsCanDriveMask;
- bikerModInfo->m_nPedFlags = defBikerModInfo->m_nPedFlags;
- bikerModInfo->m_nPedAudioType = defBikerModInfo->m_nPedAudioType;
- bikerModInfo->m_nVoice1 = defBikerModInfo->m_nVoice1;
- bikerModInfo->m_nVoice2 = defBikerModInfo->m_nVoice2;
- bikerModInfo->m_nVoiceId = defBikerModInfo->m_nVoiceId;
- CVehicleModelInfo *bikeModelInfo = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::ms_modelInfoPtrs[bikeModelID]);
- CVehicleModelInfo *defBikeModelInfo = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_COPBIKE]);
- bikeModelInfo->m_nCurrentPrimaryColor = bikeColour1;
- bikeModelInfo->m_nCurrentSecondaryColor = bikeColour2;
- bikeModelInfo->m_nCurrentQuaternaryColor = bikeColour1;
- bikeModelInfo->m_nCurrentTertiaryColor = bikeColour2;
- byte colVar2 = bikeModelInfo->m_nNumColorVariations; byte num2 = 0;
- while (colVar2 >= num2) {
- bikeModelInfo->m_anPrimaryColors[num2] = bikeColour1; num2++;
- bikeModelInfo->m_anPrimaryColors[num2] = bikeColour2; num2++;
- }
- bikeModelInfo->m_nCompRules = defBikeModelInfo->m_nCompRules;
- bikeModelInfo->m_nFlags = defBikeModelInfo->m_nFlags;
- bikeModelInfo->ms_compsUsed[0] = defBikeModelInfo->ms_compsUsed[0];
- bikeModelInfo->ms_compsUsed[1] = defBikeModelInfo->ms_compsUsed[1];
- bikeModelInfo->ms_compsUsed[2] = defBikeModelInfo->ms_compsUsed[2];
- bikeModelInfo->ms_compsUsed[3] = defBikeModelInfo->ms_compsUsed[3];
- bikeModelInfo->field_30 = defBikeModelInfo->field_30;
- bikeModelInfo->field_51 = defBikeModelInfo->field_51;
- bikeModelInfo->m_fDrawDistance = defBikeModelInfo->m_fDrawDistance;
- // switch cases
- DWORD tableBike1Pos = bikeModelID - 0x190 + table1;
- DWORD tableBike2Pos = bikeModelID - 0x190 + table2;
- DWORD tableBike3Pos = bikeModelID - 0x190 + table3;
- DWORD tableBike4Pos = bikeModelID - 0x190 + table4;
- DWORD tableBike9Pos = bikeModelID - 0x190 + table9;
- // door check
- CVehicleModelInfo *vehModelInfo = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::ms_modelInfoPtrs[bikeModelID]);
- if (bikeOccupants == FOUR_OCCUPANTS) {
- if (vehModelInfo->m_nNumDoors == 1) {
- plugin::patch::SetUChar(tableBike1Pos, ONE_OCCUPANT);
- } else {
- if (vehModelInfo->m_nNumDoors == 2 || vehModelInfo->m_nNumDoors == 3) {
- plugin::patch::SetUChar(tableBike1Pos, TWO_OCCUPANTS);
- } else {
- if (vehModelInfo->m_nNumDoors >= 4) {
- plugin::patch::SetUChar(tableBike1Pos, bikeOccupants);
- }
- }
- }
- } else {
- if (bikeOccupants == TWO_OCCUPANTS) {
- if (vehModelInfo->m_nNumDoors == 1) {
- plugin::patch::SetUChar(tableBike1Pos, ONE_OCCUPANT);
- }
- } else {
- if (bikeOccupants == ONE_OCCUPANT || bikeOccupants == DRIVER_AND_GUNMAN) {
- plugin::patch::SetUChar(tableBike1Pos, bikeOccupants);
- }
- }
- }
- plugin::patch::SetUChar(tableBike2Pos, COP_BIKER);
- plugin::patch::SetUChar(tableBike4Pos, LAW_VEHICLE);
- if (bikeModelID >= lowestCase && bikeModelID < highestCase) {
- plugin::patch::SetUChar(bikeModelID - lowestCase + SwitchTableStart, DRIVER_DEFAULT);
- }
- // Models
- copBikeByTown = plugin::patch::GetUInt(0x407C7C + 1);
- plugin::patch::SetUInt(copBikeByTown, bikeModelID);
- plugin::patch::SetUInt(0x41F2A2 + 1, bikeModelID);
- plugin::patch::SetUInt(0x461C19 + 2, bikeModelID);
- plugin::patch::SetUShort(0x6BD40F + 4, bikeModelID);
- plugin::patch::SetUInt(0x70BFE8 + 2, bikeModelID);
- plugin::patch::SetUShort(0x6D7E11 + 4, bikeModelID);
- copBikePed = plugin::patch::GetUInt(0x407C6B + 1);
- plugin::patch::SetUInt(copBikePed, bikerID);
- plugin::patch::SetUInt(0x5DDD85 + 1, bikerID);
- }
- } else {
- CStreaming::RequestModel(bikeModelID, true);
- CStreaming::RequestModel(bikerID, true);
- // CStreaming::LoadRequestedModels();
- }
- }
- }
- CBaseModelInfo *Model4 = reinterpret_cast<CBaseModelInfo *>(CModelInfo::ms_modelInfoPtrs[heliModel]);
- CBaseModelInfo *Model5 = reinterpret_cast<CBaseModelInfo *>(CModelInfo::ms_modelInfoPtrs[heliPilot]);
- if (Model4 > 0 && Model5 > 0) {
- int modelType4 = Model4->GetModelType(); int modelType5 = Model5->GetModelType();
- if (modelType4 == MODEL_INFO_VEHICLE && modelType5 == MODEL_INFO_PED) {
- int heliLoadState = CStreaming::ms_aInfoForModel[heliModel].m_nLoadState;
- int heliPilotLoadState = CStreaming::ms_aInfoForModel[heliPilot].m_nLoadState;
- if (heliLoadState == LOADSTATE_LOADED && heliPilotLoadState == LOADSTATE_LOADED) {
- int vehTypeHeli = CModelInfo::IsVehicleModelType(heliModel);
- if (vehTypeHeli == VEHICLE_HELI || vehTypeHeli == VEHICLE_PLANE) {
- // modelInfo
- CPedModelInfo *defHeliPilotModInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_LAPDM1]);
- CPedModelInfo *heliPilotModInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[heliPilot]);
- heliPilotModInfo->m_fDrawDistance = defHeliPilotModInfo->m_fDrawDistance;
- heliPilotModInfo->m_nFlags = defHeliPilotModInfo->m_nFlags;
- heliPilotModInfo->m_nPedType = defHeliPilotModInfo->m_nPedType;
- heliPilotModInfo->m_nStatType = defHeliPilotModInfo->m_nStatType;
- heliPilotModInfo->m_nCarsCanDriveMask = defHeliPilotModInfo->m_nCarsCanDriveMask;
- heliPilotModInfo->m_nPedFlags = defHeliPilotModInfo->m_nPedFlags;
- heliPilotModInfo->m_nPedAudioType = defHeliPilotModInfo->m_nPedAudioType;
- heliPilotModInfo->m_nVoice1 = defHeliPilotModInfo->m_nVoice1;
- heliPilotModInfo->m_nVoice2 = defHeliPilotModInfo->m_nVoice2;
- heliPilotModInfo->m_nVoiceId = defHeliPilotModInfo->m_nVoiceId;
- CVehicleModelInfo *heliModelInfo = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::ms_modelInfoPtrs[heliModel]);
- CVehicleModelInfo *defheliModelInfo = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_POLMAV]);
- heliModelInfo->m_nCurrentPrimaryColor = heliColour;
- heliModelInfo->m_nCurrentSecondaryColor = heliColour;
- heliModelInfo->m_nCurrentQuaternaryColor = heliColour;
- heliModelInfo->m_nCurrentTertiaryColor = heliColour;
- byte colVar2 = heliModelInfo->m_nNumColorVariations; byte num3 = 0;
- while (colVar2 >= num3) {
- heliModelInfo->m_anPrimaryColors[num3] = heliColour; num3++;
- heliModelInfo->m_anPrimaryColors[num3] = heliColour; num3++;
- }
- heliModelInfo->m_nCompRules = defheliModelInfo->m_nCompRules;
- heliModelInfo->m_nFlags = defheliModelInfo->m_nFlags;
- heliModelInfo->ms_compsUsed[0] = defheliModelInfo->ms_compsUsed[0];
- heliModelInfo->ms_compsUsed[1] = defheliModelInfo->ms_compsUsed[1];
- heliModelInfo->ms_compsUsed[2] = defheliModelInfo->ms_compsUsed[2];
- heliModelInfo->ms_compsUsed[3] = defheliModelInfo->ms_compsUsed[3];
- heliModelInfo->field_30 = defheliModelInfo->field_30;
- heliModelInfo->field_51 = defheliModelInfo->field_51;
- heliModelInfo->m_fDrawDistance = defheliModelInfo->m_fDrawDistance;
- // switch cases
- DWORD tableHeli1Pos = heliModel - 0x190 + table1;
- DWORD tableHeli2Pos = heliModel - 0x190 + table2;
- DWORD tableHeli3Pos = heliModel - 0x190 + table3;
- DWORD tableHeli4Pos = heliModel - 0x190 + table4;
- DWORD tableHeli9Pos = heliModel - 0x190 + table9;
- // door check
- CVehicleModelInfo *vehModelInfo = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::ms_modelInfoPtrs[heliModel]);
- if (heliOccupants == FOUR_OCCUPANTS) {
- if (vehModelInfo->m_nNumDoors == 1) {
- plugin::patch::SetUChar(tableHeli1Pos, ONE_OCCUPANT);
- } else {
- if (vehModelInfo->m_nNumDoors == 2 || vehModelInfo->m_nNumDoors == 3) {
- plugin::patch::SetUChar(tableHeli1Pos, TWO_OCCUPANTS);
- } else {
- if (vehModelInfo->m_nNumDoors >= 4) {
- plugin::patch::SetUChar(tableHeli1Pos, heliOccupants);
- }
- }
- }
- } else {
- if (heliOccupants == TWO_OCCUPANTS) {
- if (vehModelInfo->m_nNumDoors == 1) {
- plugin::patch::SetUChar(tableHeli1Pos, ONE_OCCUPANT);
- }
- } else {
- if (heliOccupants == ONE_OCCUPANT || heliOccupants == DRIVER_AND_GUNMAN) {
- plugin::patch::SetUChar(tableHeli1Pos, heliOccupants);
- }
- }
- }
- plugin::patch::SetUChar(tableHeli2Pos, COP_BIKER);
- plugin::patch::SetUChar(tableHeli4Pos, LAW_VEHICLE);
- if (heliModel >= lowestCase && heliModel < highestCase) {
- plugin::patch::SetUChar(heliModel - lowestCase + SwitchTableStart, DRIVER_DEFAULT);
- }
- // Models
- plugin::patch::SetUInt(0x6C6589 + 1, heliModel);
- plugin::patch::SetUInt(0x40B890 + 1, heliModel);
- plugin::patch::SetUInt(0x40B840 + 1, heliModel);
- plugin::patch::SetUInt(0x6C79CE + 1, heliModel);
- plugin::patch::SetUInt(0x6CD37A + 1, heliModel);
- copBikePed = plugin::patch::GetUInt(0x407C6B + 1);
- plugin::patch::SetUInt(copBikePed, heliPilot);
- plugin::patch::SetUInt(0x5DDD85 + 1, heliPilot);
- LoadedObjectInfo = plugin::patch::GetUInt(0x4044C7 + 3);
- plugin::patch::SetUInt(0x6C7A96 + 2, heliModel * 0x14 + LoadedObjectInfo);
- }
- } else {
- CStreaming::RequestModel(heliModel, true);
- CStreaming::RequestModel(heliPilot, true);
- // CStreaming::LoadRequestedModels();
- }
- }
- }
- CBaseModelInfo *Model8 = reinterpret_cast<CBaseModelInfo *>(CModelInfo::ms_modelInfoPtrs[planeModelID]);
- CBaseModelInfo *Model9 = reinterpret_cast<CBaseModelInfo *>(CModelInfo::ms_modelInfoPtrs[planePilotID]);
- if (Model8 > 0 && Model9 > 0) {
- int modelType8 = Model8->GetModelType(); int modelType9 = Model9->GetModelType();
- if (modelType8 == MODEL_INFO_VEHICLE && modelType9 == MODEL_INFO_PED) {
- int planeLoadState = CStreaming::ms_aInfoForModel[planeModelID].m_nLoadState;
- int planePilotIDLoadState = CStreaming::ms_aInfoForModel[planePilotID].m_nLoadState;
- if (planeLoadState == LOADSTATE_LOADED && planePilotIDLoadState == LOADSTATE_LOADED) {
- int vehTypePlane = CModelInfo::IsVehicleModelType(planeModelID);
- if (vehTypePlane == VEHICLE_HELI || vehTypePlane == VEHICLE_PLANE) {
- // modelInfo
- CPedModelInfo *defplanePilotIDModInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_ARMY]);
- CPedModelInfo *planePilotIDModInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[planePilotID]);
- planePilotIDModInfo->m_fDrawDistance = defplanePilotIDModInfo->m_fDrawDistance;
- planePilotIDModInfo->m_nFlags = defplanePilotIDModInfo->m_nFlags;
- planePilotIDModInfo->m_nPedType = defplanePilotIDModInfo->m_nPedType;
- planePilotIDModInfo->m_nStatType = defplanePilotIDModInfo->m_nStatType;
- planePilotIDModInfo->m_nCarsCanDriveMask = defplanePilotIDModInfo->m_nCarsCanDriveMask;
- planePilotIDModInfo->m_nPedFlags = defplanePilotIDModInfo->m_nPedFlags;
- planePilotIDModInfo->m_nPedAudioType = defplanePilotIDModInfo->m_nPedAudioType;
- planePilotIDModInfo->m_nVoice1 = defplanePilotIDModInfo->m_nVoice1;
- planePilotIDModInfo->m_nVoice2 = defplanePilotIDModInfo->m_nVoice2;
- planePilotIDModInfo->m_nVoiceId = defplanePilotIDModInfo->m_nVoiceId;
- CVehicleModelInfo *planeModelIDInfo = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::ms_modelInfoPtrs[planeModelID]);
- CVehicleModelInfo *defplaneModelIDInfo = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_HYDRA]);
- planeModelIDInfo->m_nCurrentPrimaryColor = planeColour;
- planeModelIDInfo->m_nCurrentSecondaryColor = planeColour;
- planeModelIDInfo->m_nCurrentQuaternaryColor = planeColour;
- planeModelIDInfo->m_nCurrentTertiaryColor = planeColour;
- byte colVar2 = planeModelIDInfo->m_nNumColorVariations; byte num3 = 0;
- while (colVar2 >= num3) {
- planeModelIDInfo->m_anPrimaryColors[num3] = planeColour; num3++;
- planeModelIDInfo->m_anPrimaryColors[num3] = planeColour; num3++;
- }
- planeModelIDInfo->m_nCompRules = defplaneModelIDInfo->m_nCompRules;
- planeModelIDInfo->m_nFlags = defplaneModelIDInfo->m_nFlags;
- planeModelIDInfo->ms_compsUsed[0] = defplaneModelIDInfo->ms_compsUsed[0];
- planeModelIDInfo->ms_compsUsed[1] = defplaneModelIDInfo->ms_compsUsed[1];
- planeModelIDInfo->ms_compsUsed[2] = defplaneModelIDInfo->ms_compsUsed[2];
- planeModelIDInfo->ms_compsUsed[3] = defplaneModelIDInfo->ms_compsUsed[3];
- planeModelIDInfo->field_30 = defplaneModelIDInfo->field_30;
- planeModelIDInfo->field_51 = defplaneModelIDInfo->field_51;
- planeModelIDInfo->m_fDrawDistance = defplaneModelIDInfo->m_fDrawDistance;
- // switch cases
- DWORD tablePlane1Pos = planeModelID - 0x190 + table1;
- DWORD tablePlane2Pos = planeModelID - 0x190 + table2;
- DWORD tablePlane3Pos = planeModelID - 0x190 + table3;
- DWORD tablePlane4Pos = planeModelID - 0x190 + table4;
- DWORD tablePlane9Pos = planeModelID - 0x190 + table9;
- // door check
- CVehicleModelInfo *vehModelInfo = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::ms_modelInfoPtrs[planeModelID]);
- if (planeOccupants == FOUR_OCCUPANTS) {
- if (vehModelInfo->m_nNumDoors == 1) {
- plugin::patch::SetUChar(tablePlane1Pos, ONE_OCCUPANT);
- } else {
- if (vehModelInfo->m_nNumDoors == 2 || vehModelInfo->m_nNumDoors == 3) {
- plugin::patch::SetUChar(tablePlane1Pos, TWO_OCCUPANTS);
- } else {
- if (vehModelInfo->m_nNumDoors >= 4) {
- plugin::patch::SetUChar(tablePlane1Pos, planeOccupants);
- }
- }
- }
- } else {
- if (planeOccupants == TWO_OCCUPANTS) {
- if (vehModelInfo->m_nNumDoors == 1) {
- plugin::patch::SetUChar(tablePlane1Pos, ONE_OCCUPANT);
- }
- } else {
- if (planeOccupants == ONE_OCCUPANT || planeOccupants == DRIVER_AND_GUNMAN) {
- plugin::patch::SetUChar(tablePlane1Pos, planeOccupants);
- }
- }
- }
- if (star <= 3) {
- plugin::patch::SetUChar(tablePlane2Pos, COPS_IN_CAR);
- } else {
- if (star == 4) {
- plugin::patch::SetUChar(tablePlane2Pos, SWAT_IN_CAR);
- } else {
- if (star == 5) {
- plugin::patch::SetUChar(tablePlane2Pos, FBI_IN_CAR);
- } else {
- if (star >= 6) {
- plugin::patch::SetUChar(tablePlane2Pos, ARMY_IN_CAR);
- }
- }
- }
- }
- plugin::patch::SetUChar(tablePlane4Pos, LAW_VEHICLE);
- if (planeModelID >= lowestCase && planeModelID < highestCase) {
- plugin::patch::SetUChar(planeModelID - lowestCase + SwitchTableStart, DRIVER_DEFAULT);
- }
- // Models
- int dwModelId = plugin::patch::GetUInt(0x6CD7E6 + 1);
- plugin::patch::SetUInt(dwModelId, planeModelID);
- plugin::patch::SetUInt(0x6CD93C + 6, planeModelID); // [DWORD]
- plugin::patch::SetUInt(0x6CD78B + 1, planeModelID); // [DWORD]
- plugin::patch::SetUInt(0x6A53BA + 1, planeModelID); // [DWORD]
- plugin::patch::SetUInt(0x6C8F10 + 2, planeModelID); // [DWORD]
- // plugin::patch::SetUShort(0x5254D8 + 2, planeModelID); // [WORD]
- // plugin::patch::SetUShort(0x524679 + 2, planeModelID); // [WORD]
- // plugin::patch::SetUShort(0x6CC3B1 + 3, planeModelID); // [WORD]
- // plugin::patch::SetUShort(0x6B0842 + 3, planeModelID); // [WORD]
- // plugin::patch::SetUShort(0x527058 + 4, planeModelID); // [WORD]
- // plugin::patch::SetUShort(0x58E09F + 4, planeModelID); // [WORD]
- // plugin::patch::SetUShort(0x6CB4F3 + 4, planeModelID); // [WORD]
- // plugin::patch::SetUShort(0x6C9F1C + 2, planeModelID); // [WORD]
- // plugin::patch::SetUShort(0x6C968E + 4, planeModelID); // [WORD]
- // plugin::patch::SetUShort(0x6C9101 + 4, planeModelID); // [WORD]
- // plugin::patch::SetUShort(0x6D9C04 + 4, planeModelID); // [WORD]
- // plugin::patch::SetUShort(0x6D8FDA + 3, planeModelID); // [WORD]
- // plugin::patch::SetUShort(0x6E39B8 + 4, planeModelID); // [WORD]
- }
- } else {
- CStreaming::RequestModel(planeModelID, true);
- CStreaming::RequestModel(planePilotID, true);
- // CStreaming::LoadRequestedModels();
- }
- }
- }
- CBaseModelInfo *Model10 = reinterpret_cast<CBaseModelInfo *>(CModelInfo::ms_modelInfoPtrs[boatModelID]);
- CBaseModelInfo *Model11 = reinterpret_cast<CBaseModelInfo *>(CModelInfo::ms_modelInfoPtrs[boatDriverID]);
- if (Model10 > 0 && Model11 > 0) {
- int modelType8 = Model10->GetModelType(); int modelType9 = Model11->GetModelType();
- if (modelType8 == MODEL_INFO_VEHICLE && modelType9 == MODEL_INFO_PED) {
- int boatLoadState = CStreaming::ms_aInfoForModel[boatModelID].m_nLoadState;
- int boatDriverIDLoadState = CStreaming::ms_aInfoForModel[boatDriverID].m_nLoadState;
- if (boatLoadState == LOADSTATE_LOADED && boatDriverIDLoadState == LOADSTATE_LOADED) {
- int vehTypeBoat = CModelInfo::IsVehicleModelType(boatModelID);
- if (vehTypeBoat == VEHICLE_BOAT) {
- // modelInfo
- CPedModelInfo *defboatDriverIDModInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_ARMY]);
- CPedModelInfo *boatDriverIDModInfo = reinterpret_cast<CPedModelInfo *>(CModelInfo::ms_modelInfoPtrs[boatDriverID]);
- boatDriverIDModInfo->m_fDrawDistance = defboatDriverIDModInfo->m_fDrawDistance;
- boatDriverIDModInfo->m_nFlags = defboatDriverIDModInfo->m_nFlags;
- boatDriverIDModInfo->m_nPedType = defboatDriverIDModInfo->m_nPedType;
- boatDriverIDModInfo->m_nStatType = defboatDriverIDModInfo->m_nStatType;
- boatDriverIDModInfo->m_nCarsCanDriveMask = defboatDriverIDModInfo->m_nCarsCanDriveMask;
- boatDriverIDModInfo->m_nPedFlags = defboatDriverIDModInfo->m_nPedFlags;
- boatDriverIDModInfo->m_nPedAudioType = defboatDriverIDModInfo->m_nPedAudioType;
- boatDriverIDModInfo->m_nVoice1 = defboatDriverIDModInfo->m_nVoice1;
- boatDriverIDModInfo->m_nVoice2 = defboatDriverIDModInfo->m_nVoice2;
- boatDriverIDModInfo->m_nVoiceId = defboatDriverIDModInfo->m_nVoiceId;
- CVehicleModelInfo *boatModelInfo = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::ms_modelInfoPtrs[boatModelID]);
- CVehicleModelInfo *defboatModelInfo = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::ms_modelInfoPtrs[MODEL_HYDRA]);
- boatModelInfo->m_nCurrentPrimaryColor = boatColour;
- boatModelInfo->m_nCurrentSecondaryColor = boatColour;
- boatModelInfo->m_nCurrentQuaternaryColor = boatColour;
- boatModelInfo->m_nCurrentTertiaryColor = boatColour;
- byte colVar2 = boatModelInfo->m_nNumColorVariations; byte num3 = 0;
- while (colVar2 >= num3) {
- boatModelInfo->m_anPrimaryColors[num3] = boatColour; num3++;
- boatModelInfo->m_anPrimaryColors[num3] = boatColour; num3++;
- }
- boatModelInfo->m_nCompRules = defboatModelInfo->m_nCompRules;
- boatModelInfo->m_nFlags = defboatModelInfo->m_nFlags;
- boatModelInfo->ms_compsUsed[0] = defboatModelInfo->ms_compsUsed[0];
- boatModelInfo->ms_compsUsed[1] = defboatModelInfo->ms_compsUsed[1];
- boatModelInfo->ms_compsUsed[2] = defboatModelInfo->ms_compsUsed[2];
- boatModelInfo->ms_compsUsed[3] = defboatModelInfo->ms_compsUsed[3];
- boatModelInfo->field_30 = defboatModelInfo->field_30;
- boatModelInfo->field_51 = defboatModelInfo->field_51;
- boatModelInfo->m_fDrawDistance = defboatModelInfo->m_fDrawDistance;
- // switch cases
- DWORD tableBoat1Pos = boatModelID - 0x190 + table1;
- DWORD tableBoat2Pos = boatModelID - 0x190 + table2;
- DWORD tableBoat3Pos = boatModelID - 0x190 + table3;
- DWORD tableBoat4Pos = boatModelID - 0x190 + table4;
- DWORD tableBoat9Pos = boatModelID - 0x190 + table9;
- // door check
- CVehicleModelInfo *vehModelInfo = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::ms_modelInfoPtrs[boatModelID]);
- if (boatOccupants == FOUR_OCCUPANTS) {
- if (vehModelInfo->m_nNumDoors == 1) {
- plugin::patch::SetUChar(tableBoat1Pos, ONE_OCCUPANT);
- } else {
- if (vehModelInfo->m_nNumDoors == 2 || vehModelInfo->m_nNumDoors == 3) {
- plugin::patch::SetUChar(tableBoat1Pos, TWO_OCCUPANTS);
- } else {
- if (vehModelInfo->m_nNumDoors >= 4) {
- plugin::patch::SetUChar(tableBoat1Pos, boatOccupants);
- }
- }
- }
- } else {
- if (boatOccupants == TWO_OCCUPANTS) {
- if (vehModelInfo->m_nNumDoors == 1) {
- plugin::patch::SetUChar(tableBoat1Pos, ONE_OCCUPANT);
- }
- } else {
- if (boatOccupants == ONE_OCCUPANT || boatOccupants == DRIVER_AND_GUNMAN) {
- plugin::patch::SetUChar(tableBoat1Pos, boatOccupants);
- }
- }
- }
- plugin::patch::SetUChar(tableBoat2Pos, COPS_IN_CAR);
- // plugin::patch::SetUChar(tableBoat4Pos, LAW_VEHICLE);
- if (boatModelID >= lowestCase && boatModelID < highestCase) {
- plugin::patch::SetUChar(boatModelID - lowestCase + SwitchTableStart, DRIVER_DEFAULT);
- }
- // Models
- plugin::patch::SetUInt(0x430501 + 1, boatModelID); // [DWORD]
- plugin::patch::SetUInt(0x4304ED + 4, boatModelID); // [DWORD]
- LoadedObjectInfo = plugin::patch::GetUInt(0x4044C7 + 3);
- plugin::patch::SetUInt(0x4304E6 + 2, boatModelID * 0x14 + LoadedObjectInfo);
- }
- } else {
- CStreaming::RequestModel(boatModelID, true);
- CStreaming::RequestModel(boatDriverID, true);
- // CStreaming::LoadRequestedModels();
- }
- }
- }
- }
- }
- };
- }
- } wantedLevelEditor;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement