Пример #1
0
        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;
            }
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        private void OnTick(object sender, EventArgs e)
        {
            // If this mission has been completed
            if (Manager.Completion.Mission02 != 0)
            {
                // Remove the tick event and return
                Tick -= OnTick;
                return;
            }

            // If the 1st mission has not been completed
            if (Manager.Completion.Mission01 == 0)
            {
                // Return, because the user needs to complete that first
                return;
            }

            // If the player has not been notified and a minute has passed since the last mission
            if (!IsPlayerNotified && !IsInProgress && ((DateTime.UtcNow - DateTime.MinValue).TotalSeconds - Manager.Completion.Mission01) >= 60)
            {
                // Notify the user
                UI.Notify(Manager.Strings["M02_SMS"]);
                IsPlayerNotified = true;
                return;
            }

            // If the player has been notified and the mission has not been started
            if (IsPlayerNotified && !IsInProgress && Game.Player.CanControlCharacter)
            {
                // Draw a little marker where the mission should start
                World.DrawMarker(MarkerType.VerticalCylinder, Start, Vector3.Zero, Vector3.Zero, new Vector3(1, 1, 1), Color.Yellow);

                // If the player is near mission start witout a vehicle
                if (Start.DistanceTo(Game.Player.Character.Position) < 2 && Game.Player.Character.CurrentVehicle == null)
                {
                    // Fade the screen out
                    Game.FadeScreenOut(1000);
                    Wait(1000);

                    // Mark the mission as started
                    IsInProgress = true;
                    // And disable the notification flag
                    IsPlayerNotified = false;
                    // Change the time of day to morning
                    World.CurrentDayTime = new TimeSpan(7, 0, 0);
                    // Move the player to an appropiate position and lock him in place
                    Game.Player.Character.Position       = new Vector3(1290.3f, -1714, 54);
                    Game.Player.Character.Heading        = 111;
                    Game.Player.Character.FreezePosition = true;
                    // Request the freemode male model
                    Model FreemodeMale = new Model(PedHash.FreemodeMale01);
                    FreemodeMale.Request();
                    // Wait until the model has been loaded
                    while (!FreemodeMale.IsLoaded)
                    {
                        Yield();
                    }
                    // Then, spawn the objective ped and also freeze it in place
                    Ped Objective = World.CreatePed(FreemodeMale, new Vector3(1288.5f, -1714, 54), 396.4f);
                    Objective.Heading        = 293;
                    Objective.FreezePosition = true;

                    // Fade in
                    Game.FadeScreenIn(1000);
                    Wait(1000);

                    // And print the dialog
                    UI.ShowSubtitle(Manager.Strings["M02_SUB01"], 4000);
                    Wait(4000);
                    UI.ShowSubtitle(Manager.Strings["M02_SUB02"], 4000);
                    Wait(4000);
                    UI.ShowSubtitle(Manager.Strings["M02_SUB03"], 4000);
                    Wait(4000);
                    UI.ShowSubtitle(Manager.Strings["M02_SUB04"], 4000);
                    Wait(4000);
                    UI.ShowSubtitle(Manager.Strings["M02_SUB05"], 4000);
                    Wait(4000);

                    // Then, fade out again
                    Game.FadeScreenOut(1000);
                    Wait(1000);
                    // Remove the ped
                    Objective.Delete();
                    // Change the player position
                    Game.Player.Character.Position = new Vector3(1292.2f, -1718.4f, 54);
                    Game.Player.Character.Heading  = 206.5f;
                    // Request the Banshee model
                    Model Banshee = new Model(VehicleHash.Banshee2);
                    Banshee.Request();
                    while (!Banshee.IsLoaded)
                    {
                        Yield();
                    }
                    // Create a vehicle and add a blip
                    Target = World.CreateVehicle(Banshee, new Vector3(1054.3f, -3039.7f, 5.7f), 268.2f);
                    Target.AddBlip();
                    Target.CurrentBlip.Sprite       = BlipSprite.GetawayCar;
                    Target.CurrentBlip.IsShortRange = false;
                    Target.CurrentBlip.Color        = BlipColor.Green;
                    // Change some tunning options
                    Function.Call(Hash.SET_VEHICLE_EXTRA, Target, 2, 1);
                    // Destroy the old blip
                    MissionBlip.Remove();
                    MissionBlip = null;

                    // Fade back in
                    Game.FadeScreenIn(1000);
                    Wait(750);
                    // Unfreeze the player
                    Game.Player.Character.FreezePosition = false;
                    // And show a subtitle with instructions
                    UI.ShowSubtitle(Manager.Strings["M02_SUB07"], 4000);
                }

                // If there is no blip and no vehicle to steal
                if (MissionBlip == null && Target == null)
                {
                    // Create a blip on the start position
                    MissionBlip        = World.CreateBlip(Start);
                    MissionBlip.Sprite = BlipSprite.Lester;
                    MissionBlip.Color  = BlipColor.Yellow;
                    MissionBlip.Name   = "Placeholder (LMP)";
                }
            }

            // If the mission is in progress, the plalyer has not been notified and there is a vehicle
            if (IsInProgress && !IsPlayerNotified && Target != null)
            {
                // If the player is getting near the vehicle
                if (Target.Position.DistanceTo(Game.Player.Character.Position) < 500)
                {
                    // Notify the player about the enemies
                    UI.Notify(Manager.Strings["M02_SUB06"], true);
                    IsPlayerNotified = true;

                    // Request the models
                    Model Triad1 = new Model(PedHash.ArmBoss01GMM);
                    Triad1.Request();
                    while (!Triad1.IsLoaded)
                    {
                        Yield();
                    }

                    // Create the enemies
                    Enemies = new List <Ped>
                    {
                        World.CreatePed(Triad1, new Vector3(1046.3f, -3042.3f, 17.2f), 268.5f),
                        World.CreatePed(Triad1, new Vector3(1059.6f, -3034.5f, 5.9f), 229f),
                        World.CreatePed(Triad1, new Vector3(1051.9f, -3047.6f, 5.9f), 222.9f),
                        World.CreatePed(Triad1, new Vector3(1048.9f, -3041.7f, 5.9f), 292.4f),
                        World.CreatePed(Triad1, new Vector3(1059.7f, -3035.8f, 5.9f), 225f),
                    };

                    // And add weapons to them
                    foreach (Ped Enemy in Enemies)
                    {
                        Enemy.Weapons.Give(WeaponHash.CarbineRifleMk2, 9999, false, true);
                    }
                }
            }
        }
Пример #4
0
        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;
                }
            }
        }