예제 #1
0
        private static void Update(object sender, GraphicsEventArgs e)
        {
            if (Game.LocalPlayer.Character.IsInAnyVehicle(false))
            {
                if (NativeFunction.Natives.GetPlayerRadioStationIndex <int>() == RadioStation)
                {
                    var status = CommunicationService.GetStatus();

                    // Disable radio in car.
                    NativeFunction.Natives.SetFrontendRadioActive(false);
                    NativeFunction.Natives.SetVehicleRadioLoud(Game.LocalPlayer.Character.CurrentVehicle, false);
                    NativeFunction.Natives.SetVehicleRadioEnabled(Game.LocalPlayer.Character.CurrentVehicle, false);

                    PushSpotifyInfo(status.Track.ArtistResource.Name, status.Track.TrackResource.Name, status.Playing);

                    if (DebugDraw)
                    {
                        DashboardScaleform.Render2D();
                    }
                }

                // Check if vehicle radio is disabled or if it is set to be loud.
                if (!NativeFunction.Natives.x5F43D83FD6738741 <bool>() || !NativeFunction.Natives.x032A116663A4D5AC <bool>(Game.LocalPlayer.Character.CurrentVehicle))
                {
                    NativeFunction.Natives.SetFrontendRadioActive(true);
                    NativeFunction.Natives.SetVehicleRadioLoud(Game.LocalPlayer.Character.CurrentVehicle, true);
                    NativeFunction.Natives.SetVehicleRadioEnabled(Game.LocalPlayer.Character.CurrentVehicle, true);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Updates the information. Runs every gametick.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Update(object sender, EventArgs e)
        {
            // Check if the player is in a vehicle.
            if (Game.Player.Character.IsInVehicle())
            {
                // Check if the radio channel is set correctly.
                if (Function.Call <int>(Hash.GET_PLAYER_RADIO_STATION_INDEX) == RadioStation)
                {
                    // Get the latest Spotify status.
                    var status = CommunicationService.GetStatus();

                    // Disable radio in car.
                    Function.Call(Hash.SET_FRONTEND_RADIO_ACTIVE, false);
                    Function.Call(Hash.SET_VEHICLE_RADIO_LOUD, false);
                    Function.Call(Hash.SET_VEHICLE_RADIO_ENABLED, false);

                    // Push over the spotify information.
                    PushSpotifyInfo(status.Track.ArtistResource.Name, status.Track.TrackResource.Name, status.Playing);

                    // Draw the dashboard on the screen.
                    if (DebugDraw)
                    {
                        DashboardScaleform.Render2D();
                    }
                }

                // Check if vehicle radio is disabled or if it is set to be loud.
                if (!Function.Call <bool>(Hash._0x5F43D83FD6738741) || !Function.Call <bool>(Hash._0x032A116663A4D5AC, Game.Player.Character.CurrentVehicle))
                {
                    // Enable radio in car.
                    Function.Call(Hash.SET_FRONTEND_RADIO_ACTIVE, true);
                    Function.Call(Hash.SET_VEHICLE_RADIO_LOUD, true);
                    Function.Call(Hash.SET_VEHICLE_RADIO_ENABLED, true);
                }
            }
        }