[Function] Code snippets

Posts 1–7 of 7 · Page 1 of 1
[Function] Code snippets
BOX ESP

Code:
// player esp
	if (featurePlayerEsp)
	{
		Player playerPed = PLAYER::PLAYER_PED_ID();
		for (int i = 0; i < 32; i++)
		{
			Player playerHandle = PLAYER::GET_PLAYER_PED(i);
			Vector3 handleCoords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerHandle, 0, 0, 0);
			char* Name = PLAYER::GET_PLAYER_NAME(PLAYER::INT_TO_PLAYERINDEX(i));

			if (ENTITY::DOES_ENTITY_EXIST(playerHandle))
			{
				UI::SET_TEXT_OUTLINE();
				GRAPHICS::DRAW_LINE(handleCoords.x + 0.5, handleCoords.y + 0.5, handleCoords.z + 0.75, handleCoords.x + 0.5, handleCoords.y - 0.5, handleCoords.z + 0.75, 0, 255, 0, 255); // top Box
				GRAPHICS::DRAW_LINE(handleCoords.x + 0.5, handleCoords.y - 0.5, handleCoords.z + 0.75, handleCoords.x - 0.5, handleCoords.y - 0.5, handleCoords.z + 0.75, 0, 255, 0, 255);
				GRAPHICS::DRAW_LINE(handleCoords.x - 0.5, handleCoords.y - 0.5, handleCoords.z + 0.75, handleCoords.x - 0.5, handleCoords.y + 0.5, handleCoords.z + 0.75, 0, 255, 0, 255);
				GRAPHICS::DRAW_LINE(handleCoords.x - 0.5, handleCoords.y + 0.5, handleCoords.z + 0.75, handleCoords.x + 0.5, handleCoords.y + 0.5, handleCoords.z + 0.75, 0, 255, 0, 255);
				GRAPHICS::DRAW_LINE(handleCoords.x + 0.5, handleCoords.y + 0.5, handleCoords.z - 0.75, handleCoords.x + 0.5, handleCoords.y - 0.5, handleCoords.z - 0.75, 0, 255, 0, 255); // bottom Box
				GRAPHICS::DRAW_LINE(handleCoords.x + 0.5, handleCoords.y - 0.5, handleCoords.z - 0.75, handleCoords.x - 0.5, handleCoords.y - 0.5, handleCoords.z - 0.75, 0, 255, 0, 255);
				GRAPHICS::DRAW_LINE(handleCoords.x - 0.5, handleCoords.y - 0.5, handleCoords.z - 0.75, handleCoords.x - 0.5, handleCoords.y + 0.5, handleCoords.z - 0.75, 0, 255, 0, 255);
				GRAPHICS::DRAW_LINE(handleCoords.x - 0.5, handleCoords.y + 0.5, handleCoords.z - 0.75, handleCoords.x + 0.5, handleCoords.y + 0.5, handleCoords.z - 0.75, 0, 255, 0, 255);
				GRAPHICS::DRAW_LINE(handleCoords.x + 0.5, handleCoords.y + 0.5, handleCoords.z - 0.75, handleCoords.x + 0.5, handleCoords.y + 0.5, handleCoords.z + 0.75, 0, 255, 0, 255); // bottom Box
				GRAPHICS::DRAW_LINE(handleCoords.x + 0.5, handleCoords.y - 0.5, handleCoords.z - 0.75, handleCoords.x + 0.5, handleCoords.y - 0.5, handleCoords.z + 0.75, 0, 255, 0, 255);
				GRAPHICS::DRAW_LINE(handleCoords.x - 0.5, handleCoords.y - 0.5, handleCoords.z - 0.75, handleCoords.x - 0.5, handleCoords.y - 0.5, handleCoords.z + 0.75, 0, 255, 0, 255);
				GRAPHICS::DRAW_LINE(handleCoords.x - 0.5, handleCoords.y + 0.5, handleCoords.z - 0.75, handleCoords.x - 0.5, handleCoords.y + 0.5, handleCoords.z + 0.75, 0, 255, 0, 255);
			}
		}
	}
	if (featurePlayerEsp1)
	{
		for (int i = 0; i < 32; i++)
		{
			Player playerHandle = PLAYER::GET_PLAYER_PED(i);
			Vector3 handleCoords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerHandle, 0, 0, 0);
			Vector3 playerCoords = ENTITY::GET_ENTITY_COORDS(playerPed, 0);
			char* Name = PLAYER::GET_PLAYER_NAME(PLAYER::INT_TO_PLAYERINDEX(i));

			if (ENTITY::DOES_ENTITY_EXIST(playerHandle))
			{
				float x1;
				float y1;

				BOOL screenCoords = GRAPHICS::_WORLD3D_TO_SCREEN2D(handleCoords.x, handleCoords.y, handleCoords.z, &x1, &y1);

				std::string playerName = PLAYER::GET_PLAYER_NAME(PLAYER::INT_TO_PLAYERINDEX(i));

				std::string nameSetupRed = "~HUD_COLOUR_RED~" + playerName;
				std::string nameSetupGreen = playerName;

				char* playerRed = new char[nameSetupRed.length() + 1];
				char* playerGreen = new char[nameSetupGreen.length() + 1];

				std::strcpy(playerRed, nameSetupRed.c_str());
				std::strcpy(playerGreen, nameSetupGreen.c_str());

				UI::SET_TEXT_FONT(0);
				UI::SET_TEXT_SCALE(0.0, 0.35);
				UI::SET_TEXT_COLOUR(0, 255, 0, 255);
				UI::SET_TEXT_CENTRE(TRUE);
				UI::SET_TEXT_OUTLINE();
				UI::SET_TEXT_DROPSHADOW(0, 0, 0, 0, 0);
				UI::SET_TEXT_EDGE(0, 0, 0, 0, 0);
				UI::_SET_TEXT_ENTRY("STRING");
				if (ENTITY::HAS_ENTITY_CLEAR_LOS_TO_ENTITY(playerPed, playerHandle, 17))
				{
					UI::_ADD_TEXT_COMPONENT_STRING(playerGreen);
				}
				else
				{
					UI::_ADD_TEXT_COMPONENT_STRING(playerRed);
				}
				UI::_DRAW_TEXT(x1, y1);
				UI::SET_TEXT_OUTLINE();
				UI::SET_TEXT_DROPSHADOW(0, 0, 0, 0, 0);
			}
		}
	}
NAME ESP
Code:
//Name Esp

	if (featureNameESP)
	{
		Player playerPed = PLAYER::PLAYER_PED_ID();
		for (int i = 0; i < 32; i++)
		{
			Player playerHandle = PLAYER::GET_PLAYER_PED(i);
			Vector3 handleCoords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerHandle, 0, 0, 0);
			Vector3 playerCoords = ENTITY::GET_ENTITY_COORDS(playerPed, 0);
			char* Name = PLAYER::GET_PLAYER_NAME(PLAYER::INT_TO_PLAYERINDEX(i));

			if (ENTITY::DOES_ENTITY_EXIST(playerHandle))
			{
				float x1;
				float y1;

				BOOL screenCoords = GRAPHICS::_WORLD3D_TO_SCREEN2D(handleCoords.x, handleCoords.y, handleCoords.z, &x1, &y1);

				std::string playerName = PLAYER::GET_PLAYER_NAME(PLAYER::INT_TO_PLAYERINDEX(i));

				std::string nameSetupRed = "~HUD_COLOUR_RED~" + playerName;
				std::string nameSetupGreen = "~HUD_COLOUR_GREEN~" + playerName;

				char* playerInfoRed = new char[nameSetupRed.length() + 1];
				char* playerInfoGreen = new char[nameSetupGreen.length() + 1];

				std::strcpy(playerInfoRed, nameSetupRed.c_str());
				std::strcpy(playerInfoGreen, nameSetupGreen.c_str());

				UI::SET_TEXT_FONT(7);
				UI::SET_TEXT_SCALE(0.0, 0.40);
				UI::SET_TEXT_COLOUR(0, 255, 0, 255);
				UI::SET_TEXT_CENTRE(0);
				UI::SET_TEXT_DROPSHADOW(0, 0, 0, 0, 0);
				UI::SET_TEXT_EDGE(0, 0, 0, 0, 0);
				UI::_SET_TEXT_ENTRY("STRING");
				if (ENTITY::HAS_ENTITY_CLEAR_LOS_TO_ENTITY(playerPed, playerHandle, 17))
				{
					UI::_ADD_TEXT_COMPONENT_STRING(playerInfoGreen);
				}
				else
				{
					UI::_ADD_TEXT_COMPONENT_STRING(playerInfoRed);
				}
				UI::_DRAW_TEXT(x1, y1);
				UI::SET_TEXT_OUTLINE();
				UI::SET_TEXT_DROPSHADOW(5, 0, 78, 255, 255);
			}
		}
	}
AIM BOT
Code:
if (featureWeaponAimbot)
	{
		if (bPlayerExists)
		{
			for (int i = 0; i < 32; i++)
			{
				Player playerHandle = PLAYER::GET_PLAYER_PED(i);
				char* Name = PLAYER::GET_PLAYER_NAME(PLAYER::INT_TO_PLAYERINDEX(i));
				if (ENTITY::DOES_ENTITY_EXIST(playerHandle))
				{
					if (playerHandle == playerPed) continue;
					{
						if (ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID()) 
							&& ENTITY::HAS_ENTITY_CLEAR_LOS_TO_ENTITY(playerPed, playerHandle, 17) 
							&& !PED::IS_PED_RUNNING_RAGDOLL_TASK(playerHandle) 
							&& ENTITY::GET_ENTITY_ALPHA(playerHandle) == 255)
						{
							if (GetAsyncKeyState(0x01))
							{
								process_auto_fire(playerHandle);
							}
						}
					}
				}
			}
		}
	}
TRIGGER BOT
Code:
//Triggerbot
	if (featureMassTriggerbot)
	{
		Entity AimedAtEntity;
		if (PLAYER::_GET_AIMED_ENTITY(PLAYER::PLAYER_ID(), &AimedAtEntity))
		{
			if (ENTITY::IS_ENTITY_A_PED(AimedAtEntity) && !ENTITY::IS_ENTITY_DEAD(AimedAtEntity) && PED::IS_PED_A_PLAYER(AimedAtEntity) && ENTITY::GET_ENTITY_ALPHA(AimedAtEntity) == 255)
			{
				shootAtPed(AimedAtEntity);
			}
		}
	}
ATTACH BEACH FIRE TO PLAYERS
Code:
void BeachFire()
{ // prop_beach_fire
	for (int i = 0; i < 32; i++)
	{
		Player playerHandle = PLAYER::GET_PLAYER_PED(i);
		Hash beach_fire = GAMEPLAY::GET_HASH_KEY("prop_beach_fire");
		STREAMING::REQUEST_MODEL(beach_fire);
		while (!STREAMING::HAS_MODEL_LOADED(beach_fire)) WAIT(0);
		notifyAboveMap("~HUD_COLOUR_RED~Attached Beach Fires to All Players");
		if (ENTITY::DOES_ENTITY_EXIST(playerHandle))
		{
			
							if (PLAYER::GET_PLAYER_PED(i) == PLAYER::PLAYER_PED_ID()) continue;
							{
								Object object = OBJECT::CREATE_OBJECT(beach_fire, 0, 0, 0, true, true, false);
								ENTITY::ATTACH_ENTITY_TO_ENTITY(object, playerHandle, PED::GET_PED_BONE_INDEX(playerHandle, SKEL_Spine_Root), 0.0, 0.0, 0.0, 0.0, 90.0, 0, false, false, false, false, 2, true);
							}
							STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(beach_fire);
						}
					}
				}
MASS SUICIDE
Code:
void massSuicide()
{
	if (ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID()))
	{
		notifyAboveMap("~HUD_COLOUR_RED~Forced Everyone to Suicide");
		for (int i = 0; i < 32; i++)
		{
			if (ENTITY::DOES_ENTITY_EXIST(PLAYER::GET_PLAYER_PED(i)))
			{
				if (PLAYER::GET_PLAYER_PED(i) == PLAYER::PLAYER_PED_ID()) continue;
				{
					
									if (PED::IS_PED_ON_FOOT(PLAYER::GET_PLAYER_PED(i)))
									{
										Player playerHandle = PLAYER::GET_PLAYER_PED(i);
										Vector3 PlyPos1 = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerHandle, 0.0, 0.0, 0.0);
										FIRE::ADD_OWNED_EXPLOSION(playerHandle, PlyPos1.x, PlyPos1.y, PlyPos1.z, 37, 5.0, false, true, 0.0);
									}
									else
									{
										Player playerHandle = PLAYER::GET_PLAYER_PED(i);
										Freeze(playerHandle);
										WAIT(0);
										Vector3 PlyPos1 = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerHandle, 0.0, 0.0, 0.0);
										FIRE::ADD_OWNED_EXPLOSION(playerHandle, PlyPos1.x, PlyPos1.y, PlyPos1.z, 37, 5.0, false, true, 0.0);
									}
								}
							}
						}
					}
				}
FORCE GUN
Code:
// weapon force gun
	if (featureWeaponForceGun)
	{
		Entity EntityTarget;
		DWORD equippedWeapon;
		WEAPON::GET_CURRENT_PED_WEAPON(PLAYER::PLAYER_PED_ID(), &equippedWeapon, 1);
		Player player = PLAYER::PLAYER_ID();
		Ped playerPed = PLAYER::PLAYER_PED_ID();

		Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(0);
		Vector3 dir = RotToDirection(&rot);
		Vector3 camPosition = CAM::GET_GAMEPLAY_CAM_COORD();
		Vector3 playerPosition = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);
		float spawnDistance = GetDistance(&camPosition, &playerPosition);
		spawnDistance += 5;
		Vector3 spawnPosition = Add(&camPosition, &Multiply(&dir, spawnDistance));

		if (PLAYER::_GET_AIMED_ENTITY(PLAYER::PLAYER_ID(), &EntityTarget))
		{

			if (ENTITY::IS_ENTITY_A_PED(EntityTarget) && PED::IS_PED_IN_ANY_VEHICLE(EntityTarget, 1))
			{
				EntityTarget = PED::GET_VEHICLE_PED_IS_IN(EntityTarget, 0);
			}

			RequestControl(EntityTarget);

			if (PED::IS_PED_SHOOTING(playerPed))
			{
				ENTITY::APPLY_FORCE_TO_ENTITY(EntityTarget, 1, dir.x * 10000.0f, dir.y * 10000.0f, dir.z * 10000.0f, 0.0f, 0.0f, 0.0f, 0, 0, 1, 1, 0, 1);
			}
		}
	}
VEHICLE GUN
Code:
// weapon vehicle gun
	if (featureWeaponVehGun)
	{
		FLOAT heading = ENTITY::GET_ENTITY_HEADING(playerPed);
		DWORD model = GAMEPLAY::GET_HASH_KEY((char *)vehModels[rand() % 283]);
		Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(0);
		Vector3 dir = RotToDirection(&rot);
		Vector3 camPosition = CAM::GET_GAMEPLAY_CAM_COORD();
		Vector3 playerPosition = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);
		float spawnDistance = GetDistance(&camPosition, &playerPosition);
		spawnDistance += 5;
		Vector3 spawnPosition = Add(&camPosition, &Multiply(&dir, spawnDistance));

		if (bPlayerExists)
		{
			if (PED::IS_PED_SHOOTING(playerPed))
			{
				Vector3 playerOffset = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0, 5, 0);
				if (PED::IS_PED_ON_FOOT(playerPed))
				{
					STREAMING::REQUEST_MODEL(model);
					while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0);
					{
						Vehicle veh = VEHICLE::CREATE_VEHICLE(model, spawnPosition.x, spawnPosition.y, spawnPosition.z, heading, 1, 1);
						VEHICLE::SET_VEHICLE_FORWARD_SPEED(veh, 120.0);
						STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model);
						ENTITY::SET_VEHICLE_AS_NO_LONGER_NEEDED(&veh);
					}

				}
			}
		}
	}
ANIMAL GUN
Code:
// weapon animal gun
	if (featureWeaponAnimalGun)
	{
		if (PED::IS_PED_SHOOTING(playerPed))
		{
			Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(0);
			Vector3 dir = RotToDirection(&rot);
			Vector3 camPosition = CAM::GET_GAMEPLAY_CAM_COORD();
			Vector3 playerPosition = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);
			float spawnDistance = GetDistance(&camPosition, &playerPosition);
			spawnDistance += 2;
			Vector3 spawnPosition = Add(&camPosition, &Multiply(&dir, spawnDistance));
			Hash model = GAMEPLAY::GET_HASH_KEY((char *)animalModels[rand() % 26]);
			if (PED::IS_PED_SHOOTING(playerPed))
			{
				Vector3 playerOffset = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0, 5, 0);
				if (PED::IS_PED_ON_FOOT(playerPed))
				{
					STREAMING::REQUEST_MODEL(model);
					while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0);
					{
						Ped spawnedPed = PED::CREATE_PED(26, model, spawnPosition.x, spawnPosition.y, spawnPosition.z, ENTITY::GET_ENTITY_HEADING(playerPed), 1, 1);
						ENTITY::SET_ENTITY_HEALTH(spawnedPed, 0);
						ENTITY::APPLY_FORCE_TO_ENTITY(spawnedPed, 1, dir.x * 10000.0f, dir.y * 10000.0f, dir.z * 10000.0f, 0.0f, 0.0f, 0.0f, 0, 0, 1, 1, 0, 1);
						STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model);
						ENTITY::SET_PED_AS_NO_LONGER_NEEDED(&spawnedPed);
					}
				}
			}
		}
	}
GIVE PLAYER 3 STARS
Code:
void vOnline3Stars(Entity eEntity)
{
	if (ENTITY::DOES_ENTITY_EXIST(eEntity))
	{
		const int iPeds = 40;
		Ped pPed[iPeds];
		Vector3 Coordinates = ENTITY::GET_ENTITY_COORDS(eEntity, 0);

		for (int i = 0; i < iPeds; i++)
		{
			pPed[i] = PED::CLONE_PED(eEntity, ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID()), 1, 1);
			ENTITY::SET_ENTITY_COORDS(pPed[i], Coordinates.x, Coordinates.y, Coordinates.z + 25, 0, 0, 0, 1);
			PED::SET_PED_AS_COP(pPed[i], true);
			WAIT(20);
			Vector3 pPedCoordinates = ENTITY::GET_ENTITY_COORDS(pPed[i], 0);
			FIRE::ADD_OWNED_EXPLOSION(eEntity, pPedCoordinates.x, pPedCoordinates.y, pPedCoordinates.z, 9, 5.0f, 0, 1, 0.0f);
			WAIT(20);
			PED::DELETE_PED(&pPed[i]);
		}
	}
}
FIREWORK GUN
Code:
void update_firework_gun()
{
	Player player = PLAYER::PLAYER_ID();
	Ped playerPed = PLAYER::PLAYER_PED_ID();

	Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(0);
	Vector3 dir = RotToDirection(&rot);
	Vector3 camPosition = CAM::GET_GAMEPLAY_CAM_COORD();
	Vector3 playerPosition = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);
	float spawnDistance = GetDistance(&camPosition, &playerPosition);
	spawnDistance += 0.25;
	Vector3 spawnPosition = Add(&camPosition, &Multiply(&dir, spawnDistance));

	float endDistance = GetDistance(&camPosition, &playerPosition);
	endDistance += 1000;
	Vector3 endPosition = Add(&camPosition, &Multiply(&dir, endDistance));

	if (!ENTITY::DOES_ENTITY_EXIST(playerPed) || !featureWeaponFireWork) return;

	if (PED::IS_PED_ON_FOOT(playerPed) && PED::IS_PED_SHOOTING(playerPed))
	{
		Hash weaponAssetRocket = GAMEPLAY::GET_HASH_KEY("WEAPON_FIREWORK");
		if (!WEAPON::HAS_WEAPON_ASSET_LOADED(weaponAssetRocket))
		{
			WEAPON::REQUEST_WEAPON_ASSET(weaponAssetRocket, 31, 0);
			while (!WEAPON::HAS_WEAPON_ASSET_LOADED(weaponAssetRocket))
				WAIT(0);
		}
		GAMEPLAY::SHOOT_SINGLE_BULLET_BETWEEN_COORDS(spawnPosition.x, spawnPosition.y, spawnPosition.z, endPosition.x, endPosition.y, endPosition.z, 250, 1, weaponAssetRocket, playerPed, 1, 0, -1.0);
	}
}
RPG GUN
Code:
void update_rpg_gun()
{
	Player player = PLAYER::PLAYER_ID();
	Ped playerPed = PLAYER::PLAYER_PED_ID();

	Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(0);
	Vector3 dir = RotToDirection(&rot);
	Vector3 camPosition = CAM::GET_GAMEPLAY_CAM_COORD();
	Vector3 playerPosition = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);
	float spawnDistance = GetDistance(&camPosition, &playerPosition);
	spawnDistance += 0.25;
	Vector3 spawnPosition = Add(&camPosition, &Multiply(&dir, spawnDistance));

	float endDistance = GetDistance(&camPosition, &playerPosition);
	endDistance += 100;
	Vector3 endPosition = Add(&camPosition, &Multiply(&dir, endDistance));

	if (!ENTITY::DOES_ENTITY_EXIST(playerPed) || !featureWeaponRocket) return;

	if (PED::IS_PED_ON_FOOT(playerPed) && PED::IS_PED_SHOOTING(playerPed))
	{
		Hash weaponAssetRocket = GAMEPLAY::GET_HASH_KEY("WEAPON_VEHICLE_ROCKET");
		if (!WEAPON::HAS_WEAPON_ASSET_LOADED(weaponAssetRocket))
		{
			WEAPON::REQUEST_WEAPON_ASSET(weaponAssetRocket, 31, 0);
			while (!WEAPON::HAS_WEAPON_ASSET_LOADED(weaponAssetRocket))
				WAIT(0);
		}
		GAMEPLAY::SHOOT_SINGLE_BULLET_BETWEEN_COORDS(spawnPosition.x, spawnPosition.y, spawnPosition.z, endPosition.x, endPosition.y, endPosition.z, 250, 1, weaponAssetRocket, playerPed, 1, 0, -1.0);
	}
}
VALKYRIE GUN
Code:
void update_valkyrie_gun()
{
	Player player = PLAYER::PLAYER_ID();
	Ped playerPed = PLAYER::PLAYER_PED_ID();

	Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(0);
	Vector3 dir = RotToDirection(&rot);
	Vector3 camPosition = CAM::GET_GAMEPLAY_CAM_COORD();
	Vector3 playerPosition = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);
	float spawnDistance = GetDistance(&camPosition, &playerPosition);
	spawnDistance += 0.25;
	Vector3 spawnPosition = Add(&camPosition, &Multiply(&dir, spawnDistance));

	float endDistance = GetDistance(&camPosition, &playerPosition);
	endDistance += 1000;
	Vector3 endPosition = Add(&camPosition, &Multiply(&dir, endDistance));

	if (!ENTITY::DOES_ENTITY_EXIST(playerPed) || !featureWeaponValkyrie) return;

	if (PED::IS_PED_ON_FOOT(playerPed) && PED::IS_PED_SHOOTING(playerPed))
	{
		Hash weaponAssetRocket = GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_NOSE_TURRET_VALKYRIE");
		if (!WEAPON::HAS_WEAPON_ASSET_LOADED(weaponAssetRocket))
		{
			WEAPON::REQUEST_WEAPON_ASSET(weaponAssetRocket, 31, 0);
			while (!WEAPON::HAS_WEAPON_ASSET_LOADED(weaponAssetRocket))
				WAIT(0);
		}
		GAMEPLAY::SHOOT_SINGLE_BULLET_BETWEEN_COORDS(spawnPosition.x, spawnPosition.y, spawnPosition.z, endPosition.x, endPosition.y, endPosition.z, 250, 1, weaponAssetRocket, playerPed, 1, 0, -1.0);
	}
}
TANK GUN
Code:
void update_tank_gun()
{
	Player player = PLAYER::PLAYER_ID();
	Ped playerPed = PLAYER::PLAYER_PED_ID();

	Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(0);
	Vector3 dir = RotToDirection(&rot);
	Vector3 camPosition = CAM::GET_GAMEPLAY_CAM_COORD();
	Vector3 playerPosition = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);
	float spawnDistance = GetDistance(&camPosition, &playerPosition);
	spawnDistance += 0.25;
	Vector3 spawnPosition = Add(&camPosition, &Multiply(&dir, spawnDistance));

	float endDistance = GetDistance(&camPosition, &playerPosition);
	endDistance += 1000;
	Vector3 endPosition = Add(&camPosition, &Multiply(&dir, endDistance));

	if (!ENTITY::DOES_ENTITY_EXIST(playerPed) || !featureWeaponTank) return;

	if (PED::IS_PED_ON_FOOT(playerPed) && PED::IS_PED_SHOOTING(playerPed))
	{
		Hash weaponAssetRocket = GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_TANK");
		if (!WEAPON::HAS_WEAPON_ASSET_LOADED(weaponAssetRocket))
		{
			WEAPON::REQUEST_WEAPON_ASSET(weaponAssetRocket, 31, 0);
			while (!WEAPON::HAS_WEAPON_ASSET_LOADED(weaponAssetRocket))
				WAIT(0);
		}
		GAMEPLAY::SHOOT_SINGLE_BULLET_BETWEEN_COORDS(spawnPosition.x, spawnPosition.y, spawnPosition.z, endPosition.x, endPosition.y, endPosition.z, 250, 1, weaponAssetRocket, playerPed, 1, 0, -1.0);
	}
}
SAFE GUN
Code:
void update_weapon_safe()
{
	Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(0);
	Vector3 dir = RotToDirection(&rot);
	Vector3 camPosition = CAM::GET_GAMEPLAY_CAM_COORD();
	Vector3 playerPosition = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);
	float spawnDistance = GetDistance(&camPosition, &playerPosition);
	spawnDistance += 2;
	Vector3 spawnPosition = Add(&camPosition, &Multiply(&dir, spawnDistance));

	Hash model = GAMEPLAY::GET_HASH_KEY("prop_ld_int_safe_01");

	if (featureWeaponSafeGun)
	{
		if (PED::IS_PED_SHOOTING(PLAYER::PLAYER_PED_ID()))
		{
			if (STREAMING::IS_MODEL_VALID(model))
			{
				if (!STREAMING::HAS_MODEL_LOADED(model))
				{
					STREAMING::REQUEST_MODEL(model);
					while (!STREAMING::HAS_MODEL_LOADED(model))
					{
						WAIT(0);
					}
				}
				if (STREAMING::HAS_MODEL_LOADED(model))
				{
					Object spawnedPed = OBJECT::CREATE_OBJECT(model, spawnPosition.x, spawnPosition.y, spawnPosition.z, true, true, false);
					{
						if (ENTITY::DOES_ENTITY_EXIST(spawnedPed))
						{
							ENTITY::APPLY_FORCE_TO_ENTITY(spawnedPed, 1, dir.x * 10000000.0f, dir.y * 10000000.0f, dir.z * 10000000.0f, 0.0f, 0.0f, 0.0f, 0, 0, 1, 1, 0, 1);
							ENTITY::SET_ENTITY_LOD_DIST(spawnedPed, 696969);
						}
						STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model);
					}
				}
			}
		}
	}
}
WHALE GUN
Code:
void update_weapon_whale() {
	Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(0);
	Vector3 dir = RotToDirection(&rot);
	Vector3 camPosition = CAM::GET_GAMEPLAY_CAM_COORD();
	Vector3 playerPosition = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);
	float spawnDistance = GetDistance(&camPosition, &playerPosition);
	spawnDistance += 5;
	Vector3 spawnPosition = Add(&camPosition, &Multiply(&dir, spawnDistance));

	Hash model = GAMEPLAY::GET_HASH_KEY("a_c_killerwhale");

	if (featureWeaponWhaleGun)
	{
		if (PED::IS_PED_SHOOTING(PLAYER::PLAYER_PED_ID()))
		{
			if (STREAMING::IS_MODEL_VALID(model))
			{
				if (!STREAMING::HAS_MODEL_LOADED(model))
				{
					STREAMING::REQUEST_MODEL(model);
					while (!STREAMING::HAS_MODEL_LOADED(model))
					{
						WAIT(0);
					}
				}

				if (STREAMING::HAS_MODEL_LOADED(model))
				{
					Ped spawnedPed = PED::CREATE_PED(26, model, spawnPosition.x, spawnPosition.y, spawnPosition.z, 1, 1, 1);

					if (ENTITY::DOES_ENTITY_EXIST(spawnedPed))
					{
						ENTITY::SET_ENTITY_RECORDS_COLLISIONS(spawnedPed, true);
						for (float f = 0.0f; f < 75.0f; f++)
						{
							if (ENTITY::HAS_ENTITY_COLLIDED_WITH_ANYTHING(spawnedPed)) break;

							ENTITY::APPLY_FORCE_TO_ENTITY(spawnedPed, 1, dir.x * 10.0f, dir.y * 10.0f, dir.z * 10.0f, 0.0f, 0.0f, 0.0f, 0, 0, 1, 1, 0, 1);

							WAIT(0);
						}

						Vector3 coords = ENTITY::GET_ENTITY_COORDS(spawnedPed, 1);
						PED::DELETE_PED(&spawnedPed);
						FIRE::ADD_OWNED_EXPLOSION(PLAYER::PLAYER_PED_ID(), coords.x, coords.y, coords.z, 9, 25.0f, 1, 0, 0.5f);
					}
				}
			}
		}
	}
}
Haha, this will help alot of peoples menu's that suck ass *rep
LOL false claiming public natives by alex and C++ is universal anyone can write this code dipstick

- - - Updated - - -
@akim14 @ZectixV1
This was not written by you.

Unless you invented C++ and you have a copyright on someone using this language.

Do you?
Common Variables
for Online and single player
Code:
	Player pPlayer = PLAYER::PLAYER_ID();
	Ped pPlayerPed = PLAYER::PLAYER_PED_ID();
	Ped pPlayerGroup = PED::GET_PED_GROUP_INDEX(pPlayerPed);
	Vehicle vPlayerVehicle = PED::GET_VEHICLE_PED_IS_USING(pPlayerPed);
	Vector3 vPlayerCoordinates = ENTITY::GET_ENTITY_COORDS(pPlayerPed, 0);
	Vector3 vPlayerWorldCoordinates = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(pPlayerPed, 0.0f, 0.0f, 0.0f);
	BOOL bPlayerCheck = ENTITY::DOES_ENTITY_EXIST(pPlayerPed);
	BOOL bVehicleCheck = PED::IS_PED_IN_ANY_VEHICLE(pPlayerPed, 0);

	Player pPlayerOnlinePed = PLAYER::GET_PLAYER_PED(iPlayerIndex);
	Ped pPlayerOnlineGroup = PED::GET_PED_GROUP_INDEX(pPlayerOnlinePed);
	Vehicle vPlayerOnlineVehicle = PED::GET_VEHICLE_PED_IS_USING(pPlayerOnlinePed);
	Vector3 vPlayerOnlineCoordinates = ENTITY::GET_ENTITY_COORDS(pPlayerOnlinePed, 0);
	Vector3 vPlayerOnlineWorldCoordinates = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(pPlayerOnlinePed, 0.0f, 0.0f, 0.0f);
	BOOL bPlayerOnlineCheck = ENTITY::DOES_ENTITY_EXIST(pPlayerOnlinePed);
	BOOL bVehicleOnlineCheck = PED::IS_PED_IN_ANY_VEHICLE(pPlayerOnlinePed, 0);
	DWORD waitTime = 150;
This is amazing bro I just spent the whole day trying to understand how to draw this shit fucking lines and now this. Thanks, I'll use this in my menu!
Quote Originally Posted by unknown_soldier View Post
This is amazing bro I just spent the whole day trying to understand how to draw this shit fucking lines and now this. Thanks, I'll use this in my menu!
Awesome. This has now been un-deleted. Will add more.
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us