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 static void HandleGiveParkingTickets(object sender, GiveParkingTicketEvent giveParkingTicketEvent) { Functions.GiveParkingTicket(giveParkingTicketEvent); }