Last active
October 13, 2021 12:06
-
-
Save user-grinch/8ea6d489c4a672c07b5b441622865ffa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CPools.h> | |
#include <assembly.hpp> | |
#include <extensions/ScriptCommands.h> | |
#include <extensions/scripting/ScriptCommandNames.h> | |
#define NEWS_CHOPPER 488 | |
#define COP_CHOPPER 497 | |
#define COP_CHAR 280 | |
#define NEWS_CHAR 23 | |
#define PILOT_CHAR 61 | |
int &numSearchLights = *(int*)0xC1C96C; | |
using namespace plugin; | |
class HeliFix | |
{ | |
public: | |
HeliFix() | |
{ | |
// add driver and a passenger in helis | |
injector::MakeInline<0x6C6865, 0x6C6870>([](injector::reg_pack& regs) | |
{ | |
CVehicle *pVeh = (CVehicle*)regs.esi; | |
int hVeh = CPools::GetVehicleRef(pVeh); | |
if (pVeh->m_nModelIndex == COP_CHOPPER) | |
{ | |
Command<Commands::REQUEST_MODEL>(COP_CHAR); | |
Command<Commands::LOAD_ALL_MODELS_NOW>(); | |
Command<Commands::CREATE_CHAR_INSIDE_CAR>(hVeh, PED_TYPE_COP, COP_CHAR); | |
Command<Commands::CREATE_CHAR_AS_PASSENGER>(hVeh, PED_TYPE_COP, COP_CHAR); | |
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(COP_CHAR); | |
} | |
else | |
{ | |
Command<Commands::REQUEST_MODEL>(PILOT_CHAR); | |
Command<Commands::REQUEST_MODEL>(NEWS_CHAR); | |
Command<Commands::LOAD_ALL_MODELS_NOW>(); | |
Command<Commands::CREATE_CHAR_INSIDE_CAR>(hVeh, PED_TYPE_CIVMALE, PILOT_CHAR); | |
if (pVeh->m_nModelIndex == NEWS_CHOPPER) | |
{ | |
Command<Commands::CREATE_CHAR_AS_PASSENGER>(hVeh, PED_TYPE_CIVMALE, NEWS_CHAR); | |
} | |
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(NEWS_CHAR); | |
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(PILOT_CHAR); | |
} | |
}); | |
// disable search lights during daytime | |
injector::MakeInline<0x6C462A, 0x6C4630>([](injector::reg_pack& regs) | |
{ | |
int hour, min; | |
Command<Commands::GET_TIME_OF_DAY>(&hour, &min); | |
if (hour > 6 && hour < 22) | |
{ | |
numSearchLights = 0; | |
} | |
else | |
{ | |
numSearchLights = regs.edx; | |
} | |
}); | |
}; | |
} heliFix; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment