void get_button_state(bool *a, bool *b, bool *up, bool *down, bool *l, bool *r)
{
	KeyInputConfig *keyConf = config->get_key_config();

	if (a) *a = IsKeyJustUp(KeyConfig::KEY_MENU_SELECT) || IsControllerButtonJustUp(KeyConfig::KEY_MENU_SELECT);
	if (b) *b = IsKeyJustUp(KeyConfig::KEY_MENU_BACK) || IsControllerButtonJustUp(KeyConfig::KEY_MENU_BACK);

	if (up) *up = IsKeyDown(KeyConfig::KEY_MENU_UP) || IsControllerButtonDown(KeyConfig::KEY_MENU_UP);
	if (down) *down = IsKeyDown(KeyConfig::KEY_MENU_DOWN) || IsControllerButtonDown(KeyConfig::KEY_MENU_DOWN);
	if (r) *r = IsKeyDown(KeyConfig::KEY_MENU_RIGHT) || IsControllerButtonDown(KeyConfig::KEY_MENU_RIGHT);
	if (l) *l = IsKeyDown(KeyConfig::KEY_MENU_LEFT) || IsControllerButtonDown(KeyConfig::KEY_MENU_LEFT);
}
示例#2
0
bool IsKeyCombinationJustUp(std::string humanReadableKey)
{
	std::vector<std::string> keys = SplitKeyCombination(humanReadableKey);

	for (auto &key : keys)
	{
		if (IsKeyJustUp(str2key(key)))
		{
			return true;
		}
	}

	return false;
}
示例#3
0
bool airbrake_switch_pressed()
{
	bool result = IsKeyJustUp(KeyConfig::KEY_TOGGLE_AIRBRAKE) || IsControllerButtonJustUp(KeyConfig::KEY_TOGGLE_AIRBRAKE);
	if (result)
	{
		//avoid repeat of key press
		DWORD maxTickCount = GetTickCount() + 200;
		do
		{
			UpdateXInputControlState();
			WAIT(0);
		} while (GetTickCount() < maxTickCount);
	}
	return result;
}
bool trainer_switch_pressed()
{
	bool result = IsKeyJustUp(KeyConfig::KEY_TOGGLE_MAIN_MENU) || IsControllerButtonJustUp(KeyConfig::KEY_TOGGLE_MAIN_MENU);
	if (result)
	{
		//avoid repeat of key press
		DWORD maxTickCount = GetTickCount() + 200;
		do
		{
			UpdateXInputControlState();
			make_periodic_feature_call();
			WAIT(0);
		} while (GetTickCount() < maxTickCount);
	}
	return result;
}
bool trainer_switch_pressed()
{
	return IsKeyJustUp(trainerToggleHotkey);
}
示例#6
0
void main() {
	int keyLemmy = 0x4C;
	int keyHooker = 0x48;
	int keyBike = 0x42;
	int keySmoke = 0x4F;
	int keyDrink = 0x4B;
	int keyGuitar = 0x49;
	int keyShirt = 0x4A;
	int keyStop = 0x51;

	char iniPath[260];
	GetFullPathName("LemmyKilmister.ini", 261, iniPath, NULL);
	IniReader ini(iniPath);
	if (ini.fileExists()) {
		ini.readInt("Controls", "Lemmy", 0x4C, 16, keyLemmy);
		ini.readInt("Controls", "Hooker", 0x48, 16, keyHooker);
		ini.readInt("Controls", "Bike", 0x42, 16, keyBike);
		ini.readInt("Controls", "Smoke", 0x4F, 16, keySmoke);
		ini.readInt("Controls", "Drink", 0x4B, 16, keyDrink);
		ini.readInt("Controls", "Guitar", 0x49, 16, keyGuitar);
		ini.readInt("Controls", "Shirt", 0x4A, 16, keyShirt);
		ini.readInt("Controls", "Stop", 0x51, 16, keyStop);
	}

	Ped playerPed;
	Player playerID;
	Vector3 position;
	bool widescreen = GRAPHICS::GET_IS_WIDESCREEN();

	while (true) {
		// INIT
		playerID = PLAYER::PLAYER_ID();
		playerPed = PLAYER::PLAYER_PED_ID();
		position = ENTITY::GET_ENTITY_COORDS(playerPed, 1);

		// reset to normal skin if dies or get arrested
		Hash model = ENTITY::GET_ENTITY_MODEL(playerPed);
		if (ENTITY::IS_ENTITY_DEAD(playerPed) || PLAYER::IS_PLAYER_BEING_ARRESTED(playerID, TRUE)) {
			if (model != GAMEPLAY::GET_HASH_KEY("player_zero") &&
				model != GAMEPLAY::GET_HASH_KEY("player_one") &&
				model != GAMEPLAY::GET_HASH_KEY("player_two")) {
				WAIT(1000);
				model = GAMEPLAY::GET_HASH_KEY("player_zero");
				STREAMING::REQUEST_MODEL(model);
				while (!STREAMING::HAS_MODEL_LOADED(model))	WAIT(0);
				PLAYER::SET_PLAYER_MODEL(PLAYER::PLAYER_ID(), model);
				PED::SET_PED_DEFAULT_COMPONENT_VARIATION(PLAYER::PLAYER_PED_ID());
				STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model);
				while (ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID()) || PLAYER::IS_PLAYER_BEING_ARRESTED(playerID, TRUE))
					WAIT(0);
			}
		}

		// CHANGE SKIN
		if (IsKeyDown(VK_SHIFT) && IsKeyJustUp(keyLemmy)) {
			DWORD freemodeMale = GAMEPLAY::GET_HASH_KEY((char *)"mp_m_freemode_01");
			if (STREAMING::IS_MODEL_IN_CDIMAGE(freemodeMale) && STREAMING::IS_MODEL_VALID(freemodeMale)) {
				STREAMING::REQUEST_MODEL(freemodeMale);
				while (!STREAMING::HAS_MODEL_LOADED(freemodeMale))
					WAIT(0);
				PLAYER::SET_PLAYER_MODEL(PLAYER::PLAYER_ID(), freemodeMale);

				playerPed = PLAYER::PLAYER_PED_ID();
				PED::SET_PED_DEFAULT_COMPONENT_VARIATION(playerPed);

				// CLOTHES and FACE
				PED::SET_PED_HEAD_BLEND_DATA(playerPed, 0, 0, 0, 0, 0, 0, 1.0, 1.0, 1.0, true);
				PED::SET_PED_HEAD_OVERLAY(playerPed, 1, 27, 1.0); // bread
				PED::_0x497BF74A7B9CB952(playerPed, 1, 1, 0, 0); // beard color
				PED::SET_PED_HEAD_OVERLAY(playerPed, 2, 19, 1.0); // eyebrow
				PED::_0x497BF74A7B9CB952(playerPed, 2, 1, 0, 0); // eyebrow color
				PED::SET_PED_HEAD_OVERLAY(playerPed, 3, 14, 1.0); // ageing
				PED::SET_PED_HEAD_OVERLAY(playerPed, 10, 0, 1.0); // peli
				PED::_0x497BF74A7B9CB952(playerPed, 10, 1, 0, 0); // peli color
				
				PED::SET_PED_COMPONENT_VARIATION(playerPed, 2, 22, 0, 2); // hair
				PED::_0x4CFFC65454C93A49(playerPed, 0, 0); // hair color
				PED::SET_PED_COMPONENT_VARIATION(playerPed, 3, 11, 0, 2); // torso
				PED::SET_PED_COMPONENT_VARIATION(playerPed, 4, 4, 0, 2); // pants
				PED::SET_PED_COMPONENT_VARIATION(playerPed, 8, 15, 0, 2); // acc
				//PED::SET_PED_COMPONENT_VARIATION(playerPed, 6, 15, 0, 2); // shoes
				//PED::SET_PED_COMPONENT_VARIATION(playerPed, 11, 13, 2, 2); // t2
				PED::IS_PED_COMPONENT_VARIATION_VALID(playerPed, 6, 37, 0) ? PED::SET_PED_COMPONENT_VARIATION(playerPed, 6, 37, 0, 2) : PED::SET_PED_COMPONENT_VARIATION(playerPed, 6, 15, 0, 2);
				PED::IS_PED_COMPONENT_VARIATION_VALID(playerPed, 11, 95, 2) ? PED::SET_PED_COMPONENT_VARIATION(playerPed, 11, 95, 1, 2) : PED::SET_PED_COMPONENT_VARIATION(playerPed, 11, 13, 2, 2);

				// TATTOOS
				DWORD coll1 = GAMEPLAY::GET_HASH_KEY("multiplayer_overlays");
				DWORD tattoo1 = GAMEPLAY::GET_HASH_KEY("FM_Tat_Award_F_001");
				PED::_0x5F5D1665E352A839(playerPed, coll1, tattoo1);
				DWORD coll2 = GAMEPLAY::GET_HASH_KEY("multiplayer_overlays");
				DWORD tattoo2 = GAMEPLAY::GET_HASH_KEY("FM_Tat_M_038");
				PED::_0x5F5D1665E352A839(playerPed, coll2, tattoo2);

				// PROPS
				PED::SET_PED_PROP_INDEX(playerPed, 0, 13, 0, true); // hat
				PED::SET_PED_PROP_INDEX(playerPed, 1, 5, 0, true); // glasses

				STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(freemodeMale);
			}
		}

		// WEAR MOTORHEAD SHIRT
		if (IsKeyDown(VK_SHIFT) && IsKeyJustUp(keyShirt)) {
			PED::SET_PED_COMPONENT_VARIATION(PLAYER::PLAYER_PED_ID(), 3, 0, 0, 2); // torso
			PED::SET_PED_COMPONENT_VARIATION(PLAYER::PLAYER_PED_ID(), 11, 0, 2, 2); // t2
		}

		// SPAWN HEXER MOTORBIKE
		if (IsKeyDown(VK_SHIFT) && IsKeyJustUp(keyBike)) {
			// from Alexander Blade native trainer code
			DWORD model = GAMEPLAY::GET_HASH_KEY((char *)"HEXER");
			if (STREAMING::IS_MODEL_IN_CDIMAGE(model) && STREAMING::IS_MODEL_A_VEHICLE(model)) {
				STREAMING::REQUEST_MODEL(model);
				while (!STREAMING::HAS_MODEL_LOADED(model))
					WAIT(0);
				Vector3 coords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0);
				Vehicle veh = VEHICLE::CREATE_VEHICLE(model, coords.x, coords.y, coords.z, 0.0, 1, 1);
				VEHICLE::SET_VEHICLE_COLOURS(veh, 0, 0);
				VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(veh);

				WAIT(0);
				STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model);
				ENTITY::SET_VEHICLE_AS_NO_LONGER_NEEDED(&veh);
			}
		}

		// SPAWN HOOKERS
		if (IsKeyDown(VK_SHIFT) && IsKeyJustUp(keyHooker)) {
			DWORD hooker = GAMEPLAY::GET_HASH_KEY((char *)"s_f_y_hooker_01");
			if (STREAMING::IS_MODEL_IN_CDIMAGE(hooker) && STREAMING::IS_MODEL_VALID(hooker)) {
				STREAMING::REQUEST_MODEL(hooker);
				while (!STREAMING::HAS_MODEL_LOADED(hooker))
					WAIT(0);
				playerPed = PLAYER::PLAYER_PED_ID();
				Vector3 pos = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 3.0, 0.0);
				Ped ped = PED::CREATE_PED(5, hooker, pos.x, pos.y, pos.z, 1, false, true);

				// the hooker is YOUR hooker
				int groupIndex = PED::GET_PED_GROUP_INDEX(playerPed);
				PED::SET_PED_AS_GROUP_LEADER(playerPed, groupIndex);
				PED::SET_PED_AS_GROUP_MEMBER(ped, groupIndex);
				PED::SET_PED_NEVER_LEAVES_GROUP(ped, true);

				WAIT(100);
				STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hooker);
			}
		}

		// ANIMATIONS
		// SMOKING
		if (IsKeyDown(VK_SHIFT) && IsKeyJustUp(keySmoke)) {
			playerPed = PLAYER::PLAYER_PED_ID();
			AI::TASK_START_SCENARIO_IN_PLACE(playerPed, "WORLD_HUMAN_SMOKING", 0, 1);
		}

		// DRINKING
		if (IsKeyDown(VK_SHIFT) && IsKeyJustUp(keyDrink)) {
			playerPed = PLAYER::PLAYER_PED_ID();
			AI::TASK_START_SCENARIO_IN_PLACE(playerPed, "WORLD_HUMAN_DRINKING", 0, 1);
		}

		// GUITAR
		if (IsKeyDown(VK_SHIFT) && IsKeyJustUp(keyGuitar)) {
			playerPed = PLAYER::PLAYER_PED_ID();
			AI::TASK_START_SCENARIO_IN_PLACE(playerPed, "WORLD_HUMAN_MUSICIAN", 0, 1);
		}

		// STOP ANIMATIONS
		if (IsKeyDown(VK_SHIFT) && IsKeyJustUp(keyStop)) {
			playerPed = PLAYER::PLAYER_PED_ID();
			AI::CLEAR_PED_TASKS_IMMEDIATELY(playerPed);
		}
		
		// DEBUGGING
		/*
		if (IsKeyDown(0x31)) {
			playerPed = PLAYER::PLAYER_PED_ID();
			int numVar = PED::GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS(playerPed, 0);

			int face = PED::GET_PED_DRAWABLE_VARIATION(playerPed, 0);
			int head = PED::GET_PED_DRAWABLE_VARIATION(playerPed, 1);
			int hair = PED::GET_PED_DRAWABLE_VARIATION(playerPed, 2);
			int tors = PED::GET_PED_DRAWABLE_VARIATION(playerPed, 3);
			int leg = PED::GET_PED_DRAWABLE_VARIATION(playerPed, 4);
			int hand = PED::GET_PED_DRAWABLE_VARIATION(playerPed, 5);
			int feet = PED::GET_PED_DRAWABLE_VARIATION(playerPed, 6);
			int eye = PED::GET_PED_DRAWABLE_VARIATION(playerPed, 7);
			int acc = PED::GET_PED_DRAWABLE_VARIATION(playerPed, 8);
			int task = PED::GET_PED_DRAWABLE_VARIATION(playerPed, 9);
			int tex = PED::GET_PED_DRAWABLE_VARIATION(playerPed, 10);
			int t2 = PED::GET_PED_DRAWABLE_VARIATION(playerPed, 11);

			int hat = PED::GET_PED_PROP_INDEX(playerPed, 0);
			int glasses = PED::GET_PED_PROP_INDEX(playerPed, 1);

			int ov0 = PED::_0xA60EF3B6461A4D43(playerPed, 0);
			int ov1 = PED::_0xA60EF3B6461A4D43(playerPed, 1);
			int ov2 = PED::_0xA60EF3B6461A4D43(playerPed, 2);
			int ov3 = PED::_0xA60EF3B6461A4D43(playerPed, 3);
			int ov4 = PED::_0xA60EF3B6461A4D43(playerPed, 4);
			int ov5 = PED::_0xA60EF3B6461A4D43(playerPed, 5);
			int ov6 = PED::_0xA60EF3B6461A4D43(playerPed, 6);
			int ov7 = PED::_0xA60EF3B6461A4D43(playerPed, 7);
			int ov8 = PED::_0xA60EF3B6461A4D43(playerPed, 8);
			int ov9 = PED::_0xA60EF3B6461A4D43(playerPed, 9);
			int ov10 = PED::_0xA60EF3B6461A4D43(playerPed, 10);
			int ov11 = PED::_0xA60EF3B6461A4D43(playerPed, 11);

			DWORD coll1 = GAMEPLAY::GET_HASH_KEY("mpchristmas2_overlays");
			DWORD tattoo1 = GAMEPLAY::GET_HASH_KEY("MP_Xmas2_M_Tat_000");
			int zone = PED::_0x9FD452BFBE7A7A8B(coll1, tattoo1);

			char text1[300], text2[300];
			sprintf_s(text1, "FAC:%d HED:%d HAIR:%d TOR:%d LEG:%d HAND:%d FEET:%d EYE:%d ACC:%d TASK:%d TEX:%d TORSO2:%d", face, head, hair, tors, leg, hand, feet, eye, acc, task, tex, t2);
			draw_text(text1, 0.5, 0, 0.3);
			sprintf_s(text1, "HAT:%d GLASSES:%d", hat, glasses);
			draw_text(text1, 0.6, 0, 0.3);
			sprintf_s(text2, "ov0:%d ov1:%d ov2:%d ov3:%d ov4:%d ov5:%d ov6:%d ov7:%d ov8:%d ov9:%d ov10:%d ov11:%d", ov0, ov1, ov2, ov3, ov4, ov5, ov6, ov7, ov8, ov9, ov10, ov11);
			draw_text(text2, 0.7, 0, 0.3);
		}
		*/

		WAIT(0);
	}
}
示例#7
0
// Updates all features that can be turned off by the game, being called each game frame
void update_features()
{
	/*int* gp = reinterpret_cast<int *>(getGlobalPtr(0x1801D9));
	*gp = 1;

	gp = reinterpret_cast<int *>(getGlobalPtr(0x187385 + 0x10F18));
	*gp = 1;

	gp = reinterpret_cast<int *>(getGlobalPtr(0x250FDB + 0xf158D));
	*gp = 0;

	int* gp = reinterpret_cast<int *>(getGlobalPtr(0x42CA + 0x9));
	*gp = 0xFF;
	*/

	everInitialised = true;
	game_frame_num++;
	if (game_frame_num >= 100000)
	{
		game_frame_num = 0;
	}

	if (game_frame_num % 1000 == 0)
	{
		DWORD myThreadID;
		HANDLE myHandle = CreateThread(0, 0, save_settings_thread, 0, 0, &myThreadID);
		CloseHandle(myHandle);
	}

	UpdateXInputControlState();

	check_for_hotkey_presses();

	if (is_menu_showing() || is_in_airbrake_mode())
	{
		if (is_input_blocked_in_menu() || is_in_airbrake_mode())
		{
			setGameInputToEnabled(false);
		}
		else
		{
			setGameInputToEnabled(true);
		}
	}
	else
	{
		setGameInputToEnabled(true);
	}

	if (is_in_airbrake_mode())
	{
		setAirbrakeRelatedInputToBlocked(true);
	}
	else
	{
		setAirbrakeRelatedInputToBlocked(false);
	}

	update_centre_screen_status_text();

	update_vehicle_guns();

	update_world_features();

	check_player_model();

	//debug_native_investigation();

	// common variables
	Player player = PLAYER::PLAYER_ID();
	Ped playerPed = PLAYER::PLAYER_PED_ID();	
	BOOL bPlayerExists = ENTITY::DOES_ENTITY_EXIST(playerPed);

	//PLAYER::DISABLE_PLAYER_FIRING(playerPed, TRUE);

	// player invincible
	if (featurePlayerInvincibleUpdated)
	{
		if (bPlayerExists && !featurePlayerInvincible)
			PLAYER::SET_PLAYER_INVINCIBLE(player, FALSE);
		featurePlayerInvincibleUpdated = false;
	}
	if (featurePlayerInvincible)
	{
		if (bPlayerExists)
			PLAYER::SET_PLAYER_INVINCIBLE(player, TRUE);
	}

	
	//Wanted Level Frozen - prevents stars increasing/decreasing
	if (featureWantedLevelFrozen)
	{
		if (featureWantedLevelFrozenUpdated)
		{
			frozenWantedLevel = PLAYER::GET_PLAYER_WANTED_LEVEL(player);
			PLAYER::SET_MAX_WANTED_LEVEL(frozenWantedLevel);
			featureWantedLevelFrozenUpdated = false;

			if (frozenWantedLevel > 0)
			{
				std::stringstream ss;
				ss << "Wanted Level Frozen at: " << frozenWantedLevel << " Star";
				if (frozenWantedLevel > 1){ ss << "s"; }
				set_status_text(ss.str());
			}
		}
		if (frozenWantedLevel > 0)
		{
			if (bPlayerExists)
			{
				PLAYER::SET_PLAYER_WANTED_LEVEL(player, frozenWantedLevel, 0);
				PLAYER::SET_PLAYER_WANTED_LEVEL_NOW(player, 0);
			}
		}
		else
		{
			featureWantedLevelFrozen = false;
			set_status_text("You must have a Wanted Level first.");
		}
	}
	if (featureWantedLevelFrozenUpdated)
	{
		if (!featureWantedLevelFrozen)
		{
			set_status_text("Wanted Level Unfrozen");
			PLAYER::SET_MAX_WANTED_LEVEL(5);
		}
		featureWantedLevelFrozenUpdated = false;
	}
	
	
	// player never wanted
	if (featurePlayerNeverWanted)
	{
		if (bPlayerExists)
		{
			PLAYER::CLEAR_PLAYER_WANTED_LEVEL(player);
			PLAYER::SET_MAX_WANTED_LEVEL(0);
		}
	}
	else if (featurePlayerNeverWantedUpdated)
	{
		PLAYER::SET_MAX_WANTED_LEVEL(5);
	}

	// police ignore player
	if (featurePlayerIgnoredByPolice)
	{
		if (bPlayerExists)
		{
			PLAYER::SET_POLICE_IGNORE_PLAYER(player, true);
		}
	}
	else if (featurePlayerIgnoredByPoliceUpdated)
	{
		if (bPlayerExists)
		{
			PLAYER::SET_POLICE_IGNORE_PLAYER(player, false);
		}
		featurePlayerIgnoredByPoliceUpdated = false;
	}

	// everyone ignores player
	if (featurePlayerIgnoredByAll)
	{
		update_nearby_peds(playerPed, 50);

		if (bPlayerExists)
		{
			PLAYER::SET_POLICE_IGNORE_PLAYER(player, true);
			PLAYER::SET_EVERYONE_IGNORE_PLAYER(player, true);
			PLAYER::SET_PLAYER_CAN_BE_HASSLED_BY_GANGS(player, false);
			PLAYER::SET_IGNORE_LOW_PRIORITY_SHOCKING_EVENTS(player, true);
			if (game_frame_num % 5 == 0)
			{
				set_all_nearby_peds_to_calm();
			}
		}
	}
	else if (featurePlayerIgnoredByAllUpdated)
	{
		if (bPlayerExists)
		{
			PLAYER::SET_POLICE_IGNORE_PLAYER(player, featurePlayerIgnoredByPolice);
			PLAYER::SET_EVERYONE_IGNORE_PLAYER(player, false);
			PLAYER::SET_PLAYER_CAN_BE_HASSLED_BY_GANGS(player, true);
			PLAYER::SET_IGNORE_LOW_PRIORITY_SHOCKING_EVENTS(player, false);
		}
		featurePlayerIgnoredByAllUpdated = false;
	}

	// player special ability
	if (featurePlayerUnlimitedAbility)
	{
		if (bPlayerExists)
			PLAYER::_RECHARGE_SPECIAL_ABILITY(player, 1);
	}

	// player no noise
	if (featurePlayerNoNoiseUpdated)
	{
		if (bPlayerExists && !featurePlayerNoNoise)
			PLAYER::SET_PLAYER_NOISE_MULTIPLIER(player, 1.0);
		featurePlayerNoNoiseUpdated = false;
	}
	if (featurePlayerNoNoise)
		PLAYER::SET_PLAYER_NOISE_MULTIPLIER(player, 0.0);

	// player fast swim
	if (featurePlayerFastSwimUpdated)
	{
		if (bPlayerExists && !featurePlayerFastSwim)
			PLAYER::_SET_SWIM_SPEED_MULTIPLIER(player, 1.0);
		featurePlayerFastSwimUpdated = false;
	}
	if (featurePlayerFastSwim)
		PLAYER::_SET_SWIM_SPEED_MULTIPLIER(player, 1.49);

	// player fast run
	if (featurePlayerFastRunUpdated)
	{
		if (bPlayerExists && !featurePlayerFastRun)
			PLAYER::_SET_MOVE_SPEED_MULTIPLIER(player, 1.0);
		featurePlayerFastRunUpdated = false;
	}
	if (featurePlayerFastRun)
		PLAYER::_SET_MOVE_SPEED_MULTIPLIER(player, 1.49);

	// player super jump
	if (featurePlayerSuperJump)
	{
		if (bPlayerExists)
			GAMEPLAY::SET_SUPER_JUMP_THIS_FRAME(player);
	}

	//Player Invisible
	if (featurePlayerInvisibleUpdated)
	{
		featurePlayerInvisibleUpdated = false;
		if (bPlayerExists && featurePlayerInvisible)
			ENTITY::SET_ENTITY_VISIBLE(playerPed, false);
		else if (bPlayerExists){ ENTITY::SET_ENTITY_VISIBLE(playerPed, true); }
	}

	if (featurePlayerDrunkUpdated)
	{
		featurePlayerDrunkUpdated = false;
		if (featurePlayerDrunk)
		{
			STREAMING::REQUEST_ANIM_SET((char*)CLIPSET_DRUNK);
			while (!STREAMING::HAS_ANIM_SET_LOADED((char*)CLIPSET_DRUNK))
			{
				make_periodic_feature_call();
				WAIT(0);
			}
			PED::SET_PED_MOVEMENT_CLIPSET(playerPed, (char*)CLIPSET_DRUNK, 1.0f);
			CAM::SHAKE_GAMEPLAY_CAM("DRUNK_SHAKE", 1.0f);
		}
		else
		{
			PED::RESET_PED_MOVEMENT_CLIPSET(playerPed, 1.0f);
			CAM::STOP_GAMEPLAY_CAM_SHAKING(true);
		}
		AUDIO::SET_PED_IS_DRUNK(playerPed, featurePlayerDrunk);
	}

	
	update_weapon_features(bPlayerExists, player);

	update_vehicle_features(bPlayerExists, playerPed);

	update_misc_features(bPlayerExists, playerPed);

	update_time_features(player);

	//Disable airbrake on death
	if (ENTITY::IS_ENTITY_DEAD(playerPed))
	{
		exit_airbrake_menu_if_showing();
	}

	//----Hotkeys----
	
	//Move through door (use '-key)
	//Pushes player through solid door objects.
	if (bPlayerExists)
	{
		bool throughDoorPressed = IsKeyJustUp(KeyConfig::KEY_HOT_AIRBRAKE_THROUGH_DOOR) || IsControllerButtonJustUp(KeyConfig::KEY_HOT_AIRBRAKE_THROUGH_DOOR);
		//bool disablePolicePressed = IsKeyJustUp(VK_OEM_6);
		if (throughDoorPressed)
		{
			moveThroughDoor();
		}
	}
}
示例#8
0
bool trainer_switch_pressed()
{
	return IsKeyJustUp(VK_F5);
}
void airbrake(bool inVehicle)
{
	// common variables
	Ped playerPed = PLAYER::PLAYER_PED_ID();
	BOOL bPlayerExists = ENTITY::DOES_ENTITY_EXIST(playerPed);

	Vector3 curLocation = ENTITY::GET_ENTITY_COORDS(playerPed, 0);
	Vector3 curRotation = ENTITY::GET_ENTITY_ROTATION(playerPed, 0);
	float curHeading = ENTITY::GET_ENTITY_HEADING(playerPed);
	//float tmpHeading = curHeading += ;

	float rotationSpeed = 2.5;
	float forwardPush;

	switch (travelSpeed)
	{
	case 0:
		forwardPush = 0.2f;
		break;
	case 1:
		forwardPush = 1.8f;
		break;
	case 2:
		forwardPush = 3.6f;
		break;
	}

	float xVect = forwardPush * sin(degToRad(curHeading)) * -1.0f;
	float yVect = forwardPush * cos(degToRad(curHeading));

	KeyInputConfig* keyConfig = get_config()->get_key_config();

	bool moveUpKey =	get_key_pressed(keyConfig->key_airbrake_up);
	bool moveDownKey = get_key_pressed(keyConfig->key_airbrake_down);
	bool moveForwardKey = get_key_pressed(keyConfig->key_airbrake_forward);
	bool moveBackKey = get_key_pressed(keyConfig->key_airbrake_back);
	bool rotateLeftKey = get_key_pressed(keyConfig->key_airbrake_rotate_left);
	bool rotateRightKey = get_key_pressed(keyConfig->key_airbrake_rotate_right);

	//Airbrake controls vehicle if occupied
	if (PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0))
	{
		playerPed = PED::GET_VEHICLE_PED_IS_USING(playerPed);
	}

	BOOL xBoolParam = 1;
	BOOL yBoolParam = 1;
	BOOL zBoolParam = 1;

	ENTITY::SET_ENTITY_VELOCITY(playerPed, 0, 0, 0);
	ENTITY::SET_ENTITY_ROTATION(playerPed, 0, 0, 0, 0, false);
	ENTITY::SET_ENTITY_COORDS_NO_OFFSET(playerPed, curLocation.x, curLocation.y, curLocation.z, xBoolParam, yBoolParam, zBoolParam);
	ENTITY::SET_ENTITY_HEADING(playerPed, curHeading);

	if (!inVehicle)
	{
		AI::TASK_PLAY_ANIM(PLAYER::PLAYER_PED_ID(), AIRBRAKE_ANIM_A, AIRBRAKE_ANIM_B, 8.0f, 0.0f, -1, 9, 0, 0, 0, 0);
	}

	if (IsKeyJustUp(keyConfig->key_airbrake_speed))
	{
		travelSpeed++;
		if (travelSpeed > 2)
		{
			travelSpeed = 0;
		}
	}

	create_airbrake_help_text();
	update_airbrake_text();

	if (moveUpKey){ ENTITY::SET_ENTITY_COORDS_NO_OFFSET(playerPed, curLocation.x, curLocation.y, curLocation.z + forwardPush / 2, xBoolParam, yBoolParam, zBoolParam); }
	if (moveDownKey){ ENTITY::SET_ENTITY_COORDS_NO_OFFSET(playerPed, curLocation.x, curLocation.y, curLocation.z - forwardPush / 2, xBoolParam, yBoolParam, zBoolParam); }
	if (rotateLeftKey)
	{
		ENTITY::SET_ENTITY_HEADING(playerPed, curHeading + rotationSpeed);
	}
	else if (rotateRightKey)
	{
		ENTITY::SET_ENTITY_HEADING(playerPed, curHeading - rotationSpeed);
	}

	/*
	std::stringstream ss2;
	ss2 << "Angle: " << curHeading << "\nXV: " << xVect << "\nYV: " << yVect << "\nCRZ: " << curRotation.z;
	set_status_text(ss2.str());
	*/

	if (moveForwardKey)
	{
		if (moveUpKey){ ENTITY::SET_ENTITY_COORDS_NO_OFFSET(playerPed, curLocation.x + xVect, curLocation.y + yVect, curLocation.z + forwardPush / 2, xBoolParam, yBoolParam, zBoolParam); }
		else if (moveDownKey){ ENTITY::SET_ENTITY_COORDS_NO_OFFSET(playerPed, curLocation.x + xVect, curLocation.y + yVect, curLocation.z - forwardPush / 2, xBoolParam, yBoolParam, zBoolParam); }
		else{ ENTITY::SET_ENTITY_COORDS_NO_OFFSET(playerPed, curLocation.x + xVect, curLocation.y + yVect, curLocation.z, xBoolParam, yBoolParam, zBoolParam); }
	}
	else if (moveBackKey)
	{
		if (moveUpKey){ ENTITY::SET_ENTITY_COORDS_NO_OFFSET(playerPed, curLocation.x - xVect, curLocation.y - yVect, curLocation.z + forwardPush / 2, xBoolParam, yBoolParam, zBoolParam); }
		else if (moveDownKey){ ENTITY::SET_ENTITY_COORDS_NO_OFFSET(playerPed, curLocation.x - xVect, curLocation.y - yVect, curLocation.z - forwardPush / 2, xBoolParam, yBoolParam, zBoolParam); }
		else{ ENTITY::SET_ENTITY_COORDS_NO_OFFSET(playerPed, curLocation.x - xVect, curLocation.y - yVect, curLocation.z, xBoolParam, yBoolParam, zBoolParam); }
	}
}