void qTimer_Tick(object sender, EventArgs e) { if (IsTrafficStop) { if (m.IsKeyPressed(System.Windows.Forms.Keys.F9, System.Windows.Forms.Keys.None, true)) { //LPlayer.LocalPlayer.Ped.DrawTextAboveHead("I suspect you've been Driving While Intoxicated, I need you to take a breath test", 3000); Functions.PrintHelp("Conducting breathtest..."); DelayedCaller.Call(delegate { int BreathTestScore; if (suspect.IsRagdoll) { BreathTestScore = Common.GetRandomValue(CalloutsPlusMain.DrinkDriveLimit, CalloutsPlusMain.DrinkDriveLimit + 100); } else { BreathTestScore = Common.GetRandomValue(0, CalloutsPlusMain.DrinkDriveLimit + 100); } String result; String measurement = "mg/100ml"; double multiplier = Math.Floor((double)BreathTestScore / CalloutsPlusMain.DrinkDriveLimit); if (BreathTestScore >= CalloutsPlusMain.DrinkDriveLimit) { result = "~r~FAIL~w~"; } else { result = "~g~PASS~w~"; } //Finally print the results Functions.PrintHelp("Result: " + result + "~n~Score: " + BreathTestScore + measurement + " (Limit: " + CalloutsPlusMain.DrinkDriveLimit + "mg/100ml)~n~" + multiplier + "x Legal limit"); m.HasQuestioningFired = false; qTimer.Stop(); }, this, 4000); } else if (m.IsKeyPressed(System.Windows.Forms.Keys.F10, System.Windows.Forms.Keys.None, true)) { //LPlayer.LocalPlayer.Ped.DrawTextAboveHead("Your car is being seized by the LCPD, you're going to have to walk from now on.", 3000); Functions.PrintHelp("You've seized this ped's car, deal with it how you see fit."); DelayedCaller.Call(delegate { int response = Common.GetRandomValue(0, 3); switch (response) { case 0: suspect.DrawTextAboveHead("Oh great, just what I wanted!", 4000); break; case 1: suspect.DrawTextAboveHead("No! My car!", 4000); break; case 2: suspect.DrawTextAboveHead("What?! Why? this isn't fair", 4000); break; case 3: suspect.DrawTextAboveHead("Don't you f***s earn enough money to buy your own car?", 4000); break; } suspect.NoLongerNeeded(); sCar.PassengersLeaveVehicle(true); m.HasQuestioningFired = false; qTimer.Stop(); }, this, 2000); } else if (m.IsKeyPressed(System.Windows.Forms.Keys.F11, System.Windows.Forms.Keys.None, true)) { //LPlayer.LocalPlayer.Ped.DrawTextAboveHead("Alright, you're free to go", 3000); Functions.PrintHelp("You released the ped, they will return to their vehicle and drive away."); suspect.Task.CruiseWithVehicle(sCar, 20f, true); suspect.Task.AlwaysKeepTask = true; suspect.WantedByPolice = false; DelayedCaller.Call(delegate { suspect.NoLongerNeeded(); sCar.NoLongerNeeded(); m.HasQuestioningFired = false; qTimer.Stop(); }, this, 5000); } else if (m.IsKeyPressed(System.Windows.Forms.Keys.F12, System.Windows.Forms.Keys.None, true)) { if (CalloutsPlusMain.QuestionSuspectModifierKey != System.Windows.Forms.Keys.None) { Functions.PrintHelp("Menu Cancelled, you can press " + CalloutsPlusMain.QuestionSuspectModifierKey + "+" + CalloutsPlusMain.QuestionSuspectKey + " again to restart or pull the suspect out of your car to deal with him as normal."); } else { Functions.PrintHelp("Menu Cancelled, you can press " + CalloutsPlusMain.QuestionSuspectKey + " again to restart or pull the suspect out of your car to deal with him as normal."); } m.HasQuestioningFired = false; qTimer.Stop(); } } else { if (m.IsKeyPressed(System.Windows.Forms.Keys.F9, System.Windows.Forms.Keys.None, true)) { Functions.PrintHelp("You attempt to extort the suspect..."); if (suspect.ItemsCarried == LPed.EPedItem.StolenCards) { } m.HasQuestioningFired = false; qTimer.Stop(); } else if (m.IsKeyPressed(System.Windows.Forms.Keys.F10, System.Windows.Forms.Keys.None, true)) { Functions.PrintHelp("You picked option 2, it does f**k all"); m.HasQuestioningFired = false; qTimer.Stop(); } else if (m.IsKeyPressed(System.Windows.Forms.Keys.F11, System.Windows.Forms.Keys.None, true)) { //LPlayer.LocalPlayer.Ped.DrawTextAboveHead("Alright, you're free to go", 3000); Functions.PrintHelp("You released the ped, they will leave your vehicle."); suspect.WantedByPolice = false; DelayedCaller.Call(delegate { suspect.NoLongerNeeded(); m.HasQuestioningFired = false; qTimer.Stop(); }, this, 5000); } else if (m.IsKeyPressed(System.Windows.Forms.Keys.F12, System.Windows.Forms.Keys.None, true)) { if (CalloutsPlusMain.QuestionSuspectModifierKey != System.Windows.Forms.Keys.None) { Functions.PrintHelp("Menu Cancelled, you can press " + CalloutsPlusMain.QuestionSuspectModifierKey + "+" + CalloutsPlusMain.QuestionSuspectKey + " again to restart or pull the suspect out of your car to deal with him as normal."); } else { Functions.PrintHelp("Menu Cancelled, you can press " + CalloutsPlusMain.QuestionSuspectKey + " again to restart or pull the suspect out of your car to deal with him as normal."); } m.HasQuestioningFired = false; qTimer.Stop(); } } }
//Paramedic tick private void paramedic_Tick(object sender, EventArgs e) { switch (EMSStatus) { case State.Responding: if (GTA.Native.Function.Call <bool>("IS_CAR_STUCK", new GTA.Native.Parameter[] { (Vehicle)ambulance }) || ambulance.IsUpsideDown) { ambulance.Position = World.GetNextPositionOnStreet(ambulance.Position.Around(10f)); ambulance.PlaceOnNextStreetProperly(); } if (para1.Position.DistanceTo2D(LPlayer.LocalPlayer.Ped.Position) <= 35f) { paramedicCanCancel = false; para1.Task.DriveTo(LPlayer.LocalPlayer.Ped.Position, 10f, false, true); if (para1.Position.DistanceTo2D(LPlayer.LocalPlayer.Ped.Position) <= 15f) { ambulance.AttachBlip().Delete(); para1.Task.LeaveVehicle(ambulance, true); Ped[] peds = World.GetAllPeds(); foreach (Ped p in peds) { if (p.Exists()) { if (!p.isAliveAndWell || p.isDead || p.isInjured || p.Health < main.ParamedicPlayerHealthBelow) { victims.Add(p); } } } EMSStatus = State.OnScene; } } break; case State.OnScene: currentVictim = victims.FirstOrDefault(); //Functions.PrintText("Victims: " + victims.Count, 4000); if (currentVictim == null) { //Log.Warning("No elements were found in the array so the script could not continue. The ambulance was set to no longer needed and will return to a normal ped.", this); Functions.PrintHelp("There was no victim in the area, the ambulance will be detached."); para1.Task.CruiseWithVehicle(ambulance, 20f, true); ambulance.SirenActive = false; EMSStatus = State.Leave; break; } else { EMSStatus = State.RunToObject; break; } case State.RunToObject: if (currentVictim.Exists() == false) { Functions.PrintText("There is no injured ped here", 4000); para1.Task.CruiseWithVehicle(ambulance, 20f, true); EMSStatus = State.Leave; break; } else //they must exist { if (EMSTaskSeq == null) { currentVictim.AttachBlip(); EMSTaskSeq = new TaskSequence(); EMSTaskSeq.AddTask.RunTo(currentVictim.Position); EMSTaskSeq.Perform(para1); } if (para1.Position.DistanceTo2D(currentVictim.Position) <= 5f) { EMSTaskSeq.Dispose(); EMSTaskSeq = null; EMSStatus = State.PerformDuty; break; } break; } case State.PerformDuty: if (EMSTaskSeq == null) { EMSTaskSeq = new TaskSequence(); EMSTaskSeq.AddTask.TurnTo(currentVictim); EMSTaskSeq.AddTask.PlayAnimation(medic, "medic_cpr_in", 2f); EMSTaskSeq.AddTask.PlayAnimation(medic, "medic_cpr_loop", 2f); EMSTaskSeq.AddTask.PlayAnimation(medic, "medic_cpr_out", 2f); EMSTaskSeq.Perform(para1); } if (para1.Animation.isPlaying(medic, "medic_cpr_out")) { EMSTaskSeq.Dispose(); EMSTaskSeq = null; EMSStatus = State.EndDuty; break; } break; case State.EndDuty: if (currentVictim.isDead) { para1.DrawTextAboveHead("They're dead. We'll take him to the morgue for you", 4000); } else if (currentVictim == LPlayer.LocalPlayer.Ped) { para1.DrawTextAboveHead("I've patched you up, you're good to go", 4000); } else { para1.DrawTextAboveHead("They need to go to hospital immediately!", 4000); } if (currentVictim != null && currentVictim.Exists()) { if (currentVictim != LPlayer.LocalPlayer.Ped) { currentVictim.AttachBlip().Delete(); currentVictim.Delete(); currentVictim = null; } else { currentVictim.AttachBlip().Delete(); } victims.RemoveAt(0); victims.Sort(delegate(Ped a, Ped b) { if (a == null && b == null) { return(0); } else if (a == null) { return(-1); } else if (b == null) { return(1); } else { return (a.Position.DistanceTo2D(para1.Position) .CompareTo(b.Position.DistanceTo2D(para1.Position))); } }); } if (victims.Count > 0) { EMSStatus = State.OnScene; break; } else { para1.Task.CruiseWithVehicle(ambulance, 20f, true); para1.Task.AlwaysKeepTask = true; EMSStatus = State.Leave; break; } case State.Leave: para1.NoLongerNeeded(); ambulance.NoLongerNeeded(); paramedicCalledOut = false; EMSStatus = State.None; break; case State.None: paramedicTimer.Stop(); break; } }