Beispiel #1
0
        private void SetUpSelectionScene(Vector3 pos)
        {
            playerPosition = pos;
            Debug.WriteLine("[FiveM-GT] Creating spotlight source");
            Tick += SpotlightTick;

            //Set up Cameras
            CamUtils.InitCarSelectionCam(playerPosition);
            UserInterface.InitCarSelection();

            permHeading  = Game.PlayerPed.Heading;
            permPosition = Game.PlayerPed.Position;
            LoadPreviewCar(0);

            Tick += ControlsTick;
        }
Beispiel #2
0
        private async void StartRaceIntro()
        {
            DoScreenFadeOut(1000);
            await Delay(2000);

            DoScreenFadeIn(1000);

            Debug.WriteLine("[FiveM-GT] Initiating race introduction set up...");
            if (IsPlayerPlaying)
            {
                Game.PlayerPed.CurrentVehicle.IsHandbrakeForcedOn = true;
                Debug.WriteLine("[FiveM-GT] Setting up introduction camera...");
                CamUtils.InitRaceStartCam();

                Debug.WriteLine("[FiveM-GT] Initiating race introduction...");
                InitRaceIntro();

                while (CamUtils.IsIntroCamRunning)
                {
                    await Delay(0);
                }

                InitCountdown();

                Debug.WriteLine("[FiveM-GT] Initiating Countdown...");

                await Delay(1000);

                CamUtils.InitCountdownCam();

                while (CamUtils.IsCountdownRunning)
                {
                    await Delay(0);
                }

                Game.PlayerPed.CurrentVehicle.IsHandbrakeForcedOn = false;

                Debug.WriteLine("[FiveM-GT] Playing Random Song...");
                SendNuiMessage("{\"type\":\"PlayRandomSong\",\"enable\":true}");
                Debug.WriteLine("[FiveM-GT] Resetting Current Checkpoint...");
                CurrentCheckpoint = Checkpoints[0];
                Debug.WriteLine("[FiveM-GT] Initialising checkpoint system...");
                Tick += CheckpointTick;
            }
        }
Beispiel #3
0
        private void OnClientResourceStart(string resourceName)
        {
            SetNuiFocus(false, false);

            if (GetCurrentResourceName() != resourceName)
            {
                return;
            }

            Debug.WriteLine("[FiveM-GT] Initiating FiveM Gran Turismo...");

            RegisterCommand("startrace", new Action <int, List <object>, string>((source, args, raw) =>
            {
                TriggerServerEvent("FiveM-GT:StartRaceForAll", args[0].ToString().Replace("\"", ""), int.Parse(args[1].ToString()));
                TriggerServerEvent("FiveM-GT:InitPlayerCarSelectionForAll");
            }), false);

            RegisterCommand("choosecar", new Action <int, List <object>, string>((source, args, raw) =>
            {
                Player.UpdateChosenVehicle(args[0].ToString());
            }), false);

            RegisterCommand("testcarselectionscene", new Action <int, List <object>, string>((source, args, raw) =>
            {
                TriggerEvent("initPlayerCarSelection");
            }), false);

            RegisterCommand("camtest", new Action <int, List <object>, string>((source, args, raw) =>
            {
                CamUtils.InitRaceStartCam();
            }), false);

            RegisterCommand("soundoptions", new Action <int, List <object>, string>((source, args, raw) =>
            {
                SendNuiMessage("{\"type\":\"ShowSoundOptions\"}");
                SetNuiFocus(true, true);
            }), false);

            RegisterNUICallback("updateMusicVolume", NUI_UpdateMusicVolume);
            RegisterNUICallback("updateSfxVolume", NUI_UpdateSfxVolume);
            RegisterNUICallback("endNuiFocus", NUI_EndNuiFocus);

            SetUpPlayerConfig();
        }