Example #1
0
        public static async Task PocceCompanion()
        {
            int ped;
            int player = Game.Player.Character.Handle;

            if (API.IsPedInAnyVehicle(player, false))
            {
                var vehicle = API.GetVehiclePedIsIn(player, false);
                if (Vehicles.GetFreeSeat(vehicle, out int seat))
                {
                    var pocce = Config.PocceList[API.GetRandomIntInRange(0, Config.PocceList.Length)];
                    await Common.RequestModel(pocce);

                    ped = API.CreatePedInsideVehicle(vehicle, 26, pocce, seat, true, false);
                }
                else if (API.GetEntitySpeed(vehicle) > 0.1f)
                {
                    Hud.Notification("Player is in a moving vehicle and there are no free seats");
                    return;
                }
                else
                {
                    ped = await Peds.Spawn(Config.PocceList);
                }
            }
            else
            {
                ped = await Peds.Spawn(Config.PocceList);
            }

            Companions.Add(ped);
            await Peds.Arm(ped, Config.WeaponList);

            API.SetEntityAsNoLongerNeeded(ref ped);
        }
Example #2
0
        public static async Task PetCompanion()
        {
            int player = Game.Player.Character.Handle;

            if (API.IsPedInAnyHeli(player))
            {
                Hud.Notification("Don't spawn that poor pet on a heli");
                return;
            }
            else if (API.IsPedInAnyVehicle(player, false))
            {
                var vehicle = API.GetVehiclePedIsIn(player, false);
                if (API.GetVehicleDashboardSpeed(vehicle) > 0.1f)
                {
                    Hud.Notification("Player is in a moving vehicle");
                    return;
                }
            }

            var ped = await Peds.Spawn(Config.PetList, 28);

            Companions.Add(ped);
            await Peds.Arm(ped, null);

            API.SetEntityAsNoLongerNeeded(ref ped);
        }
Example #3
0
        public static async Task PocceParty(float radius, int speakers, int peds, int booze)
        {
            var center  = API.GetEntityCoords(API.GetPlayerPed(-1), true);
            var station = API.GetPlayerRadioStationIndex();

            if (station == 255) // OFF
            {
                station = 19;   // RADIO_19_USER
            }
            for (int i = 0; i < speakers; ++i)
            {
                var model = SpeakerList[API.GetRandomIntInRange(0, SpeakerList.Length)];
                var prop  = await Props.SpawnInRange(center, model, 1f, radius, false);

                Props.SetSpeaker(prop, station);
            }

            for (int i = 0; i < peds; ++i)
            {
                var ped = await Peds.SpawnInRange(Config.PocceList, center, 1f, radius);

                API.TaskStartScenarioInPlace(ped, "WORLD_HUMAN_PARTYING", 0, true);
                API.SetPedAsNoLongerNeeded(ref ped);
            }

            for (int i = 0; i < booze; ++i)
            {
                var model = BoozeList[API.GetRandomIntInRange(0, BoozeList.Length)];
                var prop  = await Props.SpawnInRange(center, model, 1f, radius, false);

                API.SetEntityAsNoLongerNeeded(ref prop);
            }
        }
Example #4
0
        public void Remove()
        {
            while (Objects.Count > 0)
            {
                Prop p = Objects[Objects.Count - 1];
                p.Delete();
                Objects.RemoveAt(Objects.Count - 1);
            }

            while (Vehicles.Count > 0)
            {
                Vehicle v = Vehicles[Vehicles.Count - 1];
                v.Delete();
                Vehicles.RemoveAt(Vehicles.Count - 1);
            }

            while (Peds.Count > 0)
            {
                Ped p = Peds[Peds.Count - 1];
                p.Delete();
                Peds.RemoveAt(Peds.Count - 1);
            }

            if (Blip.Exists(CurrentBlip))
            {
                CurrentBlip.Remove();
            }
        }
Example #5
0
        public static async Task SpawnTrashPed()
        {
            var ped = await Peds.Spawn(Config.TrashPedList);

            Peds.Burn(ped);
            API.SetPedAsNoLongerNeeded(ref ped);
        }
Example #6
0
        /// <summary>
        /// Constructs a new CalloutData object.
        /// </summary>
        /// <param name="callName">The name of the callout.</param>
        /// <param name="shortName">A short name for the callout; this could be anything, such as a radio/penal code, or abbreviation.</param>
        /// <param name="location">The location of the call.</param>
        /// <param name="response">Whether the call requires a Code 2 or Code 3 response.</param>
        /// <param name="description">The description of the call, as received by 911.</param>
        /// <param name="status">The status of the call. Set this to Created or Dispatched, and then update it to UnitResponding when the player accepts the call.</param>
        /// <param name="callPeds">The list of peds to be added to the call. Can be null to not add any peds; peds can always be added later on (for example, you can add a victim ped now, and then add a suspect ped after the player meets him/her).</param>
        /// <param name="callVehicles">The list of vehicles to be added to the call. Can be null to not add any vehicles; vehicles can always be added later on, for example, after the player encounters a suspect vehicle).</param>
        public CalloutData(string callName, string shortName, Vector3 location,
                           EResponseType response, string description = "", ECallStatus status = ECallStatus.Created,
                           List <Ped> callPeds = null, List <Vehicle> callVehicles             = null)
        {
            ID             = Guid.NewGuid();
            Name           = callName;
            ShortName      = shortName;
            mDescription   = description;
            Location       = location;
            TimeReceived   = DateTime.UtcNow;
            mTimeConcluded = null;
            ResponseType   = response;
            mStatus        = status;
            mPeds          = new List <Ped>();
            mVehicles      = new List <Vehicle>();

            if (callPeds != null)
            {
                Peds.AddRange(callPeds);
            }

            if (callVehicles != null)
            {
                Vehicles.AddRange(callVehicles);
            }

            mLastUpdated = DateTime.UtcNow;
            mUpdates     = new List <CalloutUpdate>();

            mIsPlayerAssigned = true;
            mPrimaryUnit      = Configs.UnitNumber;
        }
Example #7
0
        public static async Task SpawnTrashPed()
        {
            var ped = await Peds.Spawn(Config.TrashPedList);

            await Delay(500);

            Common.Burn(ped);
            API.SetEntityAsNoLongerNeeded(ref ped);
        }
Example #8
0
        public static Task PlayMassScenario(string scenario)
        {
            var peds = Peds.Get(Peds.Filter.Dead | Peds.Filter.Players | Peds.Filter.Animals | Peds.Filter.VehiclePassengers);

            foreach (var ped in peds)
            {
                API.TaskStartScenarioInPlace(ped, scenario, 0, true);
            }

            return(Task.FromResult(0));
        }
Example #9
0
        private static async Task PedRiot(bool useWeapons)
        {
            int i       = 0;
            var peds    = Peds.Get(Peds.Filter.Dead | Peds.Filter.Players | (useWeapons ? Peds.Filter.Animals : Peds.Filter.None)); // do not include animals when using weapons
            var weapons = useWeapons ? Config.WeaponList : null;

            if (peds.Count < 2)
            {
                return;
            }

            foreach (int ped in peds)
            {
                if (API.IsPedInAnyVehicle(ped, false))
                {
                    var vehicle = API.GetVehiclePedIsIn(ped, false);
                    API.TaskLeaveVehicle(ped, vehicle, 1);

                    while (API.IsPedInVehicle(ped, vehicle, false))
                    {
                        await BaseScript.Delay(100);
                    }
                }

                API.ClearPedTasks(ped);

                await Peds.Arm(ped, weapons);

                int enemyPed;
                if (i % 2 == 0)
                {
                    enemyPed = peds[(i + 1) % peds.Count];
                }
                else if (i == peds.Count - 1)
                {
                    enemyPed = peds[0];
                }
                else
                {
                    enemyPed = peds[i - 1];
                }
                API.TaskCombatPed(ped, enemyPed, 0, 16);

                int tmp_ped = ped; API.SetEntityAsNoLongerNeeded(ref tmp_ped);

                ++i;
            }
        }
Example #10
0
        public void Unhide()
        {
            if (Type != InteriorType.Gta)
            {
                return;
            }
            if (!_hidden)
            {
                return;
            }

            Peds.ForEach(p => p.IsVisible     = true);
            Vehicles.ForEach(v => v.IsVisible = true);
            Props.ForEach(p => p.IsVisible    = true);
            _hidden = false;
        }
Example #11
0
        public void DetectSkins()
        {
            LastSkins.Clear();
            var peds = Peds.Get(Peds.DefaultFilters, 4f);

            foreach (var ped in peds)
            {
                var skin = new Skin(ped);
                LastSkins.Add(skin);
                AllSkins.Add(skin);
                ShowNotification(skin);
            }

            if (LastSkins.Count > 0)
            {
                ShowLastSkins();
            }
        }
Example #12
0
        public void DetectSkins()
        {
            _lastSkins.Clear();
            var peds = Peds.Get(Peds.DefaultFilters, 4f);

            foreach (var ped in peds)
            {
                var skin = Skin.FromPed(ped);
                _lastSkins.Add(skin);
                _allSkins.Add(skin);
                ShowNotification(skin);
            }

            if (_lastSkins.Count > 0)
            {
                ShowLastSkins();
            }
        }
Example #13
0
        public static List <string> IdentifyPedModels()
        {
            var coords = Game.Player.Character.Position;
            var peds   = Peds.Get();
            var models = new List <string>();

            foreach (var ped in peds)
            {
                var pos = new Ped(ped).Position;
                if (coords.DistanceToSquared(pos) < 4.0f)
                {
                    var model = string.Format("0x{0:X8}", API.GetEntityModel(ped));
                    models.Add(model);
                    Hud.Notification("ped:" + model);
                }
            }

            return(models);
        }
Example #14
0
        private void CreatePed(MapObject mapObject, Model model)
        {
            var ped = new Ped(
                World.CreatePed(model, mapObject.Position - Vector3.WorldUp, mapObject.Rotation.Z)?.Handle ?? 0);

            if (!mapObject.Dynamic)
            {
                ped.FreezePosition = true;
            }

            ped.Quaternion = mapObject.Quaternion;
            if (mapObject.Weapon != null)
            {
                ped.Weapons.Give(mapObject.Weapon.Value, 15, true, true);
            }
            SetScenario(mapObject, ped);
            if (Enum.TryParse(mapObject.Relationship, out Relationship relationship))
            {
                if (relationship == Relationship.Hate)
                {
                    ped.RelationshipGroup = Game.GenerateHash("HATES_PLAYER");
                }

                World.SetRelationshipBetweenGroups(relationship, ped.RelationshipGroup,
                                                   Game.Player.Character.RelationshipGroup);

                World.SetRelationshipBetweenGroups(relationship, Game.Player.Character.RelationshipGroup,
                                                   ped.RelationshipGroup);

                if (relationship == Relationship.Companion)
                {
                    ped.CanBeTargetted    = false;
                    ped.RelationshipGroup = Game.Player.Character.RelationshipGroup;
                }
            }

            ped.BlockPermanentEvents = false;
            model.MarkAsNoLongerNeeded();
            Peds?.Add(ped);
        }
Example #15
0
        public override void End()
        {
            base.End();

            DeleteBlip();

            foreach (PedBase p in Peds)
            {
                if (p != null)
                {
                    if (p.Exists() == true)
                    {
                        p.DeleteBlip();
                        p.Dismiss();
                    }
                }
            }

            Peds.Clear();

            State = Common.CalloutState.Completed;
        }
Example #16
0
        private static async Task PocceRiot(bool useWeapons)
        {
            var peds    = new List <int>();
            var weapons = useWeapons ? Config.WeaponList : null;

            for (int i = 0; i < 4; ++i)
            {
                int ped1 = await Peds.Spawn(Config.PocceList);

                int ped2 = await Peds.Spawn(Config.PocceList);

                peds.Add(ped1);
                peds.Add(ped2);

                await Peds.Arm(ped1, weapons);

                await Peds.Arm(ped2, weapons);

                API.TaskCombatPed(ped1, ped2, 0, 16);
                API.TaskCombatPed(ped2, ped1, 0, 16);
            }

            for (int i = 0; i < 4; ++i)
            {
                int ped = await Peds.Spawn(Config.PocceList);

                peds.Add(ped);
                await Peds.Arm(ped, weapons);

                API.TaskCombatPed(ped, API.GetPlayerPed(-1), 0, 16);
            }

            foreach (int ped in peds)
            {
                int tmp_ped = ped;
                API.SetPedAsNoLongerNeeded(ref tmp_ped);
            }
        }
Example #17
0
        public void ReCreate()
        {
            Delete();

            Vehicle veh;

            AdvancedPed[] peds;
            CreateInternal(out veh, out peds);

            Vehicle = veh;
            Peds    = peds;
            Driver  = Peds.FirstOrDefault();

            VehicleBlip        = new Blip(Vehicle);
            VehicleBlip.Sprite = VehicleBlipSprite;
            VehicleBlip.Scale  = 0.45f;
            VehicleBlip.Color  = VehicleBlipColor;
            VehicleBlip.Name   = VehicleBlipName;
            NativeFunction.Natives.SetBlipAsShortRange(VehicleBlip, true);

            IsCreated            = true;
            IsDismissedOrDeleted = false;
        }
Example #18
0
        public override bool OnBeforeCalloutDisplayed()
        {
            //Create our ped in the world
            Suspect myPed = new Suspect("Suspect1", "a_m_y_mexthug_01", SpawnPoint.Around(10), 0);

            //Create the vehicle for our ped
            Vehicle myVehicle = new Vehicle("DUKES2", SpawnPoint);

            //Now we have spawned them, check they actually exist and if not return false (preventing the callout from being accepted and aborting it)
            if (!myPed.Exists())
            {
                return(false);
            }
            if (!myVehicle.Exists())
            {
                return(false);
            }

            //Add the Ped to the callout's list of Peds
            Peds.Add(myPed);

            //If we made it this far both exist so let's warp the ped into the driver seat
            myPed.WarpIntoVehicle(myVehicle, -1);

            // Show the user where the pursuit is about to happen and block very close peds.
            this.ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 15f);
            this.AddMinimumDistanceCheck(5f, myPed.Position);

            // Set up our callout message and location
            this.CalloutMessage  = "Example Callout Message";
            this.CalloutPosition = SpawnPoint;

            //Play the police scanner audio for this callout (available as of the 0.2a API)
            Functions.PlayScannerAudioUsingPosition("CITIZENS_REPORT CRIME_RESIST_ARREST IN_OR_ON_POSITION", SpawnPoint);

            return(base.OnBeforeCalloutDisplayed());
        }
Example #19
0
 // add ped to floor
 public void Add(Ped ped)
 {
     Peds.Add(ped);
 }
Example #20
0
        public Client()
        {
            if (Config.GetConfigBool("spawn_vehicle"))
            {
                Hud.AddSubmenu("Spawn vehicle", async(vehicle) => await Vehicles.Spawn(vehicle), Config.VehicleList);
            }

            if (Config.GetConfigBool("spawn_prop"))
            {
                Hud.AddSubmenu("Spawn prop", async(prop) => await Props.Spawn(prop), Config.PropList, 10);
            }

            if (Config.GetConfigBool("spawn_ped"))
            {
                Hud.AddMenuListItem("Spawn ped", async(spawn) =>
                {
                    switch (spawn)
                    {
                    case 0:
                        await PocceCompanion();
                        break;

                    case 1:
                        await PetCompanion();
                        break;

                    case 2:
                        await PoccePassengers();
                        break;

                    case 3:
                        await SpawnTrashPed();
                        break;
                    }
                }, "Pocce companion", "Pet companion", "Pocce passengers", "Trash ped");
            }

            if (Config.GetConfigBool("rope"))
            {
                Hud.AddMenuListItem("Rope", (tow) =>
                {
                    switch (tow)
                    {
                    case 0:
                        RopeClosest(Peds.Get(Peds.Filter.Dead | Peds.Filter.CurrentVehiclePassengers));
                        break;

                    case 1:
                        RopeClosest(Vehicles.Get());
                        break;

                    case 2:
                        RopeClosest(Vehicles.Get(), true);
                        break;

                    case 3:
                        RopeClosest(Props.Get());
                        break;

                    case 4:
                        RappelFromHeli();
                        break;
                    }
                    return(Delay(0));
                }, "Closest ped", "Closest vehicle", "Closest vehicle tow", "Closest prop", "Rappel from heli");
            }

            if (Config.GetConfigBool("rope") || Config.GetConfigBool("spawn_prop"))
            {
                Hud.AddMenuListItem("Clear", (clear) =>
                {
                    switch (clear)
                    {
                    case 0:
                        Ropes.ClearAll();
                        break;

                    case 1:
                        Ropes.ClearLast();
                        break;

                    case 2:
                        Props.ClearAll();
                        break;

                    case 3:
                        Props.ClearLast();
                        break;
                    }
                    return(Delay(0));
                }, "Ropes", "Last rope", "Props", "Last prop");
            }

            if (Config.GetConfigBool("teleport"))
            {
                Hud.AddMenuListItem("Teleport", (teleport) =>
                {
                    switch (teleport)
                    {
                    case 0:
                        TeleportToClosestVehicle();
                        break;

                    case 1:
                        TeleportToClosestVehicle(true);
                        break;
                    }
                    return(Delay(0));
                }, "Closest vehicle", "Closest vehicle as passenger");
            }

            if (Config.GetConfigBool("wave"))
            {
                Hud.AddMenuListItem("Ocean waves", (waves) =>
                {
                    switch (waves)
                    {
                    case 0:
                        API.SetWavesIntensity(8f);
                        break;

                    case 1:
                        API.SetWavesIntensity(2f);
                        break;

                    case 2:
                        API.SetWavesIntensity(0f);
                        break;

                    case 3:
                        API.ResetWavesIntensity();
                        break;
                    }
                    return(Delay(0));
                }, "High", "Mid", "Low", "Reset");
            }

            if (Config.GetConfigBool("riot"))
            {
                Hud.AddMenuListItem("Riot", async(riot) =>
                {
                    switch (riot)
                    {
                    case 0:
                        await PocceRiot(false);
                        break;

                    case 1:
                        await PocceRiot(true);
                        break;

                    case 2:
                        await PedRiot(false);
                        break;

                    case 3:
                        await PedRiot(true);
                        break;
                    }
                }, "Pocce riot", "Armed pocce riot", "Ped riot", "Armed ped riot");
            }

            if (Config.GetConfigBool("other"))
            {
                Hud.AddMenuListItem("Other", async(other) =>
                {
                    switch (other)
                    {
                    case 0:
                        await Autopilot.Toggle();
                        break;

                    case 1:
                        Vehicles.EMP();
                        break;

                    case 2:
                        CargobobMagnet();
                        break;
                    }
                }, "Autopilot", "EMP", "Cargobob magnet");
            }

            if (Config.GetConfigBool("skin"))
            {
                var skins = new DataSource <string>();
                Hud.AddMenuItem("Indentify skins", () => { skins.Push(IdentifyPedModels()); return(Delay(0)); });
                Hud.AddSubmenu("Change skin", async(skin) => await ChangeSkin(skin), skins);
            }

            var menukey = Config.GetConfigInt("menu_key");

            if (menukey > 0)
            {
                Hud.SetMenuKey(menukey);
            }
        }
Example #21
0
        public void Update()
        {
            if (PlayerPed.IsDead)
            {
                EndScenario(false);
            }

            switch (_missionStep)
            {
            case 0:
                var distToColonel = _colonel.Position.DistanceTo(PlayerPed.Position);
                if (distToColonel > 1.75)
                {
                    return;
                }
                World.DrawMarker(MarkerType.UpsideDownCone, _colonel.Position + Vector3.WorldUp * 1.5f,
                                 Vector3.RelativeRight, Vector3.Zero, new Vector3(0.35f, 0.35f, 0.35f), Color.Gold);
                GtsLibNet.DisplayHelpTextWithGxt("END_LABEL_1");
                if (Game.IsControlJustPressed(2, Control.Context))
                {
                    Function.Call(Hash._PLAY_AMBIENT_SPEECH1, _colonel.Handle, "Generic_Hi", "Speech_Params_Force");
                    PlayerPed.Heading = (_colonel.Position - PlayerPed.Position).ToHeading();
                    PlayerPed.Task.ChatTo(_colonel);
                    PlayerPed.Task.StandStill(-1);
                    _colonel.Task.ChatTo(PlayerPed);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_1", 5000);
                    Script.Wait(3000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_2", 5000);
                    Script.Wait(3000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_3", 6000);
                    Script.Wait(3000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_4", 6000);
                    Script.Wait(3000);
                    Game.FadeScreenOut(1000);
                    Script.Wait(1000);
                    PlayerPed.Task.ClearAllImmediately();
                    PlayerPed.FreezePosition = false;
                    _colonel.Delete();
                    _colonel.CurrentBlip?.Remove();
                    Script.Wait(1000);
                    Game.FadeScreenIn(1000);
                    Script.Wait(1000);
                    Core.HeliTransport?.ShowHelp();
                    _missionStep++;
                }
                break;

            case 1:
                DidStart = true;
                if (!_isSatelliteMessageShown)
                {
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_5", 5000);
                    _isSatelliteMessageShown = true;
                }
                if (!_dishesInitialized)
                {
                    if (!Blip.Exists(_dishesAreaBlip))
                    {
                        _dishesAreaBlip           = World.CreateBlip(_dishesArea, 200);
                        _dishesAreaBlip.ShowRoute = true;
                        _dishesAreaBlip.Alpha     = 155;
                        _dishesAreaBlip.Color     = BlipColor.Yellow;
                    }
                    var dist = PlayerPed.Position.DistanceToSquared(_dishesArea);
                    if (dist > 40000)
                    {
                        return;
                    }
                    _dishesAreaBlip?.Remove();
                    _dishes.ForEach(dish =>
                    {
                        dish.CreateLaptop();
                        dish.CreateBlip();
                    });
                    _dishesInitialized = true;
                }
                _dishes.ForEach(x => x.Update());
                foreach (var dish in _dishes)
                {
                    if (!dish.CheckedForData)
                    {
                        var dist = dish.Position.DistanceTo(PlayerPed.Position);
                        if (dist > 1.75f)
                        {
                            continue;
                        }
                        GtsLibNet.DisplayHelpTextWithGxt("INTRO_LABEL_6");
                        if (!Game.IsControlJustPressed(2, Control.Context))
                        {
                            continue;
                        }
                        PlayerPed.FreezePosition = true;
                        PlayerPed.Task.StandStill(-1);
                        PlayerPed.Position = dish.Position;
                        PlayerPed.Heading  = dish.Heading;

                        var groundZ = new OutputArgument();
                        Function.Call(Hash.GET_GROUND_Z_FOR_3D_COORD, PlayerPed.Position.X,
                                      PlayerPed.Position.Y, PlayerPed.Position.Z, groundZ, false);
                        PlayerPed.Position = new Vector3(PlayerPed.Position.X, PlayerPed.Position.Y,
                                                         groundZ.GetResult <float>());

                        PlayerPed.Task.PlayAnimation("missbigscore2aswitch", "switch_mic_car_fra_laptop_hacker",
                                                     4f, -1, AnimationFlags.None);

                        Script.Wait(3000);

                        PlayerPed.FreezePosition = false;
                        PlayerPed.Task.ClearAll();
                        dish.CheckedForData = true;
                        dish.RemoveBlip();
                    }
                }
                _missionStep += _dishes.All(x => x.CheckedForData) ? 1 : 0;
                break;

            case 2:
                if (!_isHumaneLabsMessageShown)
                {
                    Function.Call(Hash.PLAY_MISSION_COMPLETE_AUDIO, "FRANKLIN_BIG_01");
                    while (!Function.Call <bool>(Hash.IS_MISSION_COMPLETE_PLAYING))
                    {
                        Script.Yield();
                    }
                    ScaleFormMessages.Message.SHOW_MISSION_PASSED_MESSAGE(Game.GetGXTEntry("INTRO_LABEL_8"));
                    Effects.Start(ScreenEffect.SuccessNeutral, 5000);
                    Script.Wait(4500);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_7");
                    _isHumaneLabsMessageShown = true;
                }
                if (_humaneLabsBlip == null)
                {
                    _humaneLabsBlip = new Blip(World.CreateBlip(_humaneLabsEnterance).Handle)
                    {
                        Color     = BlipColor.Yellow,
                        Name      = "Humane Labs",
                        ShowRoute = true
                    }
                }
                ;
                _missionStep++;
                break;

            case 3:
                if (PlayerPed.IsInVehicle())
                {
                    return;
                }
                World.DrawMarker(MarkerType.VerticalCylinder, _humaneLabsEnterance - Vector3.WorldUp,
                                 Vector3.RelativeRight, Vector3.Zero, new Vector3(0.5f, 0.5f, 0.5f), Color.Gold);
                var distance = Vector3.Distance(PlayerPed.Position, _humaneLabsEnterance);
                if (distance <= 1.5f)
                {
                    GtsLibNet.DisplayHelpTextWithGxt(
                        "INTRO_LABEL_9");     // "Press ~INPUT_CONTEXT~ to enter/exit humane labs."

                    if (Game.IsControlJustPressed(2, Control.Context))
                    {
                        Game.FadeScreenOut(1);
                        PlayerPed.Position = _humaneLabsExit - Vector3.WorldUp;
                        PlayerPed.Heading  = 173.5802f;
                        Game.FadeScreenIn(750);
                        _missionStep++;
                    }
                }
                break;

            case 4:
                _humaneLabsBlip?.Remove();
                Peds.Add(World.CreatePed(PedHash.Marine02SMM, new Vector3(3534.057f, 3671.142f, 27.12115f),
                                         331.006f));
                Peds.Add(World.CreatePed(PedHash.Scientist01SMM, new Vector3(3539.069f, 3663.527f, 27.12188f),
                                         172.762f));
                Peds.Add(World.CreatePed(PedHash.Scientist01SMM, new Vector3(3534.83f, 3660.603f, 27.12189f),
                                         316.3855f));
                Peds.Add(World.CreatePed(PedHash.Scientist01SMM, new Vector3(3537.047f, 3664.484f, 27.12189f),
                                         172.7052f));
                StartScenarioChecked(Peds[0], "WORLD_HUMAN_GUARD_STAND");     // guard
                StartScenarioChecked(Peds[1], "WORLD_HUMAN_CLIPBOARD");
                StartScenarioChecked(Peds[2], "WORLD_HUMAN_CLIPBOARD");
                StartScenarioChecked(Peds[3], "WORLD_HUMAN_AA_COFFEE");
                var b = Peds[3]?.AddBlip();
                if (b != null)
                {
                    b.Name  = "Scientist";
                    b.Color = BlipColor.Yellow;
                }
                Peds.ForEach(p =>
                {
                    if (p == null)
                    {
                        return;
                    }

                    p.CanRagdoll        = false;
                    p.RelationshipGroup = PlayerPed.RelationshipGroup;
                });
                _missionStep++;
                break;

            case 5:
                if (Peds[3] == null)
                {
                    DeletePeds();
                    _missionStep--;     // go back and request again.
                    return;
                }
                var mainScientist = Peds[3];
                distance = Vector3.Distance(mainScientist.Position, PlayerPed.Position);
                if (distance > 1.3f)
                {
                    return;
                }
                GtsLibNet.DisplayHelpTextWithGxt("INTRO_LABEL_10");     // "Press INPUT_TALK to talk to the scientist".
                if (Game.IsControlJustPressed(2, Control.Talk))
                {
                    Function.Call(Hash._PLAY_AMBIENT_SPEECH1, mainScientist.Handle, "Generic_Thanks",
                                  "Speech_Params_Force_Shouted_Critical");
                    mainScientist.Task.AchieveHeading((PlayerPed.Position - mainScientist.Position).ToHeading());
                    Script.Wait(1000);
                    Function.Call(Hash.PLAY_MISSION_COMPLETE_AUDIO, "FRANKLIN_BIG_01");
                    while (!Function.Call <bool>(Hash.IS_MISSION_COMPLETE_PLAYING))
                    {
                        Script.Yield();
                    }
                    ScaleFormMessages.Message.SHOW_MISSION_PASSED_MESSAGE(Game.GetGXTEntry("INTRO_LABEL_11"));
                    Effects.Start(ScreenEffect.SuccessNeutral, 5000);
                    Script.Wait(750);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_12");
                    mainScientist.CurrentBlip?.Remove();
                    _missionStep++;
                }
                break;

            case 6:
                CreateColonel();
                _humaneLabsBlip?.Remove();
                _humaneLabsBlip = new Blip(World.CreateBlip(_humaneLabsExit).Handle)
                {
                    Color = BlipColor.Yellow,
                    Name  = "Outside"
                };
                _missionStep++;
                break;

            case 7:
                World.DrawMarker(MarkerType.VerticalCylinder, _humaneLabsExit - Vector3.WorldUp,
                                 Vector3.RelativeRight, Vector3.Zero, new Vector3(0.5f, 0.5f, 0.5f), Color.Gold);
                distance = Vector3.Distance(PlayerPed.Position, _humaneLabsExit);
                if (distance > 1.3f)
                {
                    return;
                }
                GtsLibNet.DisplayHelpTextWithGxt(
                    "INTRO_LABEL_9");     // "Press ~INPUT_CONTEXT~ to enter/exit humane labs."
                if (Game.IsControlJustPressed(2, Control.Context))
                {
                    Game.FadeScreenOut(1);
                    PlayerPed.Position = _humaneLabsEnterance - Vector3.WorldUp;
                    PlayerPed.Heading  = -173.5802f;
                    _humaneLabsBlip?.Remove();
                    Peds?.ForEach(p => p?.Delete());
                    Script.Wait(750);
                    Game.FadeScreenIn(1000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_13");
                    _missionStep++;
                }
                break;

            case 8:
                distance = PlayerPed.Position.DistanceToSquared(_colonel.Position);
                if (distance > 3f)
                {
                    return;
                }
                World.DrawMarker(MarkerType.UpsideDownCone, _colonel.Position + Vector3.WorldUp * 1.5f,
                                 Vector3.RelativeRight, Vector3.Zero, new Vector3(0.35f, 0.35f, 0.35f), Color.Gold);
                GtsLibNet.DisplayHelpTextWithGxt("END_LABEL_1");

                if (Game.IsControlJustPressed(2, Control.Context))
                {
                    PlayerPed.Heading = (_colonel.Position - PlayerPed.Position).ToHeading();
                    PlayerPed.Task.ChatTo(_colonel);
                    PlayerPed.Task.StandStill(-1);
                    _colonel.Task.ChatTo(PlayerPed);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_14");
                    Script.Wait(5000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_15");
                    Script.Wait(5000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_16");
                    Script.Wait(5000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_17");
                    Script.Wait(5000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_18");
                    Script.Wait(2000);
                    Function.Call(Hash._PLAY_AMBIENT_SPEECH1, PlayerPed.Handle, "Generic_Thanks",
                                  "Speech_Params_Force");
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_19");
                    Script.Wait(4000);
                    Game.FadeScreenOut(1500);
                    Script.Wait(1500);
                    PlayerPed.Task.ClearAll();
                    _colonel?.Delete();
                    Game.FadeScreenIn(1500);
                    Function.Call(Hash.PLAY_MISSION_COMPLETE_AUDIO, "FRANKLIN_BIG_01");
                    while (!Function.Call <bool>(Hash.IS_MISSION_COMPLETE_PLAYING))
                    {
                        Script.Yield();
                    }
                    ScaleFormMessages.Message.SHOW_MISSION_PASSED_MESSAGE(Game.GetGXTEntry("INTRO_LABEL_20"));
                    Effects.Start(ScreenEffect.SuccessNeutral, 5000);
                    Script.Wait(4500);
                    UI.ShowSubtitle(Game.GetGXTEntry("GO_TO") + " ~p~Space~s~.");
                    EndScenario(true);
                }
                break;
            }
        }
Example #22
0
 private void DeletePeds()
 {
     Peds?.ForEach(p => p?.Delete());
 }