/// <summary> /// If callout is running delete events for better experience and performances /// </summary> protected void HandleSafeEventRunning() { if (FunctionsLSPDFR.IsCalloutRunning()) { this.IsEventRunning = false; } }
public static uint DeclareSubjectStatus(Ped ped) { string status; string radioStatus; if (!ped.Exists()) { status = "<font color=\"red\">escaped</font>"; radioStatus = "SUSPECT_LAST_SEEN IN_OR_ON_POSITION ATTEMPT_FIND"; } else if (Integreate.StopThePed && ped.IsDead && ArrestedBySTP.Contains(ped)) { status = "<font color=\"lime\">in custody</font>"; radioStatus = "SUSPECT_APPREHENDED"; } else if (ped.IsDead) { status = "<font color=\"lime\">down</font>"; radioStatus = "PASSIFIED"; } else if (Functions.IsPedArrested(ped)) { status = "<font color=\"lime\">in custody</font>"; radioStatus = "SUSPECT_APPREHENDED"; } else { status = "<font color=\"blueviolet\">innocent</font>"; radioStatus = ""; } Functions.PlayScannerAudioUsingPosition("ATTENTION_ALL_UNITS " + radioStatus + " NO_ADDITIONAL_SUPPORT", Game.LocalPlayer.Character.Position); return(ScannerHelper.DisplayDispatchDialogue("Dispatch", "Code 4, suspect is " + status)); }
public virtual void OnEndEvent() { Logger.LogTrivial("Request Garbage mobile phone event"); this.IsEventRunning = false; if (this.Blip.IsValid() && this.Blip.Exists()) { this.Blip.Delete(); } if (false == FunctionsLSPDFR.IsPlayerPerformingPullover() && false == this.IsPerformedPullOver) { bool isPedNotInPursuit = false == PedsManager.isPedInPursuit(this.Driver); if (this.Driver.Exists() && isPedNotInPursuit) { this.Driver.Dismiss(); } if (this.Vehicle.Exists() && isPedNotInPursuit) { this.Vehicle.Dismiss(); } Logger.LogTrivial("Ending Garbage mobile phone event"); } OffencesManager.Instance.HandleEndEventOffence(this); }
public static bool IsDeadOrDetained(this Ped ped) { if (Functions.IsPedArrested(ped)) { return(true); } return(Integreate.StopThePed && ped.IsDead && ArrestedBySTP.Contains(ped)); }
protected bool IsPulledOverDriver() { if (FunctionsLSPDFR.IsPlayerPerformingPullover()) { Ped currentSuspect = FunctionsLSPDFR.GetPulloverSuspect(FunctionsLSPDFR.GetCurrentPullover()); return(currentSuspect == this.Driver); } return(false); }
internal static Assembly Resolve(object sender, ResolveEventArgs args) { foreach (Assembly assembly in Functions.GetAllUserPlugins()) { if (args.Name.ToLower().Contains(assembly.GetName().Name.ToLower())) { return(assembly); } } return(null); }
public void OnSetCustomLocation() { CustomPulloverEventHandler.IsAlreadyFollowing = true; Logger.Log("Set Pullover"); try { if (false == FunctionsLSPDFR.IsPlayerPerformingPullover() || false == PedsManager.LocalPlayer().IsInAnyVehicle(false)) { Logger.Log("Cancelled"); CustomPulloverEventHandler.IsAlreadyFollowing = false; return; } Vehicle playerPatrolCar = PedsManager.LocalPlayer().CurrentVehicle; Vehicle pulledCar = (Vehicle)World.GetClosestEntity(playerPatrolCar.GetOffsetPosition(Vector3.RelativeFront * 8f), 8f, (GetEntitiesFlags.ConsiderGroundVehicles | GetEntitiesFlags.ConsiderBoats | GetEntitiesFlags.ExcludeEmptyVehicles | GetEntitiesFlags.ExcludeEmergencyVehicles)); if (null == pulledCar || (false == pulledCar.IsValid() || (pulledCar == playerPatrolCar))) { Logger.Log("No car or no valid car"); CustomPulloverEventHandler.IsAlreadyFollowing = false; return; } if (pulledCar.Speed > 0.2f) { Game.DisplayNotification("The vehicle must be stopped before you can do this."); CustomPulloverEventHandler.IsAlreadyFollowing = false; return; } Ped pulledDriver = pulledCar.Driver; pulledDriver.IsPersistent = true; if (!pulledDriver.IsPersistent || FunctionsLSPDFR.GetPulloverSuspect(FunctionsLSPDFR.GetCurrentPullover()) != pulledDriver) { Logger.Log("Not persistent"); CustomPulloverEventHandler.IsAlreadyFollowing = false; return; } CustomPulloverEvent customPulloverEvent = new CustomPulloverEvent(pulledCar, pulledDriver); this.OnEventHandler(customPulloverEvent); } catch (Exception e) { Game.LogTrivial("---------- EXCEPTION ---------"); Game.LogTrivial(e.Message); Game.LogTrivial("---------- END ---------"); } finally { CustomPulloverEventHandler.IsAlreadyFollowing = false; } }
internal static bool IsPluginRunning(string plugin, Version minimal = null) { foreach (Assembly assembly in Functions.GetAllUserPlugins()) { AssemblyName an = assembly.GetName(); if (an.Name.ToLower() == plugin.ToLower()) { if (minimal == null || an.Version.CompareTo(minimal) >= 0) { return(true); } } } return(false); }
public override bool OnBeforeCalloutDisplayed() { spawn = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(200f)); ShowCalloutAreaBlipBeforeAccepting(spawn, 30f); AddMinimumDistanceCheck(20f, spawn); situation = (EDocumentLackSituation)MathHelper.GetRandomInteger(0, 1); CalloutMessage = situation == EDocumentLackSituation.Insurance ? "Uninsured Vehicle" : "Unregistered Vehicle"; CalloutPosition = spawn; Functions.PlayScannerAudioUsingPosition("CITIZENS_REPORT CRIME_DANGEROUS_DRIVING IN_OR_ON_POSITION", spawn); return(base.OnBeforeCalloutDisplayed()); }
public static void GiveParkingTicket(GiveParkingTicketEvent parkingTicketEvent) { Vehicle vehicle = parkingTicketEvent.Vehicle; string modelName = vehicle.Model.Name.ToLower(); string licencePlate = vehicle.LicensePlate; string lexemArticle = ParkingTicketsEventHandler.Vowels.Contains <string>(modelName[0].ToString()) ? "an" : "a"; string licencePlateAudioMessage = ""; if (ParkingTicketsEventHandler.Numbers.Contains <string>(modelName.Last().ToString())) { modelName = modelName.Substring(0, modelName.Length - 1); } modelName = char.ToUpper(modelName[0]) + modelName.Substring(1); foreach (char character in licencePlate) { if (!Char.IsWhiteSpace(character)) { licencePlateAudioMessage = licencePlateAudioMessage + " " + character; } } ParkingTicketsEventHandler.Infos.Enabled = true; ParkingTicketsEventHandler.Infos.Text = "Vehicle " + modelName + " (" + licencePlate + ")"; ParkingTicketsEventHandler.Infos.Enabled = false; Game.DisplayNotification("~g~Traffic Officer ~s~is reporting an ~r~illegally parked vehicle."); Game.DisplayNotification("~b~Processing a parking ticket (" + parkingTicketEvent.Amount + ") for " + lexemArticle + " ~r~" + modelName + "~b~ with licence plate: ~r~" + licencePlate + "."); Game.DisplayNotification("~b~The offending ~r~" + modelName + " ~b~is parked on ~o~" + World.GetStreetName(vehicle.Position) + "."); PedsManager.LocalPlayer().Inventory.GiveNewWeapon(new WeaponAsset("WEAPON_UNARMED"), 0, true); Rage.Object notepad = new Rage.Object("prop_notepad_02", PedsManager.LocalPlayer().Position); int boneIndex = NativeFunction.Natives.GET_PED_BONE_INDEX <int>(PedsManager.LocalPlayer(), (int)PedBoneId.LeftThumb2); NativeFunction.Natives.ATTACH_ENTITY_TO_ENTITY(notepad, PedsManager.LocalPlayer(), boneIndex, 0f, 0f, 0f, 0f, 0f, 0f, true, false, false, false, 2, 1); PedsManager.LocalPlayer().Tasks.PlayAnimation("veh@busted_std", "issue_ticket_cop", 1f, AnimationFlags.Loop | AnimationFlags.UpperBodyOnly).WaitForCompletion(8000); notepad.Delete(); vehicle.IsPersistent = false; PedsManager.LocalPlayer().Tasks.PlayAnimation("random@arrests", "generic_radio_enter", 0.7f, AnimationFlags.UpperBodyOnly | AnimationFlags.StayInEndFrame).WaitForCompletion(1500); GameFiber.Sleep(2000); FunctionsLSPDFR.PlayScannerAudioUsingPosition("INTRO_01 OFFICERS_REPORT_02 ILLEGALLY_PARKED_VEHICLE IN_OR_ON_POSITION INTRO_02 OUTRO_03 TARGET_VEHICLE_LICENCE_PLATE UHH" + licencePlateAudioMessage + " NOISE_SHORT CODE4_ADAM OFFICER_INTRO_02 PROCEED_WITH_PATROL NOISE_SHORT OUTRO_02", PedsManager.LocalPlayer().Position); PedsManager.LocalPlayer().Tasks.PlayAnimation("random@arrests", "generic_radio_exit", 1.0f, AnimationFlags.UpperBodyOnly); ParkingTicketsEventHandler.AlreadyGivedTicketsLicencePlateCollection.Add(vehicle.LicensePlate); }
public override void Handle() { while (Main.IsAlive) { try { GameFiber.Yield(); if (false == FunctionsLSPDFR.IsCalloutRunning()) { this.HandleOffencesEvents(); } GameFiber.Sleep(3000); } catch (Exception e) { Logger.LogTrivial("START - EXCEPTION"); Logger.LogTrivial(e.Message); Logger.LogTrivial(e.StackTrace); Logger.LogTrivial("END - EXCEPTION"); } } }
public static uint DecalreSubjectInformation(Ped ped) { Persona p = Functions.GetPersonaForPed(ped); string license; switch (p.ELicenseState) { case ELicenseState.Valid: license = "Valid"; break; default: case ELicenseState.None: case ELicenseState.Unlicensed: license = "None"; break; case ELicenseState.Suspended: license = "Suspended"; break; case ELicenseState.Expired: license = "Expired"; break; } string wanted; if (p.Wanted) { wanted = "Suspect is <font color=\"red\">wanted</font>"; } else { wanted = "has <font color=\"limegreen\">no warrants</font>"; } return(ScannerHelper.DisplayDispatchDialogue("Dispatch", $"Persona information: <br/> - License {license}<br/> - {wanted}.")); }
public static void SetCustomPulloverLocation(CustomPulloverEvent customPulloverEvent) { Blip driverBlip = customPulloverEvent.PulledDriver.AttachBlip(); driverBlip.Flash(500, -1); driverBlip.Color = System.Drawing.Color.Yellow; if (Tools.HavingChance(2, 10)) { customPulloverEvent.PulledDriver.CanAttackFriendlies = true; } Vehicle playerPatrolCar = PedsManager.LocalPlayer().CurrentVehicle; int checkpoint = 0; try { Vector3 checkPointPosition = PedsManager.LocalPlayer().GetOffsetPosition(new Vector3(0f, 8f, -1f)); checkpoint = NativeFunction.Natives.CREATE_CHECKPOINT <int>(46, checkPointPosition.X, checkPointPosition.Y, checkPointPosition.Z, checkPointPosition.X, checkPointPosition.Y, checkPointPosition.Z, 3.5f, 255, 0, 0, 255, 0);; float xOffset = 0; float yOffset = 0; float zOffset = 0; bool SuccessfulSet = false; while (true) { GameFiber.Wait(70); Game.DisplaySubtitle("Set your desired ~o~pullover ~s~location. Hold ~b~Enter ~s~when done.", 100); checkPointPosition = PedsManager.LocalPlayer().GetOffsetPosition(new Vector3((float)xOffset + 0.5f, (float)(yOffset + 8), (float)(-1 + zOffset))); if (false == CustomPulloverEventHandler.IsAlreadyFollowing) { break; } if (false == FunctionsLSPDFR.IsPlayerPerformingPullover()) { Game.DisplayNotification("You cancelled the ~b~Traffic Stop."); break; } if (false == PedsManager.LocalPlayer().IsInVehicle(playerPatrolCar, false)) { break; } if (KeysManager.IsKeyDownRightNowComputerCheck(Configuration.Instance.ReadKey(CustomPulloverEventHandler.K_POS_RESET, "NumPad5"))) { xOffset = 0; yOffset = 0; zOffset = 0; } if (KeysManager.IsKeyDownRightNowComputerCheck(Configuration.Instance.ReadKey(CustomPulloverEventHandler.K_POS_FORWARD, "NumPad8"))) { yOffset++; } if (KeysManager.IsKeyDownRightNowComputerCheck(Configuration.Instance.ReadKey(CustomPulloverEventHandler.K_POS_BACK, "NumPad2"))) { yOffset--; } if (KeysManager.IsKeyDownRightNowComputerCheck(Configuration.Instance.ReadKey(CustomPulloverEventHandler.K_POS_RIGHT, "NumPad6"))) { xOffset++; } if (KeysManager.IsKeyDownRightNowComputerCheck(Configuration.Instance.ReadKey(CustomPulloverEventHandler.K_POS_LEFT, "NumPad4"))) { xOffset--; } if (KeysManager.IsKeyDownRightNowComputerCheck(Configuration.Instance.ReadKey(CustomPulloverEventHandler.K_POS_UP, "NumPad9"))) { zOffset++; } if (KeysManager.IsKeyDownRightNowComputerCheck(Configuration.Instance.ReadKey(CustomPulloverEventHandler.K_POS_DOWN, "NumPad3"))) { zOffset--; } if (KeysManager.IsKeyDownRightNowComputerCheck(System.Windows.Forms.Keys.Enter)) { SuccessfulSet = true; break; } NativeFunction.Natives.DELETE_CHECKPOINT(checkpoint); checkpoint = NativeFunction.Natives.CREATE_CHECKPOINT <int>(46, checkPointPosition.X, checkPointPosition.Y, checkPointPosition.Z, checkPointPosition.X, checkPointPosition.Y, checkPointPosition.Z, 3f, 255, 0, 0, 255, 0); NativeFunction.Natives.SET_CHECKPOINT_CYLINDER_HEIGHT(checkpoint, 2f, 2f, 2f); } NativeFunction.Natives.DELETE_CHECKPOINT(checkpoint); if (SuccessfulSet) { try { playerPatrolCar.BlipSiren(true); Game.LocalPlayer.Character.Tasks.PlayAnimation("friends@frj@ig_1", "wave_c", 1f, AnimationFlags.SecondaryTask | AnimationFlags.UpperBodyOnly); } catch { } while (true) { GameFiber.Yield(); if (Vector3.Distance(customPulloverEvent.PulledDriver.Position, PedsManager.LocalPlayer().Position) > 25f) { Game.DisplaySubtitle("~h~~r~Stay close to the vehicle.", 700); } if (false == FunctionsLSPDFR.IsPlayerPerformingPullover()) { Game.DisplayNotification("You cancelled the ~b~Traffic Stop."); break; } if (false == PedsManager.LocalPlayer().IsInVehicle(playerPatrolCar, false) || false == CustomPulloverEventHandler.IsAlreadyFollowing) { break; } Rage.Task drivetask = customPulloverEvent.PulledDriver.Tasks.DriveToPosition(checkPointPosition, 12f, VehicleDrivingFlags.DriveAroundVehicles | VehicleDrivingFlags.DriveAroundObjects | VehicleDrivingFlags.AllowMedianCrossing | VehicleDrivingFlags.YieldToCrossingPedestrians); GameFiber.Wait(700); if (false == drivetask.IsActive || Vector3.Distance(customPulloverEvent.PulledDriver.Position, checkPointPosition) < 1.5f) //exit if driver end task or is away from the expected position { break; } } if (customPulloverEvent.pulledVehicle.Exists()) { if (customPulloverEvent.PulledDriver.Exists()) { customPulloverEvent.PulledDriver.Tasks.PerformDrivingManeuver(VehicleManeuver.Wait); } } } } catch (Exception e) { NativeFunction.Natives.DELETE_CHECKPOINT(checkpoint); Game.LogTrivial("---------- EXCEPTION ---------"); Game.LogTrivial(e.Message); Game.LogTrivial("---------- END ---------"); } finally { if (driverBlip.IsValid() && driverBlip.Exists()) { driverBlip.Delete(); } CustomPulloverEventHandler.IsAlreadyFollowing = false; } }