private void OnAbort(object sender, EventArgs e) { // If there is a blip present if (MissionBlip != null && MissionBlip.Exists()) { // Destroy it MissionBlip.Remove(); MissionBlip = null; } // If there is a ped objective present if (Objective != null && Objective.Exists()) { // Also destroy it Objective.Kill(); Objective.MarkAsNoLongerNeeded(); Objective.Delete(); Objective = null; } }
private void OnAbort(object sender, EventArgs e) { // If there is a blip present if (MissionBlip != null && MissionBlip.Exists()) { // Destroy it MissionBlip.Remove(); MissionBlip = null; } // If there is a vehicle if (Target != null && Target.Exists()) { // Destroy the blip if it exists if (Target.CurrentBlip != null && Target.CurrentBlip.Exists()) { Target.CurrentBlip.Remove(); } // Then, destroy the vehicle Target.Delete(); } // Delete the enemies foreach (Ped Enemy in Enemies) { if (Enemy != null && Enemy.Exists()) { Enemy.Delete(); } } // If the screen is faded, return it into the original pov if (Game.IsScreenFadedIn) { Game.FadeScreenIn(1); } }
private void OnTick(object sender, EventArgs e) { // If this mission has been completed if (Manager.Completion.Mission01 != 0) { // Remove the event and return Tick -= OnTick; return; } // If the mission is not in progress, the player has not been notified, the manager has the basic content loaded, the game is not loading, we are Franklin and we can control him if (!IsInProgress && !IsPlayerNotified && Manager.IsContentLoaded && !Game.IsLoading && (uint)Game.Player.Character.Model.Hash == (uint)PedHash.Franklin && Game.Player.CanControlCharacter) { // Notify the user // TODO: Make the message looks like is coming from Lester UI.Notify(Manager.Strings["M01_SMS"], true); IsPlayerNotified = true; return; } // If the mission is not in progress, there is no blip and we are playing as Franklin if (!IsInProgress && MissionBlip == null && (uint)Game.Player.Character.Model.Hash == (uint)PedHash.Franklin) { // Create the mission blip MissionBlip = World.CreateBlip(BlipLocation); MissionBlip.IsShortRange = false; MissionBlip.Sprite = BlipSprite.Lester; MissionBlip.Color = BlipColor.Yellow; MissionBlip.Name = "Lester (LMP)"; return; } // If the blip exists, has a Lester icon but the player is not Franklin or the mission is in progress if (MissionBlip != null && MissionBlip.Exists() && MissionBlip.Sprite == BlipSprite.Lester && ((uint)Game.Player.Character.Model.Hash != (uint)PedHash.Franklin || IsInProgress)) { // Destroy the blip MissionBlip.Remove(); MissionBlip = null; return; } // If the player gets too close from the mission start, there is a blip and is the original Lester blip if (BlipLocation.DistanceTo(Game.Player.Character.Position) < 500 && MissionBlip != null && MissionBlip.Color == BlipColor.Yellow) { // Mark the mission as in-progress IsInProgress = true; // Remove the existing blip MissionBlip.Remove(); // Create a new one MissionBlip = World.CreateBlip(PickUpLocation); MissionBlip.Color = BlipColor.Yellow2; MissionBlip.ShowRoute = true; MissionBlip.Name = "Terminal 4"; // If the player is on a vehicle, tell him to pick the objective if (Game.Player.Character.CurrentVehicle != null) { UI.ShowSubtitle(Manager.Strings["M01_SUB01"], 5000); } // Otherwise, tell him to get a vehicle else { UI.ShowSubtitle(Manager.Strings["M01_SUB07"], 5000); } // Then, proceed to create the ped Objective = World.CreatePed(new Model(PedHash.FreemodeMale01), new Vector3(-1031f, -2734.2f, 20.15f), 8.3f); Objective.IsEnemy = false; Objective.IsInvincible = true; } // If there is a blip and is the 2nd type of yellow if (MissionBlip != null && MissionBlip.Color == BlipColor.Yellow2) { // Draw a little marker to show where the player needs to stop World.DrawMarker(MarkerType.VerticalCylinder, PickUpLocation, Vector3.Zero, Vector3.Zero, new Vector3(1, 1, 1), Color.Yellow); // If the player is on a vehicle and the character is not on said vehicle if (Game.Player.Character.CurrentVehicle != null && !Objective.IsInVehicle(Game.Player.Character.CurrentVehicle)) { // If the player is near the pickup location if (PickUpLocation.DistanceTo(Game.Player.Character.Position) <= 2) { // Freeze the vehicle Game.Player.Character.CurrentVehicle.FreezePosition = true; // If the player is pressing the horn and is on a vehicle if (Game.IsEnabledControlJustPressed(0, Control.VehicleHorn) && Game.Player.Character.CurrentVehicle != null) { // Add a blip with basic information Objective.AddBlip(); Objective.CurrentBlip.Color = BlipColor.Blue; Objective.CurrentBlip.IsShortRange = true; // Tell the ped to enter the vehicle Function.Call(Hash.TASK_ENTER_VEHICLE, Objective, Game.Player.Character.CurrentVehicle, 20000, 0, 1f, 1, 0); // While the objective is entering the vehicle while (!Objective.IsInVehicle(Game.Player.Character.CurrentVehicle)) { // Wait Yield(); } // Once the objective has entered the vehicle, unfreeze it Game.Player.Character.CurrentVehicle.FreezePosition = false; // Remove the blip of the objective Objective.CurrentBlip.Remove(); // Destroy the existing blip and create a new one MissionBlip.Remove(); MissionBlip = World.CreateBlip(DestinationLocation); MissionBlip.Color = BlipColor.Yellow3; MissionBlip.ShowRoute = true; MissionBlip.Name = "Amarillo Vista"; // And show some dialog UI.ShowSubtitle(Manager.Strings["M01_SUB02"], 4000); Wait(4000); UI.ShowSubtitle(Manager.Strings["M01_SUB03"], 4000); Wait(4000); UI.ShowSubtitle(Manager.Strings["M01_SUB04"], 4000); Wait(4000); UI.ShowSubtitle(Manager.Strings["M01_SUB05"], 4000); Wait(4000); } } } } // If there is no mission blip, there is an objective with a vehicle and that vehicle is the same as the player if (MissionBlip == null && Objective != null && Objective.CurrentVehicle != null && Game.Player.Character.CurrentVehicle == Objective.CurrentVehicle) { // Restore the old blip MissionBlip = World.CreateBlip(DestinationLocation); MissionBlip.Color = BlipColor.Yellow3; MissionBlip.ShowRoute = true; MissionBlip.Name = "Amarillo Vista"; // And destroy the one on the vehicle Objective.CurrentVehicle.CurrentBlip.Remove(); } // If the player is en-route to dropping the objective if (MissionBlip != null && MissionBlip.Color == BlipColor.Yellow3) { // If the current player vehicle does not matches the one where the objective is if (Game.Player.Character.CurrentVehicle != Objective.CurrentVehicle) { // Destroy the objective blip MissionBlip.Remove(); MissionBlip = null; // Add a blip onto the vehicle Objective.CurrentVehicle.AddBlip(); Objective.CurrentVehicle.CurrentBlip.Color = BlipColor.Blue2; // Tell the user UI.ShowSubtitle(Manager.Strings["M01_SUB08"], 4000); // And return to avoid side effects return; } // Draw a little marker to show where the player needs to stop World.DrawMarker(MarkerType.VerticalCylinder, DestinationLocation, Vector3.Zero, Vector3.Zero, new Vector3(1, 1, 1), Color.Yellow); // If the player has arrived if (DestinationLocation.DistanceTo(Game.Player.Character.Position) <= 2) { // Freeze the player vehicle Game.Player.Character.CurrentVehicle.FreezePosition = true; // Some dialog UI.ShowSubtitle(Manager.Strings["M01_SUB06"], 4000); Wait(4000); // Fade out Game.FadeScreenOut(1000); Wait(1000); // Time for some cleanup! // Let's remove the character Objective.Delete(); Objective = null; // Set the mission as completed IsInProgress = false; // And delete the blip MissionBlip.Remove(); MissionBlip = null; // Set the mission as passed and save the progress Manager.Completion.Mission01 = (DateTime.UtcNow - DateTime.MinValue).TotalSeconds; Manager.SaveProgress(); // Fade in Game.FadeScreenIn(1000); Wait(1000); // And finally unfreeze the vehicle Game.Player.Character.CurrentVehicle.FreezePosition = false; } } }