public static void DispatchReset(string handle) { Player p = GetPlayerByHandle(handle); if (GetCivilian(p.Handle) != null) { #if DEBUG SendMessage(p, "", new [] { 0, 0, 0 }, "Removing Civilian Profile..."); #endif Civs.Remove(GetCivilian(p.Handle)); // removing instance of civilian } if (GetCivilianVeh(p.Handle) != null) { #if DEBUG SendMessage(p, "", new[] { 0, 0, 0 }, "Removing Civilian Vehicle Profile..."); #endif CivVehs.Remove(GetCivilianVeh(p.Handle)); // removing instance of vehicle } if (GetOfficer(p.Handle) != null) { #if DEBUG SendMessage(p, "", new[] { 0, 0, 0 }, "Removing Officer Profile..."); #endif Officers.Remove(GetOfficer(p.Handle)); // removing instance of officer } SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "All profiles reset"); // displaying the reset message }
public static void ToggleVehicleStolen(string handle) { Player p = GetPlayerByHandle(handle); // checking if player has a name if (GetCivilian(handle) == null) { SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "You must set your name before you can set your vehicle stolen"); return; } // checking if vehicle exists if (GetCivilianVeh(handle) != null) { int index = CivVehs.IndexOf(GetCivilianVeh(handle)); // finding index of vehicle CivVehs[index].StolenStatus = !CivVehs[index].StolenStatus; // toggle stolen if (CivVehs[index].StolenStatus) // checking if it is stolen { Civilian civ = Civilian.CreateRandomCivilian(); // creating a new random civ CivVehs[index].Owner = civ; // setting the vehicle owner to the civ Civs.Add(civ); // adding the civ to the database } else { Civilian civ = CivVehs[index].Owner; // finding the existing civ Civs.Remove(civ); // removing the civ from the database CivVehs[index].Owner = GetCivilian(handle); // setting the owner to the person } SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, $"Stolen status set to {CivVehs[index].StolenStatus}"); } else { SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "You must set your vehicle before you can set your vehicle stolen"); } }