public override bool OnCalloutAccepted() { start = true; try { Game.LogTrivial("DocumentLack: Creating Entity"); suspectCar = new Vehicle(spawn); suspectCar.IsPersistent = true; suspect = suspectCar.CreateRandomDriver(); suspect.IsPersistent = true; Game.LogTrivial("DocumentLack: Creating Blip"); blip = suspect.AttachBlip(); blip.RouteColor = Color.Red; blip.IsRouteEnabled = true; Game.LogTrivial("DocumentLack: Entity Success, dentermine Situations"); string message; switch (situation) { case EDocumentLackSituation.Insurance: Game.LogTrivial("INSURANCE determined"); if (Integreate.StopThePed) { suspectCar.SetInsurance((HCVehicleStatus)MathHelper.GetRandomInteger(0, 1)); } Game.LogTrivial("INSURANCE set"); message = "The target vehicle has been reported as Uninsured or it's insurance has expired."; break; default: case EDocumentLackSituation.Registration: Game.LogTrivial("REGISTRATION determined"); if (Integreate.StopThePed) { suspectCar.SetRegistration((HCVehicleStatus)MathHelper.GetRandomInteger(0, 1)); } Game.LogTrivial("REGISTRATION set"); message = "The target vehicle has been reported as No registiration or it's expired."; break; } Game.LogTrivial("DocumentLack: Situations determined"); ScannerHelper.DisplayDispatchNote(message); Game.LogTrivial("Checking for Stop The Ped"); if (!Integreate.StopThePed) { Game.DisplayHelp("This callout works best if you install ~y~StopThePed~s~ by BejoIlo."); } Game.LogTrivial("Prepar done"); Game.DisplaySubtitle("Approach the ~r~suspect~s~."); return(base.OnCalloutAccepted()); } catch (Exception ex) { Game.LogExtremelyVerbose("HotCallout Debug: Failed on DocumentLack"); Game.LogExtremelyVerbose("HotCallout Debug: " + ex.GetType().Name); Game.LogExtremelyVerbose("HotCallout Debug: " + ex.Message); Game.LogExtremelyVerbose(ex.StackTrace); Game.DisplayHelp($"The \"{CalloutMessage}\" callout encounterd fatal error and must exit."); return(false); } }
public override bool OnCalloutAccepted() { suspect = new Ped(spawnPoint); suspect.BlockPermanentEvents = true; suspect.IsPersistent = true; officer = new Ped("s_m_y_cop_01", suspect.Position.Around(5f), suspect.Heading); officer.BlockPermanentEvents = true; officer.IsPersistent = true; Functions.SetPedAsCop(officer); officer.Inventory.GiveNewWeapon(WeaponHash.Pistol, short.MaxValue, true); officer.Tasks.FightAgainst(suspect); suspect.Inventory.GiveNewWeapon(WeaponHash.Pistol, short.MaxValue, true); suspect.Tasks.FightAgainst(officer); suspectBlip = suspect.AttachBlip(); suspectBlip.Sprite = BlipSprite.Enemy; suspectBlip.IsFriendly = false; suspectBlip.IsRouteEnabled = true; suspectBlip.Color = Color.Red; ScannerHelper.DisplayDispatchNote("There's a suspect shooting at an officer. Quick, before anything goes wrong."); return(base.OnCalloutAccepted()); }
public override bool OnCalloutAccepted() { /* Archival * 2020/6/30 09:23 - Add logging to flags * 2020/6/30 09:28 - Add line number logging to locate error */ Game.LogTrivial("[Dangerous Driver/HotCallouts] Accepted Instance > Dangerous Driver"); Game.LogTrivialDebug("LINE NUMBER: 52 / Used with source repository if pushed."); suspectCar = new Vehicle(spawn); suspectCar.IsPersistent = true; Game.LogTrivial("[Dangerous Driver/HotCallouts] Spawned suspectCar (" + suspectCar.Model.Name + ") and set to Persistent"); Game.LogTrivialDebug("LINE NUMBER: 56 / Used with source repository if pushed."); suspect = suspectCar.CreateRandomDriver(); suspect.IsPersistent = true; suspect.BlockPermanentEvents = true; Game.LogTrivial($"[Dangerous Driver/HotCallouts] Spawned suspect ({suspect.Model.Name}) and set to Persistent & Block Events"); Game.LogTrivialDebug("LINE NUMBER: 63 / Used with source repository if pushed."); blip = suspect.AttachBlip(); blip.IsFriendly = false; blip.IsRouteEnabled = true; blip.Name = "Reckless Driver"; Game.LogTrivial("[Dangerous Driver/HotCallouts] Spawned blip and renamed to Reckless Driver"); Game.LogTrivialDebug("LINE NUMBER: 70 / Used with source repository if pushed."); situations = MathHelper.GetRandomInteger(0, 3); string message; string audioMessage; switch (situations) { default: case 0: Game.LogTrivial("[Dangerous Driver/HotCallouts] Flag 0: Emergency with 15f speed"); suspect.Tasks.CruiseWithVehicle(15f, VehicleDrivingFlags.Emergency); message = "driving all over the road, but with normal speed"; audioMessage = "CRIME_RECKLESS_DRIVER"; break; case 1: Game.LogTrivial("[Dangerous Driver/HotCallouts] Flag 1: Emergency with 30f speed"); suspect.Tasks.CruiseWithVehicle(30f, VehicleDrivingFlags.Emergency); message = "driving all over the road and overspeed"; audioMessage = "CRIME_SPEEDING_FELONY"; break; case 2: Game.LogTrivial("[Dangerous Driver/HotCallouts] Flag 2: Normal with 45f speed"); suspect.Tasks.CruiseWithVehicle(45f, VehicleDrivingFlags.Normal); message = "overspeeding"; audioMessage = "CRIME_SPEEDING_FELONY"; break; case 3: Game.LogTrivial("[Dangerous Driver/HotCallouts] Flag 3: Alcohol intoxication"); if (Integreate.TrafficPolicer) { Game.LogTrivial("[Dangerous Driver/HotCallouts] Flag 3 Created: Traffic Policer Exists"); suspect.Tasks.CruiseWithVehicle(50f, VehicleDrivingFlags.Emergency); Traffic_Policer.API.Functions.SetPedAlcoholLevel(suspect, Traffic_Policer.Impairment_Tests.AlcoholLevels.OverLimit); audioMessage = "CRIME_RECKLESS_DRIVER"; message = "driving under the influence of alcohol"; break; } else { Game.LogTrivial("[Dangerous Driver/HotCallouts] Flag 3 Aborted: Traffic Policer does not exists"); Game.LogTrivial("[Dangerous Driver/HotCallouts] Creating Flag 2"); goto case 2; } } ScannerHelper.ReportEvent(audioMessage); ScannerHelper.DisplayDispatchNote("We received a 911 report of a vehicle " + message + ". Respond with Code 3."); Game.LogTrivial("[Dangerous Driver/HotCallouts] Done > Dangerous Driver"); return(base.OnCalloutAccepted()); }