예제 #1
0
 public static void Main()
 {
     GameFiber.StartNew(delegate
     {
         try
         {
             Vehicle vehicleToCheck = Game.LocalPlayer.Character.IsInAnyVehicle(false) ? InCar() : OnFoot();
             if (vehicleToCheck.Exists())
             {
                 if (vehicleToCheck.IsTrailer)
                 {
                     vehicleToCheck = ((Vehicle[])World.GetEntities(vehicleToCheck.GetOffsetPositionFront(5), 15, GetEntitiesFlags.ConsiderAllVehicles | GetEntitiesFlags.ExcludePlayerVehicle)).
                                      FirstOrDefault(x => x.HasTrailer && x.Trailer == vehicleToCheck);
                     if (!vehicleToCheck)
                     {
                         return;
                     }
                 }
                 vehCurrentlyBeingChecked = vehicleToCheck;
                 PlateChecker checker;
                 if (AllVehiclesChecked.ContainsKey(vehicleToCheck))
                 {
                     checker = AllVehiclesChecked[vehicleToCheck];
                 }
                 else
                 {
                     checker = new PlateChecker(vehicleToCheck);
                 }
                 Game.DisplayNotification("~b~" + PoliceSmartRadio.PlayerName + ": ~s~Dispatch, can you do a plate check for me? It's " + checker.modelArticle + " ~b~" + checker.vehModel + "~s~, plate ~b~" + checker.LicencePlate + ".");
                 GameFiber.Wait(2000);
                 Game.DisplayNotification("~b~Dispatch: ~s~Copy that, stand by for the plate check...");
                 GameFiber.Wait(4000);
                 GameFiber.StartNew(checker.PlayAudio);
                 GameFiber.Wait(500);
                 if (PoliceSmartRadio.IsLSPDFRPluginRunning("British Policing Script", new Version("0.8.0.0")) && vehicleToCheck.Exists())
                 {
                     API.BritishPolicingScriptFunctions.RunLicencePlateCheck(vehicleToCheck);
                 }
                 else
                 {
                     Game.DisplayNotification("~b~Dispatch: ~s~" + PoliceSmartRadio.PlayerName + ", plate check: ~n~~b~Plate: " + checker.LicencePlate + "~n~Model: " + checker.vehModel
                                              + "~n~Reg. Year: " + checker.vehicleYear + "~n~Registered Owner: ~y~" + checker.DriverPersona.FullName + "~b~~n~Citations: " + checker.DriverPersona.Citations);
                     GameFiber.Wait(2000);
                     GameFiber.Wait(2000);
                     Game.DisplayNotification(checker.Flags);
                 }
                 if (vehCurrentlyBeingChecked == vehicleToCheck)
                 {
                     vehCurrentlyBeingChecked = null;
                 }
             }
         }
         catch (Exception e)
         {
             Game.LogTrivial(e.ToString());
             Game.DisplayNotification("Whoops! Police SmartRadio plate check encountered an error. Please send your RAGEPluginHook.log file to the author (Albo1125).");
             Game.LogTrivial("PoliceSmartRadio handled the PlateCheck exception.");
         }
     });
 }
예제 #2
0
        public static void Main()
        {
            Ped p = GetNearestValidPed();

            if (p.Exists())
            {
                Persona pers = Functions.GetPersonaForPed(p);
                Game.DisplayNotification("~b~" + PoliceSmartRadio.PlayerName + "~s~: Dispatch, could you run a person check through for me? It's ~b~" + pers.FullName + "~s~, born on ~b~" + pers.Birthday.ToShortDateString() + "~s~.");
                if (PoliceSmartRadio.IsLSPDFRPluginRunning("British Policing Script", new Version("0.8.2.0")))
                {
                    API.BritishPolicingScriptFunctions.RunPedCheck(p, 4000);
                }
                else
                {
                    displayRecords(pers);
                }
            }
        }
예제 #3
0
        public PlateChecker(Vehicle vehicleToCheck)
        {
            if (vehicleToCheck.Exists())
            {
                string Flags = "";
                if (vehicleToCheck.IsStolen)
                {
                    Flags        += "STOLEN ";
                    DriverPersona = LSPD_First_Response.Mod.API.Functions.GetPersonaForPed(World.GetAllPeds()[0]);
                    //determine persona to use
                    if (vehicleToCheck.HasDriver && vehicleToCheck.Driver.Exists())
                    {
                        if (LSPD_First_Response.Mod.API.Functions.GetPersonaForPed(vehicleToCheck.Driver).FullName.ToLower() == Functions.GetVehicleOwnerName(vehicleToCheck).ToLower())
                        {
                            DriverPersona = Functions.GetPersonaForPed(World.GetAllPeds()[0]);
                        }
                        else
                        {
                            foreach (Ped p in World.EnumeratePeds())
                            {
                                if (Functions.GetPersonaForPed(p).FullName.ToLower() == Functions.GetVehicleOwnerName(vehicleToCheck).ToLower())
                                {
                                    DriverPersona = Functions.GetPersonaForPed(p);
                                    break;
                                }
                            }
                        }
                    }
                    if (DriverPersona == null)
                    {
                        //create new persona
                        Persona tempPers = Functions.GetPersonaForPed(World.GetAllPeds()[0]);
                        //DriverPersona = new Persona(World.GetAllPeds()[0], tempPers.Gender, tempPers.BirthDay, tempPers.Citations, tempPers.Forename, tempPers.Surname, tempPers.LicenseState, tempPers.TimesStopped, tempPers.Wanted, tempPers.IsAgent, tempPers.IsCop);
                    }
                    AudioFlags.Add("Stolen");
                }
                else
                {
                    //determine persona to use
                    if (vehicleToCheck.HasDriver && vehicleToCheck.Driver.Exists())
                    {
                        if (LSPD_First_Response.Mod.API.Functions.GetPersonaForPed(vehicleToCheck.Driver).FullName.ToLower() == Functions.GetVehicleOwnerName(vehicleToCheck).ToLower())
                        {
                            DriverPersona = LSPD_First_Response.Mod.API.Functions.GetPersonaForPed(vehicleToCheck.Driver);
                        }
                        else
                        {
                            foreach (Ped p in World.EnumeratePeds())
                            {
                                if (Functions.GetPersonaForPed(p).FullName.ToLower() == Functions.GetVehicleOwnerName(vehicleToCheck).ToLower())
                                {
                                    DriverPersona = Functions.GetPersonaForPed(p);
                                    break;
                                }
                            }
                        }
                    }
                    if (DriverPersona == null)
                    {
                        DriverPersona = PersonaHelper.GenerateNewPersona();
                    }
                    //DriverPersona = vehicleToCheck.HasDriver && Albo1125.Common.CommonLibrary.CommonVariables.rnd.Next(100) < 80 ? LSPD_First_Response.Mod.API.Functions.GetPersonaForPed(vehicleToCheck.Driver) : LSPD_First_Response.Mod.API.Functions.GetPersonaForPed(World.GetAllPeds()[0]);
                }
                LSPD_First_Response.Mod.API.Functions.SetVehicleOwnerName(vehicleToCheck, DriverPersona.FullName);
                //determine flags on the vehicle
                if (!PoliceSmartRadio.IsLSPDFRPluginRunning("British Policing Script", new Version("0.9.0.0")))
                {
                    if (Traffic_Policer.API.Functions.GetVehicleRegistrationStatus(vehicleToCheck) == Traffic_Policer.EVehicleDetailsStatus.Expired)
                    {
                        Flags += "EXPIRED REGISTRATION ";
                        AudioFlags.Add("TrafficViolation");
                    }
                    else if (Traffic_Policer.API.Functions.GetVehicleRegistrationStatus(vehicleToCheck) == Traffic_Policer.EVehicleDetailsStatus.None)
                    {
                        Flags += "NO REGISTRATION ";
                        AudioFlags.Add("TrafficViolation");
                    }

                    if (Traffic_Policer.API.Functions.GetVehicleInsuranceStatus(vehicleToCheck) == Traffic_Policer.EVehicleDetailsStatus.Expired)
                    {
                        Flags += "EXPIRED INSURANCE ";
                        AudioFlags.Add("TrafficViolation");
                    }
                    else if (Traffic_Policer.API.Functions.GetVehicleInsuranceStatus(vehicleToCheck) == Traffic_Policer.EVehicleDetailsStatus.None)
                    {
                        Flags += "NO INSURANCE ";
                        AudioFlags.Add("TrafficViolation");
                    }

                    if (DriverPersona.Wanted)
                    {
                        AudioFlags.Add("Warrant");
                        if (rnd.Next(100) < 75)
                        {
                            Flags += "FELONY WARRANT FOR REGISTERED OWNER ";
                        }
                        else
                        {
                            Flags += "BENCH WARRANT FOR REGISTERED OWNER ";
                        }
                    }

                    if (DriverPersona.ELicenseState == ELicenseState.Suspended)
                    {
                        Flags += "OWNER'S LICENCE SUSPENDED ";
                        AudioFlags.Add("TrafficFelony");
                    }
                    else if (DriverPersona.ELicenseState == ELicenseState.Expired)
                    {
                        Flags += "OWNER'S LICENCE EXPIRED ";
                        AudioFlags.Add("TrafficViolation");
                    }
                    else if (DriverPersona.ELicenseState == ELicenseState.None)
                    {
                        Flags += "OWNER'S LICENCE INVALID ";
                        AudioFlags.Add("TrafficViolation");
                    }

                    if (DriverPersona.Birthday.Date == DateTime.Now.Date)
                    {
                        Flags += "~g~OWNER'S BIRTHDAY ";
                    }

                    if (string.IsNullOrWhiteSpace(Flags))
                    {
                        AudioFlags.Add("No1099");
                        this.Flags += "~g~NONE";
                    }
                    else
                    {
                        AudioFlags.Add("ProceedCaution");
                        this.Flags += Flags;
                    }
                }

                //read in strings from the vehicle information
                LicencePlate = vehicleToCheck.LicensePlate;

                vehModel = vehicleToCheck.Model.Name.ToLower();
                vehModel = char.ToUpper(vehModel[0]) + vehModel.Substring(1);
                if (vowels.Contains(vehModel.ToLower()[0]))
                {
                    modelArticle = "an";
                }
                else
                {
                    modelArticle = "a";
                }
                vehicleYear = vehYears.PickRandom();
                AllVehiclesChecked.Add(vehicleToCheck, this);
            }
        }