private void PublishCourtResults() { if (!CourtSystem.PublishedCourtCases.Contains(this)) { if (CourtSystem.PendingCourtCases.Contains(this)) { Menus.PendingResultsList.Items.RemoveAt(CourtSystem.PendingCourtCases.IndexOf(this)); if (Menus.PendingResultsList.Items.Count == 0) { Menus.PendingResultsList.Items.Add(new TabItem(" ")); PendingResultsMenuCleared = false; } Menus.PendingResultsList.Index = 0; CourtSystem.PendingCourtCases.Remove(this); } CourtSystem.PublishedCourtCases.Insert(0, this); string CrimeString = char.ToUpper(Crime[0]) + Crime.ToLower().Substring(1); if (GuiltyChance < 0) { GuiltyChance = 0; } else if (GuiltyChance > 100) { GuiltyChance = 100; } if (EntryPoint.rnd.Next(100) >= GuiltyChance && !ResultsPublishedNotificationShown) { CourtVerdict = "Found not guilty and cleared of all charges."; } Menus.PublishedResultsList.Items.Insert(0, new TabTextItem(MenuLabel(false), "Court Result", MenuLabel(false) + "~s~. ~r~" + CrimeString + (Crime[Crime.Length - 1] == '.' ? "" : "~s~.") + "~s~~n~ " + CourtVerdict + (CourtVerdict[CourtVerdict.Length - 1] == '.' ? "" : "~s~.") + "~s~~n~ Offence took place on ~b~" + CrimeDate.ToShortDateString() + "~s~ at ~b~" + CrimeDate.ToShortTimeString() + "~s~.~n~ Hearing was on ~b~" + ResultsPublishTime.ToShortDateString() + "~s~ at ~b~" + ResultsPublishTime.ToShortTimeString() + "." + "~n~~n~~y~Select this case and press ~b~Delete ~y~to dismiss it.")); if (!ResultsMenuCleared) { Game.LogTrivial("Emtpy items, clearing menu at index 1."); Menus.PublishedResultsList.Items.RemoveAt(1); ResultsMenuCleared = true; } ResultsPublished = true; if (!ResultsPublishedNotificationShown) { if (CourtSystem.LoadingXMLFileCases) { GameFiber.StartNew(delegate { GameFiber.Wait(25000); Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "~b~San Andreas Magistrates' Court", "~r~" + SuspectName, "A court case you're following has been heard. Press ~b~" + Albo1125.Common.CommonLibrary.ExtensionMethods.GetKeyString(EntryPoint.ToggleMenuKey, EntryPoint.ToggleMenuModifierKey) + "."); }); } else { Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "~b~San Andreas Magistrates' Court", "~r~" + SuspectName, "A court case you're following has been heard. Press ~b~" + Albo1125.Common.CommonLibrary.ExtensionMethods.GetKeyString(EntryPoint.ToggleMenuKey, EntryPoint.ToggleMenuModifierKey) + "."); } ResultsPublishedNotificationShown = true; CourtSystem.OverwriteCourtCase(this); } } }
private static void MainLogic() { GameFiber.StartNew(delegate { try { while (true) { GameFiber.Yield(); if (ExtensionMethods.IsKeyDownComputerCheck(EntryPoint.ToggleMenuKey) && (ExtensionMethods.IsKeyDownRightNowComputerCheck(EntryPoint.ToggleMenuModifierKey) || EntryPoint.ToggleMenuModifierKey == Keys.None)) { ChecksMenu.Visible = !ChecksMenu.Visible; } if (MenuPool.IsAnyMenuOpen()) { NativeFunction.Natives.SET_PED_STEALTH_MOVEMENT(Game.LocalPlayer.Character, 0, 0); } if (CourtsMenu.Visible) { if (ExtensionMethods.IsKeyDownComputerCheck(Keys.Delete)) { if (PendingResultsList.Active) { if (CourtCase.PendingResultsMenuCleared) { CourtSystem.DeleteCourtCase(CourtSystem.PendingCourtCases[PendingResultsList.Index]); PendingResultsList.Index = 0; } } else if (PublishedResultsList.Active) { if (CourtCase.ResultsMenuCleared) { CourtSystem.DeleteCourtCase(CourtSystem.PublishedCourtCases[PublishedResultsList.Index]); PublishedResultsList.Index = 0; } } } } } } catch (ThreadAbortException e) { } catch (Exception e) { Game.LogTrivial(e.ToString()); } }); }
private static void MainLoop() { GameFiber.StartNew(delegate { Game.LogTrivial("British Policing Script has been initialised successfully and is now loading INI, XML and dependencies. Standby..."); AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(LSPDFRResolveEventHandler); Menus.InitialiseMenus(); RegisterCallouts(); CourtSystem.CourtSystemMainLogic(); Game.LogTrivial("British Policing Script has been fully initialised successfully and is now working."); while (true) { GameFiber.Yield(); //if (Game.IsKeyDown(Keys.F10)) //{ // Functions.StartCallout("ANPR Hit"); //} } }); }
public void DeleteCourtCase() { CourtSystem.DeleteCourtCase(this); }