public BuildNotification(Category cat = Category.Notification, string title = null, string details = null, bool clearable = true, ValidityCheck valid = null)
 {
     this.cat       = cat;
     this.title     = title;
     this.details   = details;
     this.clearable = clearable;
     this.valid     = valid;
 }
Beispiel #2
0
        /// <summary>
        /// Called right after a world event was started.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            // Create patrolling NOOSE Squad
            NooseVeh = new LVehicle(lcpdfrPlayer.Ped.GetOffsetPosition(new Vector3(90.0f, 90.0f, 0)), Common.GetRandomCollectionValue <string>(NooseVehModels));
            NooseVeh.PlaceOnNextStreetProperly();
            NooseVeh.Wash();
            SWATMembers = new LPed[4] {
                NooseVeh.CreatePedOnSeat(VehicleSeat.Driver, SWATTrooper, RelationshipGroup.Cop),
                NooseVeh.CreatePedOnSeat(VehicleSeat.AnyPassengerSeat, SWATTrooper, RelationshipGroup.Cop),
                NooseVeh.CreatePedOnSeat(VehicleSeat.AnyPassengerSeat, SWATTrooper, RelationshipGroup.Cop),
                NooseVeh.CreatePedOnSeat(VehicleSeat.AnyPassengerSeat, SWATTrooper, RelationshipGroup.Cop)
            };
            for (int i = 0; i <= SWATMembers.Length; i++)
            {
                // Adjust relationship with environment
                SWATMembers[i].ChangeRelationship(RelationshipGroup.Cop, Relationship.Respect);
                SWATMembers[i].ChangeRelationship(RelationshipGroup.Criminal, Relationship.Dislike);
                SWATMembers[i].ChangeRelationship(RelationshipGroup.Gang_Biker1, Relationship.Dislike);
                SWATMembers[i].ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Dislike);

                // Some officers cannot shoot accurately
                SWATMembers[i].Accuracy = Common.GetRandomValue(75, 100);

                // Equip armor
                SWATMembers[i].Armor = 100;

                // Assign weapons
                SWATMembers[i].Weapons.RemoveAll();
                SWATMembers[i].Weapons.FromType(Weapon.Melee_Knife);
                SWATMembers[i].Weapons.FromType(Weapon.Handgun_DesertEagle).Ammo = 999;
                SWATMembers[i].Weapons.FromType(Weapon.Shotgun_Baretta).Ammo     = 999;
                SWATMembers[i].Weapons.FromType(Weapon.Rifle_M4).Ammo            = 999;
                SWATMembers[i].Weapons.FromType(Weapon.Thrown_Grenade).Ammo      = Common.GetRandomValue(1, 3);
                SWATMembers[i].Weapons.Select(Weapon.Rifle_M4);

                // Set ownership
                Functions.SetPedIsOwnedByScript(SWATMembers[i], this, true);
            }
            NooseVeh.DisablePullover         = true;
            NooseVeh.AllowSirenWithoutDriver = true;

            // Grab current vehicle data from the first spawned NOOSE/SWAT member and assign it to cruise drive.
            //if (NooseVeh != null && NooseVeh.Exists() && NooseVeh.IsDriveable && SWATMembers[0].IsInVehicle(NooseVeh))
            if (ValidityCheck.isObjectValid(NooseVeh))
            {
                if (NooseVeh.IsDriveable && SWATMembers[0].IsInVehicle(NooseVeh))
                {
                    SWATMembers[0].Task.CruiseWithVehicle(NooseVeh, 40.0f, true);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Put all resource free logic here. This is either called by the calloutmanager to shutdown the callout or can be called by the
        /// callout itself to execute the cleanup code. Call base to set state to None.
        /// </summary>
        public override void End()
        {
            base.End();
            this.State = EShootoutState.None;

            if (ValidityCheck.isObjectValid(this.blip))
            {
                this.blip.Delete();
            }

            if (this.pursuit != null)
            {
                Functions.ForceEndPursuit(this.pursuit);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Called every tick to process all script logic. Call base when overriding.
        /// </summary>
        public override void Process()
        {
            base.Process();

            if (ValidityCheck.isObjectValid(luis) && luis.HasBeenArrested)
            {
                this.SetCalloutFinished(true, true, true);
                this.End();
            }

            // End this script is pursuit is no longer running, e.g. because all suspects are dead
            if (!Functions.IsPursuitStillRunning(this.pursuit))
            {
                this.SetCalloutFinished(true, true, true);
                this.End();
            }
        }
Beispiel #5
0
        /// <summary>
        /// Starts fighting.
        /// </summary>
        private void Engage()
        {
            foreach (LPed criminal in this.criminals)
            {
                if (ValidityCheck.isObjectValid(criminal))
                {
                    // Enable chase AI and extend sense range so suspects won't flee immediately but fight longer
                    criminal.DisablePursuitAI     = false;
                    criminal.RangeToDetectEnemies = 80f * 3;
                    criminal.StartKillingSpree(true);
                }
            }

            // Maybe add chance suspects can flee too?
            Functions.SetPursuitDontEnableCopBlips(this.pursuit, false);
            Functions.SetPursuitAllowWeaponsForSuspects(this.pursuit, true);
            Functions.SetPursuitForceSuspectsToFight(this.pursuit, true);
            Functions.SetPursuitIsActiveDelayed(this.pursuit, 2500, 5000);
        }
Beispiel #6
0
    protected void save_Click(object sender, EventArgs e)
    {
        bool count;

        datebirth.Text = datebirth1.Value;
        age.Text       = age1.Value;
        StudentsPersonalInformationModel studentspersonalinformationModel = new StudentsPersonalInformationModel();

        studentspersonalinformationModel.id        = id;
        studentspersonalinformationModel.real_name = CommonFunc.FilterSpecialString(real_name.Text.Trim());
        studentspersonalinformationModel.sex       = CommonFunc.FilterSpecialString(sex.SelectedValue.Trim());
        studentspersonalinformationModel.age       = CommonFunc.FilterSpecialString(age.Text.Trim());
        studentspersonalinformationModel.datebirth = CommonFunc.FilterSpecialString(datebirth.Text.Trim());
        studentspersonalinformationModel.minzu     = CommonFunc.FilterSpecialString(minzu.SelectedValue.Trim());

        studentspersonalinformationModel.province                    = CommonFunc.FilterSpecialString(province1.Value.Trim());
        studentspersonalinformationModel.city                        = CommonFunc.FilterSpecialString(city1.Value.Trim());
        studentspersonalinformationModel.area                        = CommonFunc.FilterSpecialString(area1.Value.Trim());
        studentspersonalinformationModel.detail_address              = CommonFunc.FilterSpecialString(detail_address.Text.Trim());
        studentspersonalinformationModel.id_number                   = CommonFunc.FilterSpecialString(id_number.Text.Trim());
        studentspersonalinformationModel.telephon                    = CommonFunc.FilterSpecialString(telephon.Text.Trim());
        studentspersonalinformationModel.mail                        = CommonFunc.FilterSpecialString(mail.Text.Trim());
        studentspersonalinformationModel.bk_school                   = CommonFunc.FilterSpecialString(bk_school.Text.Trim());
        studentspersonalinformationModel.bk_major                    = CommonFunc.FilterSpecialString(bk_major.Text.Trim());
        studentspersonalinformationModel.graduation_time             = CommonFunc.SafeGetDateTimeStringFromObjectByFormat(CommonFunc.FilterSpecialString(graduation_time.Text.Trim()), "yyyy-MM");
        studentspersonalinformationModel.high_education              = CommonFunc.FilterSpecialString(high_education.Text.Trim());
        studentspersonalinformationModel.high_school                 = CommonFunc.FilterSpecialString(high_school.Text.Trim());
        studentspersonalinformationModel.high_major                  = CommonFunc.FilterSpecialString(high_major.Text.Trim());
        studentspersonalinformationModel.high_education_time         = CommonFunc.SafeGetDateTimeStringFromObjectByFormat(CommonFunc.FilterSpecialString(high_education_time.Text.Trim()), "yyyy-MM");
        studentspersonalinformationModel.identity_type               = CommonFunc.FilterSpecialString(identity_type.SelectedValue.Trim());
        studentspersonalinformationModel.send_unit                   = CommonFunc.FilterSpecialString(send_unit.Text.Trim());
        studentspersonalinformationModel.training_base_province_code = CommonFunc.FilterSpecialString(training_base_province_code.Value.Trim());
        studentspersonalinformationModel.training_base_province_name = CommonFunc.FilterSpecialString(training_base_province_name.Value.Trim());
        studentspersonalinformationModel.training_base_code          = CommonFunc.FilterSpecialString(training_base_code.Value.Trim());
        studentspersonalinformationModel.training_base_name          = CommonFunc.FilterSpecialString(training_base_name.Value.Trim());
        studentspersonalinformationModel.collaborative_unit          = CommonFunc.FilterSpecialString(collaborative_unit.Text.Trim());
        studentspersonalinformationModel.professional_base_code      = CommonFunc.FilterSpecialString(professional_base_code.Value.Trim());
        studentspersonalinformationModel.professional_base_name      = CommonFunc.FilterSpecialString(professional_base_name.Value.Trim());
        studentspersonalinformationModel.training_time               = CommonFunc.FilterSpecialString(training_time.Text.Trim());
        studentspersonalinformationModel.plan_training_time          = CommonFunc.FilterSpecialString(plan_training_time.Text.Trim());
        studentspersonalinformationModel.writor                      = CommonFunc.FilterSpecialString(writor.Text.Trim());
        studentspersonalinformationModel.register_date               = CommonFunc.FilterSpecialString(register_date.Text.Trim());
        if (string.IsNullOrEmpty(studentspersonalinformationModel.id_number))
        {
            ShowMessageBox.Showmessagebox(this, "居民身份证号码不能为空", null);
            return;
        }
        if (string.IsNullOrEmpty(studentspersonalinformationModel.detail_address))
        {
            ShowMessageBox.Showmessagebox(this, "家庭详细地址不能为空", null);
            return;
        }
        if (studentspersonalinformationModel.detail_address.Length > 70)
        {
            ShowMessageBox.Showmessagebox(this, "家庭常住地址不能大于70个字符", null);
            return;
        }
        if (string.IsNullOrEmpty(studentspersonalinformationModel.sex))
        {
            ShowMessageBox.Showmessagebox(this, "性别不能为空", null);
            return;
        }


        if (string.IsNullOrEmpty(studentspersonalinformationModel.telephon))
        {
            ShowMessageBox.Showmessagebox(this, "常用手机号码不能为空", null);
            return;
        }
        if (!ValidityCheck.PhoneNumIsValid(studentspersonalinformationModel.telephon, this))
        {
            return;
        }
        if (string.IsNullOrEmpty(studentspersonalinformationModel.mail))
        {
            ShowMessageBox.Showmessagebox(this, "常用邮箱不能为空", null);
            return;
        }
        if (!ValidityCheck.EmailIsValid(studentspersonalinformationModel.mail, this))
        {
            return;
        }

        if (string.IsNullOrEmpty(studentspersonalinformationModel.high_school))
        {
            ShowMessageBox.Showmessagebox(this, "最高学历毕业院校不能为空", null);
            return;
        }
        if (string.IsNullOrEmpty(studentspersonalinformationModel.high_major))
        {
            ShowMessageBox.Showmessagebox(this, "最高学历专业不能为空", null);
            return;
        }
        if (string.IsNullOrEmpty(studentspersonalinformationModel.high_education_time))
        {
            ShowMessageBox.Showmessagebox(this, "获得最高学历时间不能为空", null);
            return;
        }

        if (studentspersonalinformationModel.identity_type == "单位人")
        {
            if (string.IsNullOrEmpty(studentspersonalinformationModel.send_unit))
            {
                ShowMessageBox.Showmessagebox(this, "派出单位不能为空", null);
            }
        }
        if (string.IsNullOrEmpty(studentspersonalinformationModel.training_base_name))
        {
            ShowMessageBox.Showmessagebox(this, "培训基地不能为空", null);
            return;
        }
        if (string.IsNullOrEmpty(studentspersonalinformationModel.professional_base_name))
        {
            ShowMessageBox.Showmessagebox(this, "培训专业不能为空", null);
            return;
        }
        if (string.IsNullOrEmpty(studentspersonalinformationModel.training_time))
        {
            ShowMessageBox.Showmessagebox(this, "参训时间不能为空", null);
            return;
        }
        if (string.IsNullOrEmpty(studentspersonalinformationModel.plan_training_time))
        {
            ShowMessageBox.Showmessagebox(this, "计划参训时间不能为空", null);
            return;
        }


        StudentsPersonalInformationBLL studentspersonalinformationBLL = new StudentsPersonalInformationBLL();

        count = studentspersonalinformationBLL.UpdateStudentsPersonalInformation(studentspersonalinformationModel);
        if (count)
        {
            try
            {
                Response.Write("<script> alert('个人信息修改成功');window.opener.window.loadPageList('" + pi + "');window.close();</script>");
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
        else
        {
            Response.Write("<script> alert('个人信息修改失败');</script>");
        }
    }
Beispiel #7
0
        /// <summary>
        /// Called when the callout has been accepted. Call base to set state to Running.
        /// </summary>
        /// <returns>
        /// True if callout was setup properly, false if it failed. Calls <see cref="End"/> when failed.
        /// </returns>
        public override bool OnCalloutAccepted()
        {
            bool isReady = base.OnCalloutAccepted();

            // Create pursuit instance
            this.pursuit = Functions.CreatePursuit();

            // Create vehicle
            try
            {
                this.vehicle = new LVehicle(World.GetNextPositionOnStreet(this.spawnPosition), Common.GetRandomCollectionValue <string>(this.vehicleModels));
                if (ValidityCheck.isObjectValid(this.vehicle))
                {
                    // Ensure vehicle is freed on end
                    Functions.AddToScriptDeletionList(this.vehicle, this);
                    this.vehicle.PlaceOnNextStreetProperly();

                    // Create Luis
                    luis             = vehicle.CreatePedOnSeat(VehicleSeat.Driver, new CModel(new Model("IG_LUIS")), RelationshipGroup.Criminal);
                    luis.PersonaData = new PersonaData(new DateTime(1983, 8, 17, 0, 25, 0, DateTimeKind.Utc), 13, "Luis Fernando", "Lopez", true, 8, true);
                    luis.Money       = 500;

                    // Make ignore all events
                    luis.BlockPermanentEvents = true;
                    luis.Task.AlwaysKeepTask  = true;

                    // Give specified weapons
                    luis.Weapons.RemoveAll();
                    luis.Weapons.DesertEagle.Ammo     = 999;
                    luis.DefaultWeapon                = Weapon.Handgun_DesertEagle;
                    luis.Weapons.AssaultRifle_M4.Ammo = 300;
                    luis.Weapons.AssaultRifle_M4.Select();
                    luis.ComplianceChance = Common.GetRandomValue(40, 80);

                    // Make default of the ped's component variation
                    Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", new Parameter[] { luis.GPed });

                    // Add to deletion list and to pursuit
                    Functions.AddToScriptDeletionList(luis, this);
                    Functions.AddPedToPursuit(this.pursuit, luis);
                }

                // Create FIB Squad
                LVehicle fibCar       = new LVehicle(World.GetNextPositionOnStreet(this.vehicle.Position), "FBI");
                LPed[]   fibPersonnel = new LPed[4]
                {
                    fibCar.CreatePedOnSeat(VehicleSeat.Driver, new CModel((UInt32)3295460374), RelationshipGroup.Cop),
                    fibCar.CreatePedOnSeat(VehicleSeat.RightFront, new CModel((UInt32)3295460374), RelationshipGroup.Cop),
                    fibCar.CreatePedOnSeat(VehicleSeat.LeftRear, new CModel((UInt32)3295460374), RelationshipGroup.Cop),
                    fibCar.CreatePedOnSeat(VehicleSeat.RightRear, new CModel((UInt32)3295460374), RelationshipGroup.Cop),
                };

                if (ValidityCheck.isObjectValid(fibCar))
                {
                    Functions.AddToScriptDeletionList(fibCar, this);
                    fibCar.PlaceOnNextStreetProperly();
                    fibCar.SirenActive = true;

                    foreach (LPed fib in fibPersonnel)
                    {
                        if (fib.isObjectValid()) // derived from ValidityCheck - greetings to LtFlash
                        {
                            Functions.AddToScriptDeletionList(fib, this);
                            fib.Weapons.RemoveAll();
                            fib.Weapons.FromType(Weapon.Handgun_Glock).Ammo = 999;
                            fib.Weapons.FromType(Weapon.SMG_MP5).Ammo       = 999;
                            fib.Weapons.FromType(Weapon.Rifle_M4).Ammo      = 999;
                            fib.Weapons.Select(Weapon.Rifle_M4);
                            fib.DefaultWeapon = Weapon.Rifle_M4;
                        }
                    }
                }

                // Since we want other cops to join, set as called in already and also active it for player
                Functions.SetPursuitCalledIn(this.pursuit, true);
                Functions.SetPursuitIsActiveForPlayer(this.pursuit, true);
                // Add a chance that the suspect forced to fight back
                Functions.SetPursuitForceSuspectsToFight(this.pursuit, Common.GetRandomBool(0, 2, 1));

                // Show message to the player
                Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_ROBBERY_CATCH_UP"), 25000);
                isReady = true;
            }
            catch (Exception ex) { Log.Error("OnCalloutAccepted: Cannot create Pursuit instance: " + ex, this); isReady = false; }

            return(isReady);
        }
        /// <summary>
        /// Called every tick to process all plugin logic.
        /// </summary>
        public override void Process()
        {
            // Detects if player is on duty and is using specified model used in NooseMod
            if (LPlayer.LocalPlayer.IsOnDuty)
            {
                if (LPlayer.LocalPlayer.Skin.Model == new Model("M_Y_SWAT") || LPlayer.LocalPlayer.Skin.Model == new Model("M_Y_NHELIPILOT"))
                {
                    try
                    {
                        // Get Partners
                        LHandle partnerManager = Functions.GetCurrentPartner();
                        partners = Functions.GetPartnerPeds(partnerManager);
                        //Log.Debug("Partner Handle: " + partnerManager.ToString(), this);

                        // Make sure it is not null when processed
                        if (partners != null)
                        {
                            foreach (LPed myped in partners)
                            {
                                //if (myped.Exists() && Record[myped.GetHashCode()] == false)
                                if (ValidityCheck.isObjectValid(myped) && Record[myped.GetHashCode()] == false)
                                {
                                    // Store the record so it won't be processed twice or more
                                    Record[myped.GetHashCode()] = true;

                                    // Change Relationship!
                                    myped.ChangeRelationship(RelationshipGroup.Player, Relationship.Companion);
                                    myped.ChangeRelationship(RelationshipGroup.Cop, Relationship.Companion);
                                    myped.ChangeRelationship(RelationshipGroup.Civillian_Male, Relationship.Like);
                                    myped.ChangeRelationship(RelationshipGroup.Civillian_Female, Relationship.Like);
                                    myped.ChangeRelationship(RelationshipGroup.Criminal, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Fireman, Relationship.Like);
                                    myped.ChangeRelationship(RelationshipGroup.Medic, Relationship.Respect);
                                    myped.ChangeRelationship(RelationshipGroup.Dealer, Relationship.Dislike);
                                    myped.ChangeRelationship(RelationshipGroup.Gang_AfricanAmerican, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Gang_Albanian, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Gang_Biker1, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Gang_ChineseJapanese, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Gang_Irish, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Gang_Italian, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Gang_Jamaican, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Gang_Korean, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Gang_PuertoRican, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Gang_Russian1, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Gang_Russian2, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Special, Relationship.Hate);
                                    myped.ChangeRelationship(RelationshipGroup.Prostitute, Relationship.Neutral);

                                    // Make your partner can switch weapons from time to time (like ContactAction ASI plugin)
                                    myped.CanSwitchWeapons = true;

                                    // Allow drive-by when being shot at so they can return fire
                                    myped.WillDoDrivebys = true;

                                    // Should the partners have a chance to comply like suspects?
                                    // TODO: Remove me
                                    try
                                    {
                                        myped.ComplianceChance = random.Next(100);
                                    }
                                    catch (ArgumentOutOfRangeException)
                                    {
                                        Log.Error("Value is out of range, defaulting...", this);
                                        myped.ComplianceChance = 50;
                                    }

                                    Log.Info("Partner's custom relationship set!", this);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error("Failed setting up relationship data with partner: " + ex, this);
                        Functions.PrintHelp("Relationship Switcher encountered an error, check LCPDFR.log for details.");
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                return;
            }
        }
        /// <summary>
        /// Called when the callout has been accepted. Call base to set state to Running.
        /// </summary>
        /// <returns>
        /// True if callout was setup properly, false if it failed. Calls <see cref="End"/> when failed.
        /// </returns>
        public override bool OnCalloutAccepted()
        {
            bool isReady             = base.OnCalloutAccepted();
            bool isLuisCarryingDrugs = new Boolean();

            // Create pursuit instance
            this.pursuit = Functions.CreatePursuit();

            // Create vehicle
            try
            {
                this.vehicle = new LVehicle(World.GetNextPositionOnStreet(this.spawnPosition), Common.GetRandomCollectionValue <string>(this.vehicleModels));

                /*try
                 * {
                 *  if (vehicle.Model.ModelInfo.ModelFlags.HasFlag(EModelFlags.IsEmergencyServicesVehicle) || vehicle.Model.ModelInfo.ModelFlags.HasFlag(EModelFlags.IsCopCar)) vehicle.SirenActive = true;
                 * }
                 * catch (ArgumentException ex)
                 * {
                 *  Log.Warning("Unknown model flag contained on model: " + vehicle.ToString() + ", treated it as a civilian vehicle", this);
                 *  Log.Warning(ex.ToString(), this);
                 * }*/

                if (this.vehicle.isObjectValid())
                {
                    // Ensure vehicle is freed on end
                    Functions.AddToScriptDeletionList(this.vehicle, this);
                    this.vehicle.PlaceOnNextStreetProperly();

                    // Create suspects
                    this.criminals = new LPed[4]
                    {
                        vehicle.CreatePedOnSeat(VehicleSeat.Driver, new CModel(new Model("IG_LUIS2")), RelationshipGroup.Special),
                        vehicle.CreatePedOnSeat(VehicleSeat.LeftRear, new CModel(new Model("IG_ARMANDO")), RelationshipGroup.Special),
                        vehicle.CreatePedOnSeat(VehicleSeat.RightRear, new CModel(new Model("IG_HENRIQUE")), RelationshipGroup.Special),
                        vehicle.CreatePedOnSeat(VehicleSeat.RightFront, CModel.GetRandomModel(EModelFlags.IsWealthUpperClass), RelationshipGroup.Criminal),
                    };

                    // Allow suspects to use custom Persona Data specific to protagonist characters
                    criminals[0].PersonaData = new PersonaData(new DateTime(1983, 8, 17, 0, 25, 0, DateTimeKind.Utc), 13, "Luis Fernando", "Lopez", true, 8, true);
                    criminals[0].BecomeMissionCharacter();

                    if (Common.GetRandomBool(0, 3, 1))
                    {
                        criminals[0].Money        = 5000;
                        criminals[0].ItemsCarried = LPed.EPedItem.Drugs;
                        isLuisCarryingDrugs       = true;
                    }
                    else
                    {
                        criminals[0].Money = 0;
                    }

                    criminals[1].PersonaData = new PersonaData(new DateTime(1981, 6, 20), 4, "Armando", "", true, 0, true);
                    criminals[1].BecomeMissionCharacter();
                    criminals[2].PersonaData = new PersonaData(new DateTime(1982, 9, 29), 4, "Henrique", "", true, 3, true);
                    criminals[2].BecomeMissionCharacter();

                    if (isLuisCarryingDrugs == false)
                    {
                        criminals[3].Money = 1000;
                        if (Common.GetRandomBool(0, 3, 1))
                        {
                            criminals[3].ItemsCarried = LPed.EPedItem.Drugs;
                        }
                        else
                        {
                            criminals[3].ItemsCarried = LPed.EPedItem.StolenCards;
                        }
                    }

                    for (int i = 0; i < this.criminals.Length; i++)
                    {
                        // Make ignore all events
                        this.criminals[i].WillDoDrivebys = true;
                        this.criminals[i].Task.FightAgainstHatedTargets(criminals[i].RangeToDetectEnemies);
                        this.criminals[i].BlockPermanentEvents = true;
                        this.criminals[i].Task.AlwaysKeepTask  = true;

                        // Give specified weapons
                        //criminals[i].ItemsCarried = LPed.EPedItem.Weapons;
                        criminals[i].Weapons.RemoveAll();
                        criminals[i].Weapons.FromType(Weapon.Melee_Knife).Ammo    = 999;
                        criminals[i].Weapons.FromType(Weapon.TBOGT_Pistol44).Ammo = 9999;
                        criminals[i].DefaultWeapon = Weapon.TBOGT_Pistol44;
                        criminals[i].Weapons.FromType(Weapon.TBOGT_GoldenSMG).Ammo  = 320;
                        criminals[i].Weapons.FromType(Weapon.TBOGT_AdvancedMG).Ammo = 400;
                        criminals[i].Weapons.Select(Weapon.TBOGT_AdvancedMG);
                        criminals[i].ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate);
                        criminals[i].ChangeRelationship(RelationshipGroup.Special, Relationship.Companion);
                        criminals[i].ChangeRelationship(RelationshipGroup.Criminal, Relationship.Companion);
                        criminals[i].CantBeDamagedByRelationshipGroup(RelationshipGroup.Criminal, base.OnCalloutAccepted());
                        criminals[i].CantBeDamagedByRelationshipGroup(RelationshipGroup.Special, base.OnCalloutAccepted());
                        criminals[i].ComplianceChance      = Common.GetRandomValue(0, 75);
                        criminals[i].AlwaysDiesOnLowHealth = true;

                        // Make default of the ped's component variation
                        Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", new Parameter[] { criminals[i].GPed });

                        // Add to deletion list and to pursuit
                        Functions.AddToScriptDeletionList(this.criminals[i], this);
                        Functions.AddPedToPursuit(this.pursuit, this.criminals[i]);
                    }
                }

                // Create FIB Squad (x2)
                LVehicle fibCar       = new LVehicle(World.GetNextPositionOnStreet(this.vehicle.Position), "FBI");
                LVehicle fibCar2      = new LVehicle(World.GetNextPositionOnStreet(fibCar.Position.Around((float)10)), "FBI");
                LPed[]   fibPersonnel = new LPed[4]
                {
                    fibCar.CreatePedOnSeat(VehicleSeat.Driver, new CModel(fib_model_int), RelationshipGroup.Cop),
                    fibCar.CreatePedOnSeat(VehicleSeat.RightFront, new CModel(fib_model_int), RelationshipGroup.Cop),
                    fibCar.CreatePedOnSeat(VehicleSeat.LeftRear, new CModel(fib_model_int), RelationshipGroup.Cop),
                    fibCar.CreatePedOnSeat(VehicleSeat.RightRear, new CModel(fib_model_int), RelationshipGroup.Cop),
                };
                LPed[] fibPersonnel2 = new LPed[4]
                {
                    fibCar2.CreatePedOnSeat(VehicleSeat.Driver, new CModel(fib_model_int), RelationshipGroup.Cop),
                    fibCar2.CreatePedOnSeat(VehicleSeat.RightFront, new CModel(fib_model_int), RelationshipGroup.Cop),
                    fibCar2.CreatePedOnSeat(VehicleSeat.LeftRear, new CModel(fib_model_int), RelationshipGroup.Cop),
                    fibCar2.CreatePedOnSeat(VehicleSeat.RightRear, new CModel(fib_model_int), RelationshipGroup.Cop),
                };

                if (fibCar.isObjectValid() && fibCar2.isObjectValid())
                {
                    Functions.AddToScriptDeletionList(fibCar, this);
                    Functions.AddToScriptDeletionList(fibCar2, this);
                    fibCar.PlaceOnNextStreetProperly();
                    fibCar2.PlaceOnNextStreetProperly();
                    fibCar.SirenActive  = true;
                    fibCar2.SirenActive = true;

                    foreach (LPed fib in fibPersonnel)
                    {
                        if (ValidityCheck.isObjectValid(fib))
                        {
                            Functions.AddToScriptDeletionList(fib, this);
                            fib.Weapons.RemoveAll();
                            fib.Weapons.FromType(Weapon.Handgun_Glock).Ammo    = 999;
                            fib.Weapons.FromType(Weapon.TBOGT_AssaultSMG).Ammo = 999;
                            fib.Weapons.FromType(Weapon.Rifle_M4).Ammo         = 999;
                            fib.Weapons.Select(Weapon.Rifle_M4);
                            fib.DefaultWeapon  = Weapon.Rifle_M4;
                            fib.WillDoDrivebys = true;
                        }
                    }

                    foreach (LPed fib in fibPersonnel2)
                    {
                        if (ValidityCheck.isObjectValid(fib))
                        {
                            Functions.AddToScriptDeletionList(fib, this);
                            fib.Weapons.RemoveAll();
                            fib.Weapons.FromType(Weapon.TBOGT_Pistol44).Ammo = 999;
                            fib.Weapons.FromType(Weapon.SMG_MP5).Ammo        = 999;
                            fib.Weapons.FromType(Weapon.Shotgun_Basic).Ammo  = 999;
                            fib.Weapons.Select(Weapon.SMG_MP5);
                            fib.DefaultWeapon  = Weapon.SMG_MP5;
                            fib.WillDoDrivebys = true;
                        }
                    }
                }

                // Since we want other cops to join, set as called in already and also active it for player
                Functions.SetPursuitCalledIn(this.pursuit, true);
                Functions.SetPursuitIsActiveForPlayer(this.pursuit, true);
                Functions.SetPursuitAllowWeaponsForSuspects(this.pursuit, true);
                Functions.SetPursuitForceSuspectsToFight(this.pursuit, true);
                Functions.SetPursuitTactics(this.pursuit, true);

                // Show message to the player
                Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_ROBBERY_CATCH_UP"), 25000);
                Functions.AddTextToTextwall(string.Format(Resources.TEXT_INFO_RELAY_SV_LUIS, criminals[0].PersonaData.FullName, criminals[0].PersonaData.BirthDay),
                                            Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL"));
                isReady = true;
            }
            catch (Exception ex) { Log.Error("OnCalloutAccepted: Cannot create Pursuit instance: " + ex, this); isReady = false; }

            return(isReady);
        }
Beispiel #10
0
        /// <summary>
        /// Gets the Enforcer Armory State for allowing player to rearm his weapons
        /// </summary>
        /// <returns>True if within 3 "single" values (<see cref="System.Single"/>) and the vehicle is a "pure" Enforcer, otherwise false</returns>
        private bool GetEnforcerArmoryState()
        {
            LVehicle closestVehicle = LVehicle.FromGTAVehicle(World.GetClosestVehicle(LPlayer.LocalPlayer.Ped.Position, 3f));

            return(ValidityCheck.isObjectValid(closestVehicle) && closestVehicle.Model.ModelInfo.Hash == Enforcer);
        }
Beispiel #11
0
        /// <summary>
        /// Player is close.
        /// </summary>
        private void PlayerIsClose()
        {
            if (LPlayer.LocalPlayer.Ped.Position.DistanceTo(this.spawnPoint.Position) > 55)
            {
                return;
            }

            this.blip.Delete();

            if (this.IsPrankCall)
            {
                DelayedCaller.Call(
                    delegate
                {
                    // Tell control it was a prank
                    Functions.PlaySound("EMERG_PRANK_CALL", true, false);
                    Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_PRANK_END"), 5000);
                    Functions.AddTextToTextwall(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_PRANK_END_TW"), Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL"));
                    this.End();
                },
                    this,
                    10000);

                this.State = EShootoutState.Prank;
            }
            else
            {
                bool playerHasBeenSpotted = false;
                bool randomFight          = Common.GetRandomBool(0, 300, 1);

                // Check whether player has been spotted
                foreach (LPed criminal in this.criminals)
                {
                    if (ValidityCheck.isObjectValid(criminal))
                    {
                        if (criminal.HasSpottedPed(LPlayer.LocalPlayer.Ped, false))
                        {
                            playerHasBeenSpotted = true;
                            break;
                        }
                    }
                }

                // If player has been spotted
                if (playerHasBeenSpotted || randomFight)
                {
                    this.State = EShootoutState.Fighting;
                    this.Engage();

                    Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_FIGHT_SUSPECTS"), 5000);

                    if (LPlayer.LocalPlayer.Model == new Model("M_Y_COP") || LPlayer.LocalPlayer.Model == new Model("M_M_FATCOP_01") || LPlayer.LocalPlayer.Model == new Model("M_Y_STROOPER") || LPlayer.LocalPlayer.Model == new Model("M_Y_COP_TRAFFIC"))
                    {
                        LPlayer.LocalPlayer.Ped.SayAmbientSpeech("SPOT_SUSPECT");
                    }
                    else if (LPlayer.LocalPlayer.Model == new Model("M_Y_SWAT") || LPlayer.LocalPlayer.Model == new Model("M_M_FBI"))
                    {
                        LPlayer.LocalPlayer.Ped.SayAmbientSpeech("DRAW_GUN");
                    }
                    else
                    {
                        LPlayer.LocalPlayer.Ped.SayAmbientSpeech("TARGET");
                    }
                }
            }
        }
Beispiel #12
0
        /// <summary>
        /// Called when the callout has been accepted. Call base to set state to Running.
        /// </summary>
        /// <returns>
        /// True if callout was setup properly, false if it failed. Calls <see cref="End"/> when failed.
        /// </returns>
        public override bool OnCalloutAccepted()
        {
            bool isReady = base.OnCalloutAccepted();

            this.pursuit = Functions.CreatePursuit();
            Functions.SetPursuitCopsCanJoin(this.pursuit, false);
            Functions.SetPursuitDontEnableCopBlips(this.pursuit, true);

            // Add blip
            this.blip             = Functions.CreateBlipForArea(this.spawnPoint.Position, 30f);
            this.blip.Display     = BlipDisplay.ArrowAndMap;
            this.blip.RouteActive = true;

            // Decide whether prank call or not
            if (Common.GetRandomBool(0, 5, 1))
            {
                Log.Debug("OnCalloutAccepted: Is prank", this);
                this.SetAsPrankCall();
            }
            else
            {
                try
                {
                    this.criminals = new List <LPed>();

                    int random = Common.GetRandomValue(6, 13);
                    for (int i = 0; i < random; i++)
                    {
                        LPed criminal = new LPed(this.spawnPoint.Position, Common.GetRandomCollectionValue <string>(this.criminalModels), LPed.EPedGroup.Criminal);
                        if (ValidityCheck.isObjectValid(criminal))
                        {
                            // Ensure ped is not in a building
                            if (criminal.EnsurePedIsNotInBuilding(criminal.Position))
                            {
                                Functions.AddToScriptDeletionList(criminal, this);
                                Functions.SetPedIsOwnedByScript(criminal, this, true);
                                criminal.RelationshipGroup = RelationshipGroup.Gang_Biker2;
                                criminal.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion);
                                criminal.ChangeRelationship(RelationshipGroup.Gang_Italian, Relationship.Hate);
                                criminal.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate);
                                criminal.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, true);

                                // We don't want the criminal to flee yet
                                criminal.DisablePursuitAI = true;

                                // Set up weapons
                                criminal.Weapons.RemoveAll();
                                criminal.Weapons.FromType(Weapon.Handgun_Glock).Ammo = 999;
                                criminal.Weapons.FromType(Weapon.Shotgun_Basic).Ammo = 120;
                                criminal.Weapons.FromType(Weapon.Melee_Knife);
                                criminal.Weapons.FromType(Weapon.Thrown_Molotov).Ammo = 2;
                                criminal.Weapons.Select(Weapon.Thrown_Molotov);
                                criminal.DefaultWeapon = Weapon.Shotgun_Basic;

                                criminal.ComplianceChance = Common.GetRandomValue(25, 75);

                                Functions.AddPedToPursuit(this.pursuit, criminal);
                                this.criminals.Add(criminal);
                            }
                            else
                            {
                                Log.Debug("OnCalloutAccepted: Failed to place ped properly outside of building", this);
                                criminal.Delete();
                            }
                        }
                    }

                    if (this.criminals.Count == 0)
                    {
                        isReady = false;
                    }
                    else
                    {
                        // Create Johnny
                        johnny                   = new LPed(this.spawnPoint.Position.Around((float)10), "IG_JOHNNYBIKER", LPed.EPedGroup.MissionPed);
                        johnny.PersonaData       = new PersonaData(new DateTime(1974, 3, 17, 8, 30, 0, DateTimeKind.Utc), 13, "Johnny", "Klebitz", true, 9, true);
                        johnny.RelationshipGroup = RelationshipGroup.Special;
                        johnny.ChangeRelationship(RelationshipGroup.Special, Relationship.Companion);
                        johnny.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion);
                        johnny.ChangeRelationship(RelationshipGroup.Gang_Italian, Relationship.Hate);
                        johnny.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate);
                        johnny.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, true);
                        johnny.CantBeDamagedByRelationshipGroup(RelationshipGroup.Special, true);
                        johnny.BecomeMissionCharacter();

                        // Place near any criminal ped if he's in a building
                        if (!johnny.EnsurePedIsNotInBuilding(johnny.Position))
                        {
                            johnny.Position = criminals[Common.GetRandomValue(0, criminals.Count - 1)].Position + new Vector3(1.0f, 1.5f, 0);
                        }

                        // We don't want the criminal to flee yet
                        johnny.DisablePursuitAI = true;

                        // Set up weapons
                        johnny.Weapons.RemoveAll();
                        johnny.Weapons.DesertEagle.Ammo       = 999;
                        johnny.Weapons.AssaultRifle_AK47.Ammo = 300;
                        johnny.Weapons.Knife.Ammo             = 1;
                        johnny.Weapons.AssaultRifle_AK47.Select();
                        johnny.DefaultWeapon    = Weapon.Rifle_AK47;
                        johnny.ComplianceChance = Common.GetRandomValue(0, 30);

                        // Make default of the ped's component variation
                        Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", new Parameter[] { johnny.GPed });

                        Functions.AddPedToPursuit(this.pursuit, johnny);
                        this.criminals.Add(johnny);
                    }

                    // Chance to spawn another bunch of suspects fighting each other
                    if (Common.GetRandomBool(0, 2, 1))
                    {
                        random = Common.GetRandomValue(7, 15);
                        for (int i = 0; i < random; i++)
                        {
                            LPed criminal = new LPed(this.spawnPoint.Position, Common.GetRandomCollectionValue <string>(this.mafiaModels), LPed.EPedGroup.Criminal);
                            if (ValidityCheck.isObjectValid(criminal))
                            {
                                Functions.AddToScriptDeletionList(criminal, this);
                                Functions.SetPedIsOwnedByScript(criminal, this, true);
                                criminal.RelationshipGroup = RelationshipGroup.Gang_Italian;
                                criminal.ChangeRelationship(RelationshipGroup.Gang_Italian, Relationship.Companion);
                                criminal.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate);
                                criminal.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate);
                                criminal.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Italian, true);

                                // We don't want the criminal to flee yet
                                criminal.DisablePursuitAI = true;

                                criminal.Weapons.RemoveAll();
                                criminal.Weapons.Glock.Ammo = 999;
                                criminal.Weapons.Uzi.Ammo   = 999;
                                criminal.Weapons.Knife.Ammo = 1;
                                if (Common.GetRandomBool(0, 50, 1))
                                {
                                    criminal.Weapons.Uzi.Select();
                                    criminal.DefaultWeapon = Weapon.SMG_Uzi;
                                }
                                else
                                {
                                    criminal.Weapons.AssaultRifle_M4.Ammo = 999;
                                    criminal.Weapons.AssaultRifle_M4.Select();
                                    criminal.DefaultWeapon = Weapon.Rifle_M4;
                                }

                                Functions.AddPedToPursuit(this.pursuit, criminal);
                                this.criminals.Add(criminal);
                            }
                        }

                        // Chance to start fighting immediately
                        if (Common.GetRandomBool(0, 2, 1))
                        {
                            this.State = EShootoutState.Fighting;
                            this.Engage();

                            // Request one backup unit automatically
                            Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position);
                            Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position);
                            Functions.PlaySoundUsingPosition("DFROM_DISPATCH_3_UNITS_FROM POSITION FOR CRIM_A_DOMESTIC_DISTURBANCE", LPlayer.LocalPlayer.Ped.Position);
                        }
                    }
                    isReady = true;
                }
                catch (Exception ex) { Log.Error("OnCalloutAccepted: Cannot create Pursuit instance: " + ex, this); isReady = false; }
            }

            // Add states
            if (isReady)
            {
                this.RegisterStateCallback(EShootoutState.WaitingForPlayer, this.WaitingForPlayer);
                this.RegisterStateCallback(EShootoutState.PlayerIsClose, this.PlayerIsClose);
                this.RegisterStateCallback(EShootoutState.InCombat, this.InCombat);
                this.RegisterStateCallback(EShootoutState.Fighting, this.InCombat);
                this.RegisterStateCallback(EShootoutState.Prank, this.Prank);
                this.State = EShootoutState.WaitingForPlayer;
                if (!this.IsPrankCall)
                {
                    Functions.AddTextToTextwall(string.Format(Resources.TEXT_INFO_RELAY_SV_JOHNNY, johnny.PersonaData.FullName, johnny.PersonaData.BirthDay),
                                                Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL"));
                }
                else
                {
                    DelayedCaller.Call(delegate
                    {
                        Functions.AddTextToTextwall(Resources.TEXT_INFO_RELAY_SV_JOHNNY_PRANK, Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL"));
                        // Request one backup unit automatically
                        Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position);
                        Functions.PlaySoundUsingPosition("DFROM_DISPATCH_2_UNITS_FROM POSITION", LPlayer.LocalPlayer.Ped.Position);
                    }, this, Common.GetRandomValue(3000, 6001));
                }
                Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_GET_TO_CRIME_SCENE"), 8000);
            }

            return(isReady);
        }
Beispiel #13
0
    private bool addToQueue(int addr, int p1, int p2, int p3, int p4, bool priority, bool user_draw, ValidityCheck obj, String logString)
    {
        Item item = new Item();

        item.addr           = addr;
        item.p1             = p1;
        item.p2             = p2;
        item.p3             = p3;
        item.p4             = p4;
        item.user_draw      = user_draw;
        item.validity_check = obj;
        item.logString      = logString;

        lock (lockQueues)
        {
            if (!should_quit)
            {
                if (user_draw)
                {
                    userDrawCount++;
                }

                if (priority)
                {
                    if (!priorityQueue.Contains(item))
                    {
                        /*
                         * if (priorityQueue.Count > 10)
                         * {
                         *  Logger.log("UIWorker priorityQueue overflow: " + priorityQueue.Count +
                         *    " cur_addr:" + cur_item.addr + " addr:" + addr + " p1:" + p1 + " p2:" + p2 + " p3:" + p3 + " p4:" + p4);
                         * }
                         */

                        priorityQueue.Enqueue(item);
                    }
                }
                else
                {
                    if (!queue.Contains(item))
                    {
                        /*
                         * if (queue.Count > 10)
                         * {
                         *  Logger.log("UIWorker queue overflow: " + queue.Count +
                         *           " cur_addr:" + cur_item.addr +
                         *           " addr:" + addr + " p1:" + p1 + " p2:" + p2 + " p3:" + p3 + " p4:" + p4);
                         * }*/
                        queue.Enqueue(item);
                    }
                }

                if (isWaiting)
                {
                    Monitor.Pulse(lockQueues);
                }

                return(true);
            }

            return(false);
        }
    }
Beispiel #14
0
 public static void addUIEventValid(int addr, int p1, int p2, int p3, int p4, bool priority, ValidityCheck obj)
 {
     uiWorker.addToQueue(addr, p1, p2, p3, p4, priority, false, obj, null);
 }
Beispiel #15
0
 public static void addUIEventValid(int addr, int p1, int p2, int p3, int p4, bool priority, ValidityCheck obj)
 {
     uiWorker.addToQueue(addr, p1, p2, p3, p4, priority, false, obj, null);
 }
Beispiel #16
0
    private bool addToQueue(int addr, int p1, int p2, int p3, int p4, bool priority, bool user_draw, ValidityCheck obj, String logString)
    {
        Item item = new Item();
            item.addr = addr;
            item.p1 = p1;
            item.p2 = p2;
            item.p3 = p3;
            item.p4 = p4;
            item.user_draw = user_draw;
            item.validity_check = obj;
            item.logString = logString;

            lock (lockQueues)
            {
                if (!should_quit)
                {
                    if (user_draw)
                    {
                        userDrawCount++;
                    }

                    if (priority)
                    {
                        if (!priorityQueue.Contains(item))
                        {
                            /*
                            if (priorityQueue.Count > 10)
                            {
                                Logger.log("UIWorker priorityQueue overflow: " + priorityQueue.Count +
                                  " cur_addr:" + cur_item.addr + " addr:" + addr + " p1:" + p1 + " p2:" + p2 + " p3:" + p3 + " p4:" + p4);
                            }
                             */

                            priorityQueue.Enqueue(item);
                        }
                    }
                    else
                    {
                        if (!queue.Contains(item))
                        {
                            /*
                            if (queue.Count > 10)
                            {
                                Logger.log("UIWorker queue overflow: " + queue.Count +
                                         " cur_addr:" + cur_item.addr +
                                         " addr:" + addr + " p1:" + p1 + " p2:" + p2 + " p3:" + p3 + " p4:" + p4);
                            }*/
                            queue.Enqueue(item);
                        }
                    }

                    if (isWaiting)
                    {
                        Monitor.Pulse(lockQueues);
                    }

                    return true;
                }

                return false;
            }
    }
Beispiel #17
0
        /// <summary>
        /// Called when the callout has been accepted. Call base to set state to Running.
        /// </summary>
        /// <returns>
        /// True if callout was setup properly, false if it failed. Calls <see cref="End"/> when failed.
        /// </returns>
        public override bool OnCalloutAccepted()
        {
            bool pursuitReady = base.OnCalloutAccepted();

            try
            {
                // Create pursuit instance
                this.pursuit = Functions.CreatePursuit();

                // Create
                this.vehicle = new LVehicle(World.GetNextPositionOnStreet(this.spawnPosition), Common.GetRandomCollectionValue <string>(this.vehicleModels));
                //if (this.vehicle.Exists())
                if (ValidityCheck.isObjectValid(this.vehicle))
                {
                    // Ensure vehicle is freed on end
                    Functions.AddToScriptDeletionList(this.vehicle, this);
                    this.vehicle.PlaceOnNextStreetProperly();
                    //this.vehicle.EngineRunning = this.vehicle.Exists();
                    this.vehicle.EngineRunning = ValidityCheck.isObjectValid(this.vehicle);

                    int peds = Common.GetRandomValue(1, 4);

                    // Create suspects
                    this.terrorists = new LPed[peds];
                    for (int i = 0; i < this.terrorists.Length; i++)
                    {
                        // Spawn ped
                        this.terrorists[i] = new LPed(World.GetNextPositionOnStreet(this.vehicle.Position), Common.GetRandomCollectionValue <string>(this.criminalModels), LPed.EPedGroup.Criminal);
                        //if (this.terrorists[i].Exists())
                        if (ValidityCheck.isObjectValid(this.terrorists[i]))
                        {
                            // If vehicle doesn't have a driver yet, warp terrorist as driver
                            if (!this.vehicle.HasDriver)
                            {
                                this.terrorists[i].WarpIntoVehicle(this.vehicle, VehicleSeat.Driver);
                            }
                            else
                            {
                                this.terrorists[i].WarpIntoVehicle(this.vehicle, VehicleSeat.AnyPassengerSeat);
                                this.terrorists[i].WillDoDrivebys = true;
                            }

                            // Make ignore all events and give specified weapons
                            this.terrorists[i].BlockPermanentEvents = true;
                            this.terrorists[i].Task.AlwaysKeepTask  = true;
                            this.terrorists[i].EquipWeapon();

                            this.terrorists[i].Weapons.RemoveAll();
                            bool acquireRPG = Common.GetRandomBool(0, 7, 1);
                            if (acquireRPG)
                            {
                                // 1 by 6 chance a terrorist gets a rocket launcher
                                this.terrorists[i].Weapons.FromType(Weapon.Handgun_Glock).Ammo        = 999;
                                this.terrorists[i].Weapons.FromType(Weapon.Heavy_RocketLauncher).Ammo = 15;
                                this.terrorists[i].Weapons.Select(Weapon.Heavy_RocketLauncher);
                                Functions.AddTextToTextwall("Be advised, one of the suspects are carrying a rocket launcher. Caution is advised.",
                                                            Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL"));
                            }
                            else
                            {
                                // If false, AK-47 is used
                                this.terrorists[i].Weapons.FromType(Weapon.Rifle_AK47).Ammo    = 2 ^ 13;
                                this.terrorists[i].Weapons.FromType(Weapon.Handgun_Glock).Ammo = 999;
                                this.terrorists[i].Weapons.Select(Weapon.Rifle_AK47);
                            }

                            // Add to deletion list and to pursuit
                            Functions.AddToScriptDeletionList(this.terrorists[i], this);
                            Functions.AddPedToPursuit(this.pursuit, this.terrorists[i]);
                        }
                    }
                    this.vehicle.Speed = (float)Common.GetRandomValue(20, 45);

                    // Create NOOSE personnel in a fast NOOSE car
                    LVehicle copCar = new LVehicle(World.GetNextPositionOnStreet(this.vehicle.Position), Common.GetRandomCollectionValue <string>(this.fastNooseVehicles));
                    if (copCar.Exists())
                    {
                        Functions.AddToScriptDeletionList(copCar, this);
                        copCar.PlaceOnNextStreetProperly();

                        LPed[] Nooses =
                        {
                            copCar.CreatePedOnSeat(VehicleSeat.Driver,     new CModel(new Model("M_Y_SWAT")), RelationshipGroup.Cop),
                            copCar.CreatePedOnSeat(VehicleSeat.RightFront, new CModel(new Model("M_Y_SWAT")), RelationshipGroup.Cop),
                            copCar.CreatePedOnSeat(VehicleSeat.LeftRear,   new CModel(new Model("M_Y_SWAT")), RelationshipGroup.Cop),
                            copCar.CreatePedOnSeat(VehicleSeat.RightRear,  new CModel(new Model("M_Y_SWAT")), RelationshipGroup.Cop)
                        };

                        for (int i = 0; i < Nooses.Length; i++)
                        {
                            //if (Nooses[i] != null && Nooses[i].Exists())
                            if (ValidityCheck.isObjectValid(Nooses[i]))
                            {
                                Functions.AddToScriptDeletionList(Nooses[i], this);
                                copCar.SirenActive = true;
                            }
                        }
                        copCar.Speed         = (float)Common.GetRandomValue(10, 45);
                        copCar.EngineRunning = copCar.Exists();
                    }

                    // Since we want other cops to join, set as called in already and also active it for player
                    Functions.SetPursuitCalledIn(this.pursuit, true);
                    Functions.SetPursuitIsActiveForPlayer(this.pursuit, true);
                    Functions.SetPursuitForceSuspectsToFight(this.pursuit, true);

                    // Show message to the player
                    Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_ROBBERY_CATCH_UP"), 25000);
                }
                pursuitReady = true;
            }
            catch (Exception ex) { Log.Error("Cannot create Pursuit instance: " + ex, this); pursuitReady = false; }
            return(pursuitReady);
        }