hi guys i need pls help with gravity gun i send here a video (what i mean) and here my current code:
Code:
bool Features::GravityGun = false;
bool grav_target_locked = false;
void Features::gravitygun(bool toggle)
{
	Entity EntityTarget;
	DWORD equippedWeapon;
	WEAPON::GET_CURRENT_PED_WEAPON(PLAYER::PLAYER_PED_  ID(), &equippedWeapon, 1);

	Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(0);
	Vector3 dir = rot_to_direction(&rot);
	Vector3 camPosition = CAM::GET_GAMEPLAY_CAM_COORD();

	Vector3 playerPosition = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);
	float spawnDistance = get_distance(&camPosition, &playerPosition);
	spawnDistance += 10;
	Vector3 spawnPosition = add(&camPosition, &multiply(&dir, spawnDistance));

	Player player = PLAYER::PLAYER_ID();
	Ped ped = PLAYER::PLAYER_PED_ID();

	Player tempPed = PLAYER::PLAYER_ID();
	if (equippedWeapon = 1)
	{
		if (grav_target_locked)
		{
			if (PLAYER::GET_ENTITY_PLAYER_IS_FREE_AIMING_AT(PLAYE  R::PLAYER_ID(), &EntityTarget) || (IsKeyPressed(VK_RBUTTON) || (PLAYER::IS_PLAYER_TARGETTING_ANYTHING)))
			{
				Vector3 EntityTargetPos = ENTITY::GET_ENTITY_COORDS(EntityTarget, 0);
				PLAYER::DISABLE_PLAYER_FIRING(tempPed, true);
				{
					RequestControlOfEnt(EntityTarget);
				}

				if (ENTITY::DOES_ENTITY_EXIST(EntityTarget))
				{
					ENTITY::SET_ENTITY_COORDS_NO_OFFSET(EntityTarget, spawnPosition.x, spawnPosition.y, spawnPosition.z, 0, 0, 0);
				}

				ENTITY::APPLY_FORCE_TO_ENTITY(EntityTarget, 0.5, rot.x, rot.y, rot.z, EntityTargetPos.x, EntityTargetPos.y, EntityTargetPos.z, 0, 0, 0, 0, 0, 1);

				if (GetAsyncKeyState(VK_LBUTTON))
				{
					ENTITY::SET_ENTITY_HEADING(EntityTarget, ENTITY::GET_ENTITY_HEADING(tempPed));
					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);
					ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&EntityTarget);
					EntityTarget = NULL;
					grav_target_locked = false;
					PLAYER::DISABLE_PLAYER_FIRING(tempPed, false);
				}
			}
		}
		if (!PLAYER::GET_ENTITY_PLAYER_IS_FREE_AIMING_AT(PLAY  ER::PLAYER_ID(), &EntityTarget))
		{
			grav_target_locked = true;
			PLAYER::DISABLE_PLAYER_FIRING(tempPed, false);
		}
	}
}