Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
9.1 kB
7
Indexable
Never
enum RockstarEvent
{
	SCRIPT_ARRAY_DATA_VERIFY_EVENT = 3,
	REQUEST_CONTROL_EVENT = 4,
	GIVE_CONTROL_EVENT = 5,
	WEAPON_DAMAGE_EVENT = 6,
	INCAPACITATED_REVIVE_EVENT = 55,
	INCAPACITATED_EXECUTE_EVENT = 56,
	REQUEST_PICKUP_EVENT = 7,
	REQUEST_MAP_PICKUP_EVENT = 8,
	REQUEST_IS_VOLUME_EMPTY = 116,
	RESPAWN_PLAYER_PED_EVENT = 11,
	GENERIC_COMPONENT_CONTROL_EVENT = 12,
	FIRE_EVENT = 13,
	FIRE_TRAIL_UPDATE_EVENT = 14,
	EXPLOSION_EVENT = 15,
	START_PROJECTILE_EVENT = 16,
	ALTER_WANTED_LEVEL_EVENT = 17,
	RAGDOLL_REQUEST_EVENT = 20,
	PLAYER_CARD_STAT_EVENT = 21,
	DOOR_BREAK_EVENT = 22,
	SCRIPTED_GAME_EVENT = 23,
	REMOTE_SCRIPT_INFO_EVENT = 24,
	REMOTE_SCRIPT_LEAVE_EVENT = 25,
	MARK_AS_NO_LONGER_NEEDED_EVENT = 26,
	CONVERT_TO_SCRIPT_ENTITY_EVENT = 27,
	INCIDENT_EVENT = 31,
	INCIDENT_ENTITY_EVENT = 32,
	CLEAR_AREA_EVENT = 29,
	CLEAR_VOLUME_EVENT = 30,
	GIVE_PED_SCRIPTED_TASK_EVENT = 33,
	GIVE_PED_SEQUENCE_TASK_EVENT = 34,
	NETWORK_CLEAR_PED_TASKS_EVENT = 35,
	NETWORK_SOUND_CAR_HORN_EVENT = 37,
	NETWORK_ENTITY_AREA_STATUS_EVENT = 38,
	NETWORK_GARAGE_OCCUPIED_STATUS_EVENT = 39,
	NETWORK_PED_WHISTLE_EVENT = 135,
	PED_SPEECH_CREATE_EVENT = 40,
	PED_SPEECH_PLAY_EVENT = 41,
	PED_SPEECH_STOP_EVENT = 42,
	PED_SPEECH_ASSIGN_VOICE_EVENT = 43,
	SCRIPT_ENTITY_STATE_CHANGE_EVENT = 44,
	NETWORK_PLAY_SCRIPT_SOUND_EVENT = 45,
	NETWORK_PLAY_AUDIO_ENTITY_SOUND_EVENT = 46,
	NETWORK_STOP_SCRIPT_SOUND_EVENT = 47,
	NETWORK_STOP_AUDIO_ENTITY_SOUND_EVENT = 48,
	NETWORK_TRAIN_REQUEST_EVENT = 51,
	NETWORK_INCREMENT_STAT_EVENT = 51,
	MODIFY_VEHICLE_LOCK_WORD_STATE_DATA = 53,
	REQUEST_PHONE_EXPLOSION_EVENT = 57,
	REQUEST_DETACHMENT_EVENT = 58,
	KICK_VOTES_EVENT = 59,
	GIVE_PICKUP_REWARDS_EVENT = 60,
	BLOW_UP_VEHICLE_EVENT = 61,
	NETWORK_SPECIAL_FIRE_EQUIPPED_WEAPON = 62,
	NETWORK_RESPONDED_TO_THREAT_EVENT = 63,
	NETWORK_SHOUT_TARGET_POSITION_EVENT = 64,
	PICKUP_DESTROYED_EVENT = 66,
	NETWORK_PTFX_EVENT = 68,
	NETWORK_PED_SEEN_DEAD_PED_EVENT = 69,
	PED_PLAY_PAIN_EVENT = 72,
	ADD_OR_REMOVE_PED_FROM_PEDGROUP_EVENT = 73,
	NETWORK_START_PED_HOGTIE_EVENT = 74,
	NETWORK_SEND_PED_LASSO_ATTACH_EVENT = 75,
	NETWORK_SEND_PED_LASSO_DETTACH_EVENT = 76,
	NETWORK_SEND_CARRIABLE_UPDATE_CARRY_STATE_EVENT = 78,
	REQUEST_CONTROL_REQUESTER_EVENT = 81,
	NETWORK_VOLUME_LOCK_REQUEST_EVENT = 82,
	NETWORK_VOLUME_LOCK_REQUEST_FAILURE_EVENT = 83,
	NETWORK_VOLUME_LOCK_KEEP_ALIVE_EVENT = 84,
	NETWORK_VOLUME_LOCK_MOVE_EVENT = 85,
	NETWORK_VOLUME_LOCK_ATTACH_EVENT = 86,
	NETWORK_VOLUME_LOCK_DETACH_EVENT = 87,
	NETWORK_VOLUME_LOCK_RESIZE_EVENT = 88,
	NETWORK_VOLUME_LOCK_RELEASE_EVENT = 89,
	NETWORK_VOLUME_LOCK_DATA_EVENT = 90,
	NETWORK_MAKE_WITNESS_EVENT = 91,
	NETWORK_REMOVE_WITNESS_EVENT = 92,
	NETWORK_GANG_INVITE_PLAYER_EVENT = 93,
	NETWORK_GANG_INVITE_RESPONSE_EVENT = 94,
	NETWORK_GANG_INVITE_CANCEL_EVENT = 95,
	NETWORK_GANG_JOIN_REQUEST_EVENT = 96,
	NETWORK_REQUEST_CONVERT_TO_SCRIPT_ENTITY_EVENT = 100,
	NETWORK_REGISTER_CRIME_EVENT = 101,
	NETWORK_START_LOOT_EVENT = 103,
	NETWORK_NEW_BUG_EVENT = 104,
	REPORT_CASH_SPAWN_EVENT = 108,
	NETWORK_CHEST_REQUEST_EVENT = 109,
	NETWORK_CHEST_DATA_CHANGE_EVENT = 110,
	NETWORK_CHEST_RELEASE_EVENT = 111,
	NETWORK_CLEAR_GANG_BOUNTY_EVENT = 112,
	NETWORK_PLAYER_REQUEST_CONTENTION_EVENT = 113,
	NETWORK_START_FALLBACK_CARRY_ACTION_EVENT = 114,
	NETWORK_GIVE_ENERGY_EVENT = 115,
	NETWORK_DOOR_STATE_CHANGE = 118,
	NETWORK_STAMINA_COST_EVENT = 119,
	NETWORK_REMOVE_DOOR = 120,
	SCRIPT_COMMAND_EVENT = 121,
	NETWORK_KNOCK_PED_OFF_VEHICLE_EVENT = 122,
	NETWORK_SPAWN_SEARCH_EVENT = 123,
	NETWORK_ROPE_WORLD_STATE_DATA_BREAK_EVENT = 124,
	NETWORK_PLAYER_HAT_EVENT = 125,
	NETWORK_CRIME_SCENE_EVENT = 126,
	NETWORK_POINT_OF_INTEREST_EVENT = 127,
	NETWORK_DESTROY_VEHICLE_LOCK_EVENT = 129,
	NETWORK_APPLY_REACTION_EVENT = 130,
	NETWORK_START_LOOT_ALIVE_EVENT = 131,
	NETWORK_SET_ENTITY_GHOST_WITH_PLAYER_EVENT = 132,
	NETWORK_COMBAT_DIRECTOR_EVENT = 133,
	NETWORK_MELEE_ARBITRATION_FAIL_EVENT = 134,
	NETWORK_PED_MOTIVATION_CHANGE_EVENT = 136,
	NETWORK_IGNITE_BOMB_EVENT = 36,
	NETWORK_PED_SHARED_TARGETING_EVENT = 137,
	NETWORK_REQUEST_COMBAT_GESTURE = 138,
	NETWORK_CRIME_REPORT_EVENT = 102,
	LIGHTNING_EVENT = 139,
	PED_TRIGGER_BULLET_FLINCH_EVENT = 140,
	PED_TRIGGER_EXPLOSION_FLINCH_EVENT = 141,
	NETWORK_PLAYER_WHISTLE_EVENT = 142,
	CONVERSATION_EVENT = 145,
	NETWORK_END_LOOT_EVENT = 147,
	NETWORK_PLAYER_SPURRING_EVENT = 143,
	NETWORK_PLAYER_HORSE_TAMING_CALLOUT_EVENT = 144,
	NETWORK_PICKUP_CARRIABLE_EVENT = 148,
	NETWORK_PLACE_CARRIABLE_ONTO_PARENT_EVENT = 149,
	PLAY_DEAD_EVENT = 150,
	NETWORK_PLAYER_HORSE_SHOT_EVENT = 151,
	ANIM_SCENE_ABORT_ENTITY_EVENT = 152,
	NETWORK_REQUEST_ASSET_DETACHMENT = 153,
	NETWORK_CARRIABLE_VEHICLE_STOW_START_EVENT = 154,
	NETWORK_CARRIABLE_VEHICLE_STOW_COMPLETE_EVENT = 155,
	NETWORK_BOLAS_HIT_EVENT = 77,
	NETWORK_WANTED_EVENT = 18,
	NETWORK_UPDATE_ANIMATED_VEHICLE_PROP_EVENT = 156,
	NETWORK_SET_CARRYING_FLAG_FOR_ENTITY = 157,
	NETWORK_BOUNTY_HUNT_EVENT = 158,
	NETWORK_DEBUG_REQUEST_ENTITY_POSITION = 159,
	NETWORK_REMOVE_PROP_OWNERSHIP = 160,
	NETWORK_DUMP_CARRIABLE_OFF_MOUNT_EVENT = 161,
	NETWORK_FORCE_IN_SCOPE_FOR_DUPLICATE_OBJECT_OWNER = 162,
	REVENT_EVENT_END
}; //53 43 52 49 50 54 5F 41 52 52 41 59 5F 44 41 54  41 5F 56 45 52 49 46 59 5F 45 56 45 4E 54 00
//48 83 EC 28 E8 C3 73 80 ?

const int EVENT_COUNT = REVENT_EVENT_END;
static std::vector<void*> EventPtr;
static unsigned char EventRestore[REVENT_EVENT_END] = { 0 };

	
		setFn<fpGetEventData>((char*)"get_event_data",
			(char*)"\x48\x89\x5C\x24\x00\x57\x48\x83\xEC\x20\x49\x8B\xF8\x41\x8B\xD9",
			(char*)"xxxx?xxxxxxxxxxx",
			&Hooking::get_event_data);

		setFn<fpreceivedeventptr>((char*)"received_event_ptr",
			(char*)"\x48\x8B\xC4\x48\x89\x58\x08\x48\x89\x68\x10\x48\x89\x70\x18\x48\x89\x78\x20\x41\x56\x48\x83\xEC\x30\x48\x8B\xD9\x45\x0F\xB7\xF1",
			(char*)"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
			&Hooking::received_event_ptr);
		
		auto p_eventHook = pattern("48 83 EC 28 E8 C3 73 80 ?");
		char* c_location = nullptr;
		void* v_location = nullptr;

		Log::Msg("Getting Event Hook...");
		if ((c_location = p_eventHook.count(1).get(0).get<char>(0)))
		{
			int i = 0, j = 0, matches = 0, found = 0;
			char* pattern = (char*)"\x4C\x8D\x0D";
			while (found != EVENT_COUNT)
			{
				if (c_location[i] == pattern[j])
				{
					if (++matches == 3)
					{
						EventPtr.push_back((void*)(reinterpret_cast<uint64_t>(c_location + i - j) + *reinterpret_cast<int*>(c_location + i + 1) + 7));
						found++;
						j = matches = 0;
					}
					j++;
				}
				else
				{
					matches = j = 0;
				}
				i++;
			}
		}


		MH_CreateHook((LPVOID)Hooking::received_event_ptr, &Hooking::receivedevent, &m_OriginalReceivedEvent);
		MH_EnableHook((LPVOID)Hooking::received_event_ptr);
		Log::Msg("received_event create_status : 0x%#p 0x%llX\n", Hooking::received_event_ptr);

		MH_CreateHook((LPVOID)Hooking::get_event_data, &Hooking::GED, &m_OriginalGetEventData);
		MH_EnableHook((LPVOID)Hooking::get_event_data);
		Log::Msg("get_event_data create_status : 0x%#p 0x%llX\n", Hooking::get_event_data);





	typedef int int64_t;
	bool Hooking::protection2 = false;
	bool Hooking::GED(int eventGroup, int eventIndex, __int64* argStruct, int argStructSize)
	{
		int argsstructs1 = argStruct[1];
		int argsstructs0 = argStruct[0];
		char* name = Hooking::get_player_name(argsstructs1);
		/*const char* name = PLAYER::GET_PLAYER_NAME(argsstructs1);*/
		char id[30];
		char sender[30];

			auto result = static_cast<decltype(&GED)>(m_OriginalGetEventData)(eventGroup, eventIndex, argStruct, argStructSize);

			if (result && argStruct[0] != 0)
			{





	bool Hooking::geteventdata = false;
	void* m_OriginalGetEventData = nullptr;

	uintptr_t received_event_ptr;
	void* m_OriginalReceivedEvent = nullptr;
	const char* EventName[2000];
	bool Hooking::receivedevent(void* event_manager, __int64* sender, __int64* receiver, unsigned __int16 event_id, int event_index, int event_handled_bitset, __int64 bitbuffer_size, __int64 bitbuffer) {
		auto sender_id = *reinterpret_cast<BYTE*>(sender + 25);
		const char* senderName = PLAYER::GET_PLAYER_NAME(sender_id);
					switch (event_id)
			{
			case EXPLOSION_EVENT:
			{
				if (Hooking::EXPLOSIONEVENT)
				{
				Log::Msg("EXPLOSION_EVENT \n");
				printf("EXPLOSION_EVENT \n");
				return 0;
			}
			};
			case FIRE_EVENT:
			{
				if (Hooking::FIREEVENT)
				{
				Log::Msg("FIRE_EVENT \n");
				printf("FIRE_EVENT \n");
				return 0;
			}
			};
			case NETWORK_CLEAR_PED_TASKS_EVENT:
			{
				if (Hooking::NETWORKCLEARPEDTASKSEVENT)
				{
				Log::Msg("NETWORK_CLEAR_PED_TASKS_EVENT \n");
				printf("NETWORK_CLEAR_PED_TASKS_EVENT \n");
				return 0;
				}
			};
				}

		return static_cast<decltype(&receivedevent)>(m_OriginalReceivedEvent)(event_manager, sender, receiver, event_id, event_index, event_handled_bitset, bitbuffer_size, bitbuffer);