Пример #1
0
		private static async Task MuoviWheel()
		{
			if (!Wheel.Ferma && Wheel.Entity != null)
			{
				float fVar2 = 0;
				if (iLocal_355 != 0)
					fVar2 = GetTimeDifference(GetNetworkTimeAccurate(), iLocal_355) / 800f;
				iLocal_355 = GetNetworkTimeAccurate();
				float speed = Wheel.Speed * fVar2;
				Wheel.Rotation += speed;

				if (Wheel.Rotation >= 360f)
					Wheel.Rotation -= 360f;

				if (IsAudioSceneActive("FAIRGROUND_RIDES_FERRIS_WHALE"))
				{
					Vector3 vVar1 = Game.PlayerPed.Position;
					SetAudioSceneVariable("FAIRGROUND_RIDES_FERRIS_WHALE", "HEIGHT", vVar1.Z - 13f);
				}

				foreach (var cab in Cabins)
				{
					if (Math.Abs(Wheel.Rotation - cab.Gradient) < 0.05f)
					{
						Wheel.Gradient = cab.Index + 1 > 15 ? 0 : cab.Index + 1;
						BaseScript.TriggerServerEvent("FerrisWheel:UpdateGradient", Wheel.Gradient);
						switch (Wheel.State)
						{
							case "FACCIO_SALIRE":
								ActualCabin = Cabins[Wheel.Gradient];
								BaseScript.TriggerServerEvent("FerrisWheel:playerGetOn",
									Game.PlayerPed.NetworkId, Wheel.Gradient);
								break;
							case "FACCIO_SCENDERE":
								BaseScript.TriggerServerEvent("FerrisWheel:playerGetOff",
									Game.PlayerPed.NetworkId, Wheel.Gradient);
								break;
						}
					}
				}

				Vector3 pitch = new Vector3(-Wheel.Rotation - 22.5f, 0, 0); // 22.5 --> 360 / 16
				Wheel.Entity.Rotation = pitch;

				Cabins.ToList().ForEach(o => func_145(Cabins.ToList().IndexOf(o)));
				SetAudioSceneVariable("FAIRGROUND_RIDES_FERRIS_WHALE", "HEIGHT", Game.PlayerPed.Position.Z - 13f);
			}
			await Task.FromResult(0);
		}
Пример #2
0
		private static async void PlayerGetOff(int player, int cab)
		{
			Ped Char = (Ped)Entity.FromNetworkId(player);
			CabinPan Cabin = Cabins[cab];
			if (Char == Game.PlayerPed)
			{
				while (ActualCabin != Cabin) await BaseScript.Delay(0);
				RenderScriptCams(false, false, 1000, false, false);
				BaseScript.TriggerServerEvent("FerrisWheel:StopWheel", true);
				Vector3 offset = GetOffsetFromEntityInWorldCoords(Cabin.Entity.Handle, 0f, 0f, 0f);
				Cam1.Delete();
				DestroyAllCams(false);
				int uLocal_377 = NetworkCreateSynchronisedScene(offset.X, offset.Y, offset.Z, 0f, 0f, 0f, 2, false, false, 1065353216, 0, 1065353216);
				NetworkAddPedToSynchronisedScene(Char.Handle, uLocal_377, "anim@mp_ferris_wheel", "exit_player_one", 8f, -8f, 131072, 0, 1148846080, 0);
				NetworkStartSynchronisedScene(uLocal_377);
				Char.Detach();
				await BaseScript.Delay(5000);
				Cabin.NPlayer = 0;
				BaseScript.TriggerServerEvent("FerrisWheel:UpdateCabins", Cabin.Index, Cabin.NPlayer);
				if (IsAudioSceneActive("FAIRGROUND_RIDES_FERRIS_WHALE"))
					StopAudioScene("FAIRGROUND_RIDES_FERRIS_WHALE");
				if (IsAudioSceneActive("FAIRGROUND_RIDES_FERRIS_WHALE_ALTERNATIVE_VIEW"))
					StopAudioScene("FAIRGROUND_RIDES_FERRIS_WHALE_ALTERNATIVE_VIEW");
				if (Char.Handle == PlayerPedId())
					RideEnd = true;
				BaseScript.TriggerServerEvent("FerrisWheel:StopWheel", false);
				Wheel.State = "IDLE";
				ActualCabin = null;
			}
			else
			{
				if (Char.NetworkId != Game.PlayerPed.NetworkId)
					if (!NetworkHasControlOfNetworkId(player))
						while (!NetworkRequestControlOfNetworkId(player)) await BaseScript.Delay(0);
				Vector3 offset = GetOffsetFromEntityInWorldCoords(Cabin.Entity.Handle, 0f, 0f, 0f);
				int uLocal_377 = NetworkCreateSynchronisedScene(offset.X, offset.Y, offset.Z, 0f, 0f, 0f, 2, false, false, 1065353216, 0, 1065353216);
				NetworkAddPedToSynchronisedScene(Char.Handle, uLocal_377, "anim@mp_ferris_wheel", "exit_player_one", 8f, -8f, 131072, 0, 1148846080, 0);
				NetworkStartSynchronisedScene(uLocal_377);
				Char.Detach();
				await BaseScript.Delay(5000);
				Cabin.NPlayer = 0;
				BaseScript.TriggerServerEvent("FerrisWheel:UpdateCabins", Cabin.Index, Cabin.NPlayer);
			}
		}
Пример #3
0
		// triggering an event is my attempt to make the other player Ped to seat in my ferris wheel (not being networked.. every client has its own ferris wheel) -- not working so far
		// same thing is done for the rollercoaster with same result.. nothing.. 
		private static async void PlayerGetOn(int player, int cab)
		{
			Ped Char = (Ped)Entity.FromNetworkId(player);
			CabinPan Cabin = Cabins[cab];
			if (IsEntityAtCoord(Char.Handle, -1661.95f, -1127.011f, 12.6973f, 1f, 1f, 1f, false, true, 0))
			{
				if (Char.NetworkId != Game.PlayerPed.NetworkId)
					if (!NetworkHasControlOfNetworkId(player))
						while (!NetworkRequestControlOfNetworkId(player)) await BaseScript.Delay(0);
				BaseScript.TriggerServerEvent("FerrisWheel:StopWheel", true);
				Wheel.Ferma = true;
				await BaseScript.Delay(100);
				Vector3 coord = GetOffsetFromEntityInWorldCoords(Cabin.Entity.Handle, 0, 0, 0);
				int uLocal_376 = NetworkCreateSynchronisedScene(coord.X, coord.Y, coord.Z, 0f, 0f, 0f, 2, true, false, 1065353216, 0, 1065353216);
				NetworkAddPedToSynchronisedScene(Char.Handle, uLocal_376, "anim@mp_ferris_wheel", "enter_player_one", 8f, -8f, 131072, 0, 1148846080, 0);
				NetworkStartSynchronisedScene(uLocal_376);
				int iVar2 = NetworkConvertSynchronisedSceneToSynchronizedScene(uLocal_376);
				if (GetSynchronizedScenePhase(iVar2) > 0.99f)
				{
					uLocal_376 = NetworkCreateSynchronisedScene(coord.X, coord.Y, coord.Z, 0f, 0f, 0f, 2, true, false, 1065353216, 0, 1065353216);
					NetworkAddPedToSynchronisedScene(Char.Handle, uLocal_376, "anim@mp_ferris_wheel", "enter_player_one", 8f, -8f, 131072, 0, 1148846080, 0);
					NetworkStartSynchronisedScene(uLocal_376);
				}
				await BaseScript.Delay(7000);
				Vector3 attCoords = GetOffsetFromEntityGivenWorldCoords(Cabin.Entity.Handle, Game.PlayerPed.Position.X, Game.PlayerPed.Position.Y, Game.PlayerPed.Position.Z);
				AttachEntityToEntity(Char.Handle, Cabin.Entity.Handle, 0, attCoords.X, attCoords.Y, attCoords.Z, 0f, 0f, Game.PlayerPed.Heading, false, false, false, false, 2, true);
				BaseScript.TriggerServerEvent("FerrisWheel:UpdateCabins", Cabin.Index, Cabin.NPlayer);
				if (Char.Handle == PlayerPedId())
					RideEnd = false;
				Wheel.State = "IDLE";
				BaseScript.TriggerServerEvent("FerrisWheel:StopWheel", false);
				int iLocal_297 = GetSoundId();
				PlaySoundFromEntity(iLocal_297, "GENERATOR", Wheel.Entity.Handle, "THE_FERRIS_WHALE_SOUNDSET", false, 0);
				int iLocal_299 = GetSoundId();
				PlaySoundFromEntity(iLocal_299, "SLOW_SQUEAK", Wheel.Entity.Handle, "THE_FERRIS_WHALE_SOUNDSET", false, 0);
				int iLocal_300 = GetSoundId();
				PlaySoundFromEntity(iLocal_300, "SLOW_SQUEAK", Cabins[1].Entity.Handle, "THE_FERRIS_WHALE_SOUNDSET", false, 0);
				int iLocal_298 = GetSoundId();
				PlaySoundFromEntity(iLocal_298, "CARRIAGE", Cabins[1].Entity.Handle, "THE_FERRIS_WHALE_SOUNDSET", false, 0);
				if (Char.Handle == PlayerPedId())
					CreaCam();
			}
		}