From d3e7169745c3228c56b29240f57663e2a6658a39 Mon Sep 17 00:00:00 2001 From: Matthew Toy Date: Sat, 24 Dec 2022 14:59:02 -0500 Subject: [PATCH] YobbinCallouts 1.7.0 Beta --- CallHandler.cs | 4 +- Callouts/CitizenArrest.cs | 21 +++-- Callouts/HospitalEmergency.cs | 19 ++--- Callouts/HumanTrafficking.cs | 2 +- Callouts/LandlordTenantDispute.cs | 137 +++++++++++++++++++++++++----- Callouts/StolenCellPhone.cs | 21 ++--- Callouts/WeaponFound.cs | 8 +- Main.cs | 24 ++++-- 8 files changed, 174 insertions(+), 62 deletions(-) diff --git a/CallHandler.cs b/CallHandler.cs index 37a1b88..1624c17 100644 --- a/CallHandler.cs +++ b/CallHandler.cs @@ -147,7 +147,6 @@ public static void IdleAction(Ped ped, bool iscop) } else { - int animation = monke.Next(0, MaleCopAnim.Length / 2); //Game.LogTrivial("YOBBINCALLOUTS: There are "+MaleCopAnim.Length+"animations"); //Game.LogTrivial(MaleCopAnim[animation, 0]); @@ -159,13 +158,11 @@ public static void IdleAction(Ped ped, bool iscop) { if (ped.IsFemale) { - int animation = monke.Next(0, FemaleRandoAnim.Length / 2); ped.Tasks.PlayAnimation(FemaleRandoAnim[animation, 0], FemaleRandoAnim[animation, 1], -1, AnimationFlags.Loop); } else { - int animation = monke.Next(0, MaleRandoAnim.Length / 2); ped.Tasks.PlayAnimation(MaleRandoAnim[animation, 0], MaleRandoAnim[animation, 1], -1, AnimationFlags.Loop); } @@ -366,6 +363,7 @@ public static void locationChooser(ArrayList list, float maxdistance = 600f, flo SpawnPoint = (Vector3)closeLocations[monke.Next(0, closeLocations.Count)]; locationReturned = true; Game.LogTrivial("YOBBINCALLOUTS: Spawn Point found successfully."); + Game.LogTrivial("YOBBINCALLOUTS: Spawn Point found at "+SpawnPoint+" in "+ Functions.GetZoneAtPosition(SpawnPoint).RealAreaName); } } diff --git a/Callouts/CitizenArrest.cs b/Callouts/CitizenArrest.cs index 416296b..dc52464 100644 --- a/Callouts/CitizenArrest.cs +++ b/Callouts/CitizenArrest.cs @@ -74,7 +74,7 @@ public override bool OnBeforeCalloutDisplayed() { Game.LogTrivial("==========YOBBINCALLOUTS: Citizen Arrest Callout Start=========="); System.Random r = new System.Random(); - int Scenario = r.Next(0, 3); //change later + int Scenario = r.Next(0, 0); //change later MainScenario = Scenario; Game.LogTrivial("YOBBINCALLOUTS: Scenario is " + MainScenario + ""); if (MainScenario == 0) Crime = "Assault."; //PUT PERIODS AT THE END OF THESE CRIMES. @@ -111,11 +111,11 @@ public override bool OnCalloutAccepted() SuspectModels = new string[8] { "A_M_Y_SouCent_01", "A_M_Y_StWhi_01", "A_M_Y_StBla_01", "A_M_Y_Downtown_01", "A_M_Y_BevHills_01", "G_M_Y_MexGang_01", "G_M_Y_MexGoon_01", "G_M_Y_StrPunk_01" }; System.Random r2 = new System.Random(); int SuspectModel = r2.Next(0, SuspectModels.Length); - Suspect = new Ped(SuspectModels[SuspectModel], nodePosition, heading); + Suspect = new Ped(nodePosition, heading); Suspect.IsPersistent = true; Suspect.BlockPermanentEvents = true; Functions.SetPedAsArrested(Suspect, true, false); - Suspect.Tasks.StandStill(-1); + //Suspect.Tasks.StandStill(-1); Game.LogTrivial("YOBBINCALLOUTS: Suspect Spawned"); Citizen = new Citizen(Suspect.GetOffsetPositionFront(2)); @@ -136,6 +136,13 @@ public override bool OnCalloutAccepted() AreaBlip.Alpha = 0.67f; AreaBlip.IsRouteEnabled = true; AreaBlip.Name = "Callout Location"; + + //this shouldn't be necessary but idk why it isn't working lol + if (!Suspect.Exists()) + { + Game.LogTrivial("YOBBINCALLOUTS: Suspect no longer valid, aborting..."); + return false; + } } catch (Exception e) { @@ -174,9 +181,11 @@ private void Callout() CitizenBlip.Color = Color.Purple; NativeFunction.Natives.TASK_TURN_PED_TO_FACE_ENTITY(Citizen, player, -1); - SuspectBlip = Suspect.AttachBlip(); - SuspectBlip.Scale = 0.7f; - SuspectBlip.IsFriendly = false; + //broken idk why + //SuspectBlip = Suspect.AttachBlip(); + //SuspectBlip.Scale = 0.7f; + //SuspectBlip.IsFriendly = false; + CallHandler.AssignBlip(Suspect, Color.Red); if (MainScenario == 0) Assault(); break; diff --git a/Callouts/HospitalEmergency.cs b/Callouts/HospitalEmergency.cs index 5491182..019427d 100644 --- a/Callouts/HospitalEmergency.cs +++ b/Callouts/HospitalEmergency.cs @@ -150,7 +150,8 @@ public override bool OnCalloutAccepted() var GuardSpawnPoint = World.GetNextPositionOnStreet(Nurse.Position); NativeFunction.Natives.xA0F8A7517A273C05(GuardSpawnPoint, 0, out Vector3 outPosition); - Guard = new Ped("s_m_m_security_01", outPosition, Nurse.Heading - 180); //offset position + if(CallHandler.FiftyFifty()) Guard = new Ped("s_m_m_security_01", outPosition, Nurse.Heading - 15); //offset position + else Guard = new Ped("s_m_m_security_01", outPosition, Nurse.Heading + 15); //offset position Guard.IsPersistent = true; Guard.BlockPermanentEvents = true; CallHandler.IdleAction(Guard, true); @@ -287,7 +288,7 @@ private void SuspectSearch() { if (CalloutRunning) { - if (Config.DisplayHelp) Game.DisplayHelp("Start ~b~Searching~w~ for the Patient."); + if (Config.DisplayHelp) Game.DisplayHelp("Start ~o~Searching~w~ for the Patient."); Area = new Blip(Suspect.Position.Around(5), 100f); Area.Alpha = 0.69f; Area.Color = Color.Orange; @@ -345,23 +346,20 @@ private void SuspectSearch() Game.DisplaySubtitle("~r~Patient:~w~ Don't come any closer, or they'll die!!"); //GameFiber.Wait(1000); - //doesn't do anything lol - //NativeFunction.Natives.TASK_TURN_PED_TO_FACE_ENTITY(Suspect, player, -1); - //NativeFunction.Natives.TASK_TURN_PED_TO_FACE_ENTITY(Hostage, player, -1); - Suspect.Tasks.PlayAnimation("misssagrab_inoffice", "hostage_loop", 1f, AnimationFlags.None).WaitForCompletion(500); - Suspect.Tasks.PlayAnimation("misssagrab_inoffice", "hostage_loop_mrk", 1f, AnimationFlags.Loop); + Suspect.Tasks.PlayAnimation("misssagrab_inoffice", "hostage_loop_mrk", 1f, AnimationFlags.Loop | AnimationFlags.SecondaryTask); HostageBlip = Hostage.AttachBlip(); HostageBlip.IsFriendly = true; HostageBlip.Scale = 0.69f; if (Hostage.IsFemale) Hostage.Tasks.PlayAnimation("anim@move_hostages@female", "female_idle", 1f, AnimationFlags.Loop); - else Hostage.Tasks.PlayAnimation("anim@move_hostages@male", "male_idle", 1f, AnimationFlags.Loop); + else Hostage.Tasks.PlayAnimation("anim@move_hostages@male", "male_idle", 1f, AnimationFlags.Loop | AnimationFlags.SecondaryTask); //This switch doesn't actually do anything, it's just a statement to break out of if the Suspect is killed prematurely in the hostage situation var lewis = 0; switch (lewis) { case 0: + GameFiber.Wait(1000); Game.DisplayHelp("Press ~y~" + Config.MainInteractionKey + "~w~ to Reason with the ~o~Patient."); HostageHold(); if (Suspect.IsAlive) Game.DisplaySubtitle("~g~You:~w~ " + Suspect.Forename + "! You don't have to do this! Let's talk this through!"); //was Hostage1 Dialogue @@ -423,6 +421,7 @@ private void SuspectSearch() //test vvv if (HostageBlip.Exists()) HostageBlip.Delete(); if (Hostage.Exists() && Hostage.IsAlive) Hostage.Tasks.ReactAndFlee(player); //might remove + Suspect.Tasks.PutHandsUp(5000, player); if (Functions.IsPedArrested(Suspect) || Suspect.IsAlive) { Game.DisplayNotification("Dispatch, we have taken the Patient into ~r~Custody."); @@ -487,9 +486,9 @@ private void DriveBack() Game.DisplayHelp("Let the ~r~Patient ~w~Out of the Car."); while (Suspect.IsInAnyVehicle(false)) GameFiber.Wait(0); } - Nurse.Tasks.GoStraightToPosition(Suspect.GetOffsetPositionFront(1f), 3f, Suspect.Heading, 1f, 4000).WaitForCompletion(4000); + Nurse.Tasks.GoStraightToPosition(Suspect.GetOffsetPositionFront(-1f), 3f, Suspect.Heading, 1f, 4000).WaitForCompletion(4000); //some frisking animation for nurse (idle, rest of callout) - Guard.Tasks.GoStraightToPosition(Nurse.GetOffsetPositionRight(2f), 2f, Nurse.Heading, 2f, 2500).WaitForCompletion(2500); + //Guard.Tasks.GoStraightToPosition(Nurse.GetOffsetPositionRight(2f), 2f, Nurse.Heading, 2f, 2500).WaitForCompletion(2500); CallHandler.IdleAction(Nurse, false); CallHandler.IdleAction(Guard, true); diff --git a/Callouts/HumanTrafficking.cs b/Callouts/HumanTrafficking.cs index 057ac52..a856c47 100644 --- a/Callouts/HumanTrafficking.cs +++ b/Callouts/HumanTrafficking.cs @@ -460,7 +460,7 @@ private void Confront() if (SuspectBlip.Exists()) SuspectBlip.Delete(); Victim.Tasks.LeaveVehicle(SuspectVehicle, LeaveVehicleFlags.LeaveDoorOpen).WaitForCompletion(); Victim.Tasks.Cower(-1); - Game.DisplayHelp("When Ready, Speak with the ~b~Victim."); + Game.DisplayHelp("When Ready, Locate and Speak with the ~b~Victim."); while (player.DistanceTo(Victim) >= 4) GameFiber.Wait(0); Victim.Tasks.AchieveHeading(player.Heading - 180).WaitForCompletion(500); diff --git a/Callouts/LandlordTenantDispute.cs b/Callouts/LandlordTenantDispute.cs index d7db3d4..51d2ef8 100644 --- a/Callouts/LandlordTenantDispute.cs +++ b/Callouts/LandlordTenantDispute.cs @@ -1,4 +1,4 @@ - using LSPD_First_Response.Mod.API; +using LSPD_First_Response.Mod.API; using LSPD_First_Response.Mod.Callouts; using Rage; using Rage.Native; @@ -76,26 +76,79 @@ class LandlordTenantDispute : Callout "~g~You:~w~ Hey, can you please open the door and come out here? It's the Police!", "~r~Tenant:~w~ No Officer, I will not be unlawfully evicted from my own property!!", "~g~You:~w~ Look, let's at least talk this through! Let's not make this any harder than it has to be for anybody here!", - "~r~Tenant:~w~ Okay fine, I'll come out! But you better not arrest me or unlawfully search my property, Officer! I will not be mistreated", + "~r~Tenant:~w~ Okay fine, I'll come out! But you better not arrest me or unlawfully search my property, Officer! I will not be mistreated!", "~g~You:~w~ Of Course, just come out here and talk!", }; + private readonly List SuspectLeaves1 = new List() + { + "~g~You:~w~ Thank you. Are you aware that the 30 day period for moving out of the property has expired?", + "~r~Tenant:~w~ Yes I am Officer, I wanted to be out sooner, I haven't been able to move all my stuff out yet.", + "~r~Tenant:~w~ I should be able to get out tomorrow if that's okay with you, most of it is gone already.", + "~g~You:~w~ Okay, because it seems like your landlord is pretty upset about the whole thing.", + "~r~Tenant:~w~ Yes I understand and I'm really sorry, if you could just give me one more day and I'll be out!", + "~g~You:~w~ Okay, let me see what I can do.", + }; + private readonly List SuspectLeaves2 = new List() + { + "~g~You:~w~ Thanks for your cooperation. Do you know why I'm here?", + "~r~Tenant:~w~ Yes Officer, I know the 30 day period to leave is up today.", + "~r~Tenant:~w~ It's been really hard for me to find a new place, I just found one a week ago but I need a couple more days to pack my things and leave.", + "~g~You:~w~ Well that's good to hear. Legally, the landlord has the right to have you removed, but I'll let them know you're almost ready and I'll see what I can do.", + "~r~Tenant:~w~ Okay, thank you so much!", + }; + private readonly List LandlordLeaves1 = new List() + { + "~g~You:~w~ Alright, I talked to the resident and they have a new place and are almost ready to leave.", + "~g~You:~w~ They just need a couple more days to get the rest of their stuff moved out. Is that okay for you?", + "~b~Landlord:~w~ Can I call you guys back again if they're still hear after then?", + "~g~You:~w~ Absolutely, you're well within your rights to have them removed now, but if you can spare a couple more days, it'll be easier for everyone.", + "~b~Landlord:~w~ *Sigh* Alright Officer, that sounds fair enough. Hopefully this is all over soon.", + "~g~You:~w~ Awesome, I appreciate the cooperation, glad we were able to find a middle ground.", + "~b~Landlord:~w~ Alright, hopefully this turns out okay. Thanks for your help.", + }; + private readonly List LandlordLeaves2 = new List() + { + "~g~You:~w~ Alright, I talked to the resident, turns out they have a new place and are almost ready to leave.", + "~g~You:~w~ They just require a couple more days to get the rest of their stuff moved out. Is that okay for you?", + "~b~Landlord:~w~ Can I get them arrested if they're still hear after then?", + "~g~You:~w~ Absolutely, you're well within your rights to have them removed now, but if you can spare a couple more days, it'll be easier for everyone.", + "~b~Landlord:~w~ *Sigh* Okay Officer, fair enough. Hopefully this is all over soon.", + "~g~You:~w~ Great, I thanks for the cooperation, glad we were able to find a middle ground.", + "~b~Landlord:~w~ No worries, thanks for your help.", + }; + private readonly List LandlordArrests1 = new List() + { + "~g~You:~w~ Alright, I talked to the resident and they have a new place and are almost ready to leave.", + "~g~You:~w~ They just need a couple more days to get the rest of their stuff moved out. Is that okay for you?", + "~b~Landlord:~w~ ABSOLUTELY NOT! They've already outstayed their welcome. I'm not gonna just give them more time for free!", + "~g~You:~w~ Okay, please calm down -.", + "~b~Landlord:~w~ I WANT THEM REMOVED! ARRESTED! NOW!", + }; + private readonly List LandlordArrests2 = new List() + { + "~g~You:~w~ Alright, I talked to the resident and they have a new place and are almost ready to leave.", + "~g~You:~w~ They just need a couple more days to get the rest of their stuff moved out. Does that work for you?", + "~b~Landlord:~w~ ABSOLUTELY NOT! They've wasted enough of my time, I'm done playing games!", + "~g~You:~w~ Okay, please calm down -.", + "~b~Landlord:~w~ I WANT THEM REMOVED! ARRESTED! NOW! DO YOUR JOB AND GET THEM OUT!", + }; public override bool OnBeforeCalloutDisplayed() { Game.LogTrivial("==========YOBBINCALLOUTS: Landlord-Tenant Dispute Callout Start=========="); System.Random r = new System.Random(); - int Scenario = r.Next(0, 0); + int Scenario = r.Next(0, 0); //only 1 scenario atm MainScenario = Scenario; Game.LogTrivial("YOBBINCALLOUTS: Scenario value is: " + MainScenario); - CallHandler.locationChooser(CallHandler.HouseList, 696); //nice + CallHandler.locationChooser(CallHandler.HouseList, 696); //nice x2 lol if (CallHandler.locationReturned) MainSpawnPoint = CallHandler.SpawnPoint; else { Game.LogTrivial("YOBBINCALLOUTS: No house found. Aborting..."); return false; } ShowCalloutAreaBlipBeforeAccepting(MainSpawnPoint, 25f); AddMinimumDistanceCheck(60f, MainSpawnPoint); - Functions.PlayScannerAudio("ATTENTION_ALL_UNITS_01 WE_HAVE_01 CITIZENS_REPORT_01 CRIME_DISTURBING_THE_PEACE_01"); + Functions.PlayScannerAudio("ATTENTION_ALL_UNITS_01 WE_HAVE_01 CITIZENS_REPORT_01 YC_CIVIL_DISTURBANCE"); CalloutMessage = "Landlord-Tenant Dispute"; CalloutPosition = MainSpawnPoint; if (MainScenario == 0) CalloutAdvisory = "A landlord reports a tenant refusing to leave their property."; @@ -124,7 +177,7 @@ public override bool OnCalloutAccepted() LandlordBlip = CallHandler.AssignBlip(Landlord, Color.Blue, .69f, "Caller", true); NativeFunction.Natives.TASK_TURN_PED_TO_FACE_ENTITY(Landlord, player, -1); - Game.DisplayHelp("Speak with the ~b~Landlord."); + if(Config.DisplayHelp) Game.DisplayHelp("Go to the scene and speak with the ~b~Landlord."); } } catch (Exception e) @@ -175,7 +228,8 @@ private void Callout() System.Random dialogue1 = new System.Random(); Game.DisplaySubtitle(AcceptSpeech[dialogue1.Next(0, AcceptSpeech.Count)], 2500); GameFiber.Wait(3000); - + + Game.DisplayHelp("Knock on the ~o~Door."); HouseBlip = new Blip(MainSpawnPoint); HouseBlip.Color = Color.Orange; HouseBlip.Alpha = 0.69f; @@ -191,7 +245,7 @@ private void Callout() System.Random dialogue2 = new System.Random(); int ReasonDialogue = dialogue2.Next(0, 0); //change later if (Config.DisplayHelp) Game.DisplayHelp("Press ~y~" + Config.MainInteractionKey + "~w~ to reason with the ~r~Tenant."); - if (MainScenario == 0) //cooperates + if (MainScenario == 0) //cooperates (opens the door) { if (ReasonDialogue == 0) CallHandler.Dialogue(SuspectCoop1); GameFiber.Wait(2000); @@ -199,13 +253,46 @@ private void Callout() SuspectBlip = CallHandler.AssignBlip(Suspect, Color.Red, .69f, "Tenant"); System.Random r2 = new System.Random(); - int action = r2.Next(0, 3); - if (action == 0) //more dialogue + int action = r2.Next(0, 4); //what happens to the tenant + Game.LogTrivial("YOBBINCALLOUTS: Tenant action value is "+action); + if (action <= 1) //more dialogue { GameFiber.Wait(1500); + if(CallHandler.FiftyFifty()) CallHandler.Dialogue(SuspectLeaves1, Suspect); + else CallHandler.Dialogue(SuspectLeaves2, Suspect); + GameFiber.Wait(1500); + CallHandler.IdleAction(Suspect, false); + + Game.DisplayHelp("Talk to the ~b~Landlord."); + while (player.DistanceTo(Landlord) > 5) GameFiber.Wait(0); + Landlord.Tasks.AchieveHeading(player.Heading - 180).WaitForCompletion(500); + Game.DisplayHelp("Press ~y~" + Config.MainInteractionKey + "~w~ to Inform the ~b~Landlord."); + while (!Game.IsKeyDown(Config.MainInteractionKey)) GameFiber.Wait(0); + + if(action == 0) + { + Game.LogTrivial("YOBBINCALLOUTS: Landlord leaves."); + if (CallHandler.FiftyFifty()) CallHandler.Dialogue(LandlordLeaves1, Landlord); + else CallHandler.Dialogue(LandlordLeaves2, Landlord); + GameFiber.Wait(1500); + if (Suspect.Exists()) Suspect.Tasks.AchieveHeading(Suspect.Heading - 180).WaitForCompletion(500); + if (Suspect.Exists()) Suspect.Delete(); + if (Landlord.Exists()) Landlord.Dismiss(); + } + else + { + Game.LogTrivial("YOBBINCALLOUTS: Landlord wants tenant arrested."); + if (CallHandler.FiftyFifty()) CallHandler.Dialogue(LandlordArrests1, Landlord); + else CallHandler.Dialogue(LandlordArrests2, Landlord); + GameFiber.Wait(1500); + CallHandler.IdleAction(Landlord, false); + Game.DisplayHelp("Deal with the ~r~Tenant~w~ as you see fit. Press ~y~" + Config.CalloutEndKey + " ~w~when ~b~Done.~w~"); + while (!Game.IsKeyDown(Config.CalloutEndKey)) GameFiber.Wait(0); + } } else //attack { + Game.LogTrivial("YOBBINCALLOUTS: Landlord attacks."); System.Random r3 = new System.Random(); GameFiber.Wait(r3.Next(500, 3000)); System.Random dialogue3 = new System.Random(); @@ -213,11 +300,20 @@ private void Callout() GameFiber.Wait(r3.Next(500, 2000)); Suspect.BlockPermanentEvents = false; //test this (wasn't fighting before) Landlord.Tasks.FightAgainst(Suspect, -1); - if (action == 1) Suspect.BlockPermanentEvents = false; //or flee - else Suspect.Tasks.FightAgainst(Landlord, -1); //Tenant fights back + if (action == 2) + { + Suspect.BlockPermanentEvents = false; //flee + Suspect.Tasks.ReactAndFlee(Landlord); //test this + Game.LogTrivial("YOBBINCALLOUTS: Tenant flees/fights back."); + } + else + { + Suspect.Tasks.FightAgainst(Landlord, -1); //Tenant fights back + Game.LogTrivial("YOBBINCALLOUTS: Tenant fights back."); + } LandlordBlip.Color = Color.Orange; - if(action == 1) CallHandler.SuspectWait(Landlord); //Suspect doesn't fight back + if(action == 2) CallHandler.SuspectWait(Landlord); //Suspect doesn't fight back else //Suspect does fight back { while (Suspect.Exists() || Landlord.Exists()) //all this is a workaround for StopThePed @@ -230,8 +326,9 @@ private void Callout() } } GameFiber.Wait(2500); + Game.LogTrivial("YOBBINCALLOUTS: Tenant and Landlord either arrested/killed."); //I might make the help message depend on if the landlord and/or tenants are arrested, but also might be too lazy to do that - Game.DisplayHelp("Deal with the ~o~Landlord~w~ and ~r~Tenant~w~ as you see fit. Press ~b~"+Config.CalloutEndKey+" ~w~when done."); + Game.DisplayNotification("Deal with the ~o~Landlord~w~ and ~r~Tenant~w~ as you see fit. Press ~b~"+Config.CalloutEndKey+" ~w~when done."); //this usually gets blocked so made it a notification while (!Game.IsKeyDown(Config.CalloutEndKey)) GameFiber.Wait(0); } } @@ -249,12 +346,12 @@ private void Callout() Landlord.Dismiss(); if (LandlordBlip.Exists()) LandlordBlip.Delete(); } - - GameFiber.Wait(2000); - Game.LogTrivial("YOBBINCALLOUTS: Callout Finished, Ending..."); - EndCalloutHandler.EndCallout(); - End(); + break; } + GameFiber.Wait(2000); + Game.LogTrivial("YOBBINCALLOUTS: Callout Finished, Ending..."); + EndCalloutHandler.EndCallout(); + End(); } catch (Exception e) { @@ -293,6 +390,8 @@ public override void End() if (SuspectBlip.Exists()) { SuspectBlip.Delete(); } if (LandlordBlip.Exists()) LandlordBlip.Delete(); if (HouseBlip.Exists()) HouseBlip.Delete(); + if (Landlord.Exists()) Landlord.Dismiss(); + if (Suspect.Exists()) Suspect.Dismiss(); //if (Landlord.Exists()) Landlord.Dismiss(); Game.LogTrivial("YOBBINCALLOUTS: Landlord-Tenant Dispute Callout Finished Cleaning Up."); } diff --git a/Callouts/StolenCellPhone.cs b/Callouts/StolenCellPhone.cs index f939086..ea5c73a 100644 --- a/Callouts/StolenCellPhone.cs +++ b/Callouts/StolenCellPhone.cs @@ -263,12 +263,12 @@ private void TrackPhone() //Phone.IsVisible = false; Suspect.Tasks.Wander(); - CellPhoneAreaBlip = new Blip(Suspect.Position.Around(15), 50); + CellPhoneAreaBlip = new Blip(Suspect.Position.Around(15), 100); CellPhoneAreaBlip.Color = Color.Yellow; CellPhoneAreaBlip.Alpha = 0.67f; CellPhoneAreaBlip.IsRouteEnabled = true; - while (player.DistanceTo(Suspect) >= 50) GameFiber.Wait(0); + if(Suspect.Exists()) while (player.DistanceTo(Suspect) >= 50) GameFiber.Wait(0); Game.DisplayNotification("You are ~g~Close~w~ to the ~y~Phone!~w~ Enabling ~b~Fine Location~w~ Information."); if (CellPhoneAreaBlip.Exists()) CellPhoneAreaBlip.Delete(); CellPhoneAreaBlip = Suspect.AttachBlip(); @@ -331,7 +331,8 @@ private void Decide() GameFiber.Wait(2000); Game.DisplayHelp("~y~" + Config.Key1 + ":~b~ Arrest the Suspect.~y~ " + Config.Key2 + ":~b~ Let the Suspect Off the Hook."); while (!Game.IsKeyDown(Config.Key1) && !Game.IsKeyDown(Config.Key2)) GameFiber.Wait(0); //might do an animation? - if (Game.IsKeyDown(Config.Key1)) + + if (Game.IsKeyDown(Config.Key1)) //arrest { if (Config.DisplayHelp) Game.DisplayHelp("Press ~y~" + Config.MainInteractionKey + " ~w~to Continue Talking to the ~r~Suspect."); GameFiber.Yield(); @@ -342,20 +343,15 @@ private void Decide() if (MainScenario == 4) { GameFiber.Wait(500); Runs(); } else { - while (Suspect.Exists() && !Functions.IsPedArrested(Suspect) && Suspect.IsAlive) GameFiber.Wait(0); - if (Suspect.Exists() && Functions.IsPedArrested(Suspect)) { GameFiber.Wait(1000); Game.DisplayNotification("Dispatch, Suspect is Under ~g~Arrest."); } - else { GameFiber.Wait(1000); Game.DisplayNotification("Dispatch, Suspect is ~r~Dead."); } //does not work with STP - GameFiber.Wait(2000); - Functions.PlayScannerAudio("REPORT_RESPONSE_COPY_02"); - GameFiber.Wait(2000); + CallHandler.SuspectWait(Suspect); if (SuspectBlip.Exists()) SuspectBlip.Delete(); WrapUp(); } } - else + else //let go { if (Config.DisplayHelp) Game.DisplayHelp("Press ~y~" + Config.MainInteractionKey + " ~w~to Continue Talking to the ~r~Suspect."); - CallHandler.Dialogue(SuspectCoopLetGo, Suspect); + if(Suspect.Exists()) CallHandler.Dialogue(SuspectCoopLetGo, Suspect); GameFiber.Wait(1500); if (Suspect.Exists()) { @@ -363,7 +359,7 @@ private void Decide() if (Suspect.IsAlive) Suspect.Dismiss(); } //Test this blip deletion - SuspectBlip.Alpha = 0; + if(SuspectBlip.Exists()) SuspectBlip.Alpha = 0; if (SuspectBlip.Exists()) SuspectBlip.Delete(); //botched WrapUp(); } @@ -383,6 +379,7 @@ private void WrapUp() VictimBlip.IsRouteEnabled = true; VictimBlip.Scale = 0.75f; if(CalloutRunning) while (player.DistanceTo(Victim) >= 5) GameFiber.Wait(0); //test + if (Config.DisplayHelp) Game.DisplayHelp("Press ~y~" + Config.MainInteractionKey + " ~w~to Return the Phone ~b~Caller."); CallHandler.Dialogue(VictimEnding1, Victim); Phone = new Rage.Object("prop_npc_phone", Vector3.Zero); Phone.IsPersistent = true; diff --git a/Callouts/WeaponFound.cs b/Callouts/WeaponFound.cs index a64b9f5..e667512 100644 --- a/Callouts/WeaponFound.cs +++ b/Callouts/WeaponFound.cs @@ -411,12 +411,12 @@ private void WitnessFirst() } if (Suspect.Exists()) { - if (Functions.IsPedArrested(Suspect)) { GameFiber.Wait(1000); Game.DisplayNotification("Dispatch, a Suspect is Under ~g~Arrest~w~ Following the Pursuit."); } - else { GameFiber.Wait(1000); Game.DisplayNotification("Dispatch, a Suspect Was ~r~Killed~w~ Following the Pursuit."); } + if (Functions.IsPedArrested(Suspect)) { GameFiber.Wait(1000); Game.DisplayNotification("Dispatch, a Suspect is Under ~g~Arrest~w~."); } + else { GameFiber.Wait(1000); Game.DisplayNotification("Dispatch, a Suspect Was ~r~Killed~w~."); } } else { - GameFiber.Wait(1000); Game.DisplayNotification("Dispatch, a Suspect is Under ~g~Arrest~w~ Following the Pursuit."); + GameFiber.Wait(1000); Game.DisplayNotification("Dispatch, a Suspect is Under ~g~Arrest."); } } } @@ -458,7 +458,7 @@ private void CollectWeapon() SuspectVehicle.IsPersistent = true; Suspect = SuspectVehicle.CreateRandomDriver(); Suspect.IsPersistent = true; Suspect.BlockPermanentEvents = true; - var SuspectName = Functions.GetVehicleOwnerName(SuspectVehicle); //might mix up gender idk + var SuspectName = Functions.GetPersonaForPed(Suspect).FullName; //test this var Distance = Math.Round(Suspect.DistanceTo(player)); Game.DisplayNotification(WeaponName + " Serial ~r~" + WeaponSerial + " ~w~Registered to ~p~" + SuspectName + "~w~. ~r~Suspect~w~ was Recently ~r~Located~o~ " + Distance + " metres~w~ Away!"); if (Main.CalloutInterface) CalloutInterfaceHandler.SendMessage(this, WeaponName + " Serial ~r~" + WeaponSerial + " ~w~Registered to ~p~" + SuspectName + "~w~. ~r~Suspect~w~ was Recently ~r~Located~o~ " + Distance + " metres~w~ Away!"); diff --git a/Main.cs b/Main.cs index 8c0e9c6..05b3007 100644 --- a/Main.cs +++ b/Main.cs @@ -8,7 +8,6 @@ using System.Threading; using LSPD_First_Response.Mod.API; using Rage; -using System.Reflection; using System.Linq; namespace YobbinCallouts @@ -20,6 +19,7 @@ public class Main : Plugin public static bool STP; //if STP is installed by the user public static bool CalloutInterface; //if Callout Interface is installed by the user public static bool UpToDate; //if the Plugin is updated. + public static bool Beta = false; public override void Initialize() { @@ -78,6 +78,7 @@ private static void OnOnDutyStateChangedHandler(bool OnDuty) Game.LogTrivial("YOBBINCALLOUTS: DETECTED BETA RELEASE. DO NOT REDISTRIBUTE. PLEASE REPORT ALL ISSUES."); Game.DisplayNotification("YOBBINCALLOUTS: ~r~DETECTED BETA RELEASE. ~w~DO NOT REDISTRIBUTE. PLEASE REPORT ALL ISSUES."); UpToDate = true; + Beta = true; } else { @@ -132,8 +133,9 @@ private static void RegisterCallouts() } Game.LogTrivial("Please Join My Discord Server to Report Bugs/Improvements: https://discord.gg/Wj522qa5mT. Enjoy!"); - Game.LogTrivial("Started Registering Callouts."); + //CALLOUTS + Game.LogTrivial("Started Registering Callouts."); if (Config.BrokenDownVehicle || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.BrokenDownVehicle)); if (Config.AssaultOnBus || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.AssaultOnBus)); if (Config.TrafficBreak || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.TrafficBreak)); @@ -147,17 +149,25 @@ private static void RegisterCallouts() if (Config.StolenCellPhone || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.StolenCellPhone)); if (Config.SovereignCitizen || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.SovereignCitizen)); if (Config.ActiveShooter || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.ActiveShooter)); - if (Config.CitizenArrest || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.CitizenArrest)); if (Config.HumanTrafficking || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.HumanTrafficking)); - //if (Config.Explosion || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.Explosion)); if (Config.WeaponFound || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.WeaponFound)); if (Config.HospitalEmergency || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.HospitalEmergency)); - //if (Config.DUIReported || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.DUIReported)); if (Config.LandlordTenantDispute || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.LandlordTenantDispute)); - if (Config.StolenMail || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.StolenMail)); Game.LogTrivial("Finished Registering Callouts."); - if (Config.RunInvestigations) //not for not sadge + //BETA CALLOUTS + if (Beta) + { + Game.LogTrivial("Started Registering Beta Callouts."); + if (Config.CitizenArrest || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.CitizenArrest)); + //if (Config.Explosion || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.Explosion)); + if (Config.DUIReported || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.DUIReported)); + if (Config.StolenMail || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.StolenMail)); + Game.LogTrivial("Finished Registering Beta Callouts."); + } + + //INVESTIGATIONS + if (Config.RunInvestigations) //not for now sadge { Game.LogTrivial("Started Registering Investigations."); //Functions.RegisterCallout(typeof(Callouts.StolenPoliceHardwareInvestigation)); (uncomment this)