Ejemplo n.º 1
0
        public static void SetVehicle(string handle, string plate)
        {
            Player p = GetPlayerByHandle(handle);

            if (GetCivilian(handle) == null)
            {
                SendMessage("DispatchSystem", new[] { 0, 0, 0 }, "You must set your name before you can set your vehicle");
                return;
            }

            if (GetCivilianVeh(handle) != null)
            {
                Int32 index = civVehs.IndexOf(GetCivilianVeh(handle));

                civVehs[index] = new CivilianVeh(p, GetCivilian(handle), plate.ToUpper(), false, true, true);

                SendMessage("DispatchSystem", new[] { 0, 0, 0 }, $"New vehicle set to {plate.ToUpper()}");
            }
            else
            {
                civVehs.Add(new CivilianVeh(p, GetCivilian(handle), plate.ToUpper(), false, true, true));

                SendMessage("DispatchSystem", new[] { 0, 0, 0 }, $"New vehicle set to {plate.ToUpper()}");
            }
        }
Ejemplo n.º 2
0
        public static void RequestCivilianVeh(string handle, string plate)
        {
            Player      invoker = GetPlayerByHandle(handle);    // getting the invoker
            CivilianVeh civVeh  = GetCivilianVehByPlate(plate); // finding the vehicle

            if (civVeh != null)
            {
                // results msg
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, "Results: ");
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, $"Plate: {civVeh.Plate.ToUpper()}");
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, $"Stolen: {civVeh.StolenStatus}");
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, $"Registered: {civVeh.Registered}");
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, $"Insured: {civVeh.Insured}");
                // for registration
                if (civVeh.Registered)
                {
                    SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 },
                                $"R/O: {civVeh.Owner.First} {civVeh.Owner.Last}");
                }
            }
            else
            {
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, "That vehicle doesn't exist in the system");
            }
        }
Ejemplo n.º 3
0
        public static void SetName(string handle, string first, string last)
        {
            Player p = GetPlayerByHandle(handle);

            if (GetOfficer(handle) != null) // checking if the civilian has an officer
            {
                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "You cannot be an officer and a civilian at the same time!");
                return; // return if they do
            }

            if (GetCivilianByName(first, last) != null && GetPlayerByIp(GetCivilianVeh(handle).SourceIP) != p) // checking if the name already exists in the system
            {
                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "That name already exists in the system!");
                return; // return if it does
            }

            // checking if the civilian already has a civ in the system
            if (GetCivilian(handle) != null)
            {
                int index = Civs.IndexOf(GetCivilian(handle)); // finding the index of the existing civ

                Civs[index] = new Civilian(p.Identifiers["ip"])
                {
                    First = first, Last = last
                };                                                                                                               // setting the index to an instance of a new civilian

                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, $"New name set to: {Civs[index].First} {Civs[index].Last}"); // saying the new name created
            }
            else // if the civ doesn't exist
            {
                Civs.Add(new Civilian(p.Identifiers["ip"])
                {
                    First = first, Last = last
                });                                                                                                              // add a new civilian to the system
                int index = Civs.IndexOf(GetCivilian(handle));                                                                   // find the index of the civ

                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, $"New name set to: {Civs[index].First} {Civs[index].Last}"); // say the new name was created
#if DEBUG
                SendMessage(p, "", new[] { 0, 0, 0 }, "Creating new civilian profile...");
#endif
            }
            if (GetCivilianVeh(handle) != null)
            {
                // below basically resets the vehicle if it exists

                int index = CivVehs.IndexOf(GetCivilianVeh(handle));

                CivVehs[index] = new CivilianVeh(p.Identifiers["ip"]);
            }
        }
Ejemplo n.º 4
0
        public static void DisplayCurrentVehicle(string handle)
        {
            Player      p   = GetPlayerByHandle(handle);
            CivilianVeh veh = GetCivilianVeh(handle);

            if (veh != null)
            {
                SendMessage(p, "", new[] { 255, 255, 255 }, $"Plate: {veh.Plate.ToUpper()}");
                SendMessage(p, "", new[] { 255, 255, 255 }, $"Stolen: {veh.StolenStatus}");
                SendMessage(p, "", new[] { 255, 255, 255 }, $"Registered: {veh.Registered}");
                SendMessage(p, "", new[] { 255, 255, 255 }, $"Insured: {veh.Insured}");
            }
            else
            {
                SendMessage(p, "DispatchSystem", new [] { 0, 0, 0 }, "Your vehicle doesn't exist in the system");
            }
        }
Ejemplo n.º 5
0
        public static void SetVehicle(string handle, string plate)
        {
            Player p = GetPlayerByHandle(handle);

            // if no civilian exists
            if (GetCivilian(handle) == null)
            {
                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "You must set your name before you can set your vehicle");
                return;
            }

            // checking if the plate already exists in the system
            if (GetCivilianVehByPlate(plate) != null && GetPlayerByIp(GetCivilianVeh(handle).SourceIP) != p)
            {
                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "That vehicle already exists in the system!");
                return;
            }

            // checking if player already owns a vehicle
            if (GetCivilianVeh(handle) != null)
            {
                int index = CivVehs.IndexOf(GetCivilianVeh(handle)); // finding the existing index
                CivVehs[index] = new CivilianVeh(p.Identifiers["ip"])
                {
                    Plate = plate, Owner = GetCivilian(handle)
                };                                                                                                 // setting the index to a new vehicle item
                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, $"New vehicle set to {CivVehs[index].Plate}"); // msg of creation
            }
            else
            {
                CivilianVeh veh = new CivilianVeh(p.Identifiers["ip"])
                {
                    Plate = plate, Owner = GetCivilian(handle)
                };                                                                                      // creating the new vehicle
                CivVehs.Add(veh);                                                                       // adding the new vehicle to the list of vehicles

                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, $"New vehicle set to {veh.Plate}"); // msg
            }
        }
Ejemplo n.º 6
0
        public static void SetName(string handle, string first, string last)
        {
            Player p = GetPlayerByHandle(handle);

            if (p == null)
            {
                return;
            }

            if (GetCivilian(handle) != null)
            {
                int index = civs.IndexOf(GetCivilian(handle));

                civs[index] = new Civilian(p, first, last, false, 0);

                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, $"New name set to: {civs[index].First} {civs[index].Last}");
            }
            else
            {
                civs.Add(new Civilian(p, first, last, false, 0));
                int index = civs.IndexOf(GetCivilian(handle));

                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, $"New name set to: {civs[index].First} {civs[index].Last}");
#if DEBUG
                SendMessage(p, "", new[] { 0, 0, 0 }, "Creating new civilian profile...");
#endif
            }
#if ENABLE_VEH
            if (GetCivilianVeh(handle) != null)
            {
                int index = civVehs.IndexOf(GetCivilianVeh(handle));

                civVehs[index] = new CivilianVeh(p);
            }
#endif
        }
Ejemplo n.º 7
0
        public static void RequestCivilianVeh(string handle, string plate)
        {
            Player      invoker = GetPlayerByHandle(handle);
            CivilianVeh civVeh  = GetCivilianVehByPlate(plate);

            if (civVeh != null)
            {
                WriteChatLine(invoker);
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, "Results: ");
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, $"Plate: {civVeh.Plate}");
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, $"Stolen: {civVeh.StolenStatus.ToString()}");
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, $"Registered: {civVeh.Registered.ToString()}");
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, $"Insured: {civVeh.Insured.ToString()}");
                if (civVeh.Registered)
                {
                    SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, $"R/O: {civVeh.Owner.First} {civVeh.Owner.Last}");
                }
                WriteChatLine(invoker);
            }
            else
            {
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, "That name doesn't exist in the system");
            }
        }
Ejemplo n.º 8
0
        public static void ToggleVehicleInsurance(string handle)
        {
            Player p = GetPlayerByHandle(handle);

            if (GetCivilian(handle) == null)
            {
                SendMessage("DispatchSystem", new[] { 0, 0, 0 }, "You must set your name before you can set your vehicle insurance");
                return;
            }

            if (GetCivilianVeh(handle) != null)
            {
                int         index = civVehs.IndexOf(GetCivilianVeh(handle));
                CivilianVeh last  = civVehs[index];

                civVehs[index] = new CivilianVeh(p, GetCivilian(handle), last.Plate, last.StolenStatus, last.Registered, !last.Insured);

                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, $"Insurance status set to {civVehs[index].Insured.ToString()}");
            }
            else
            {
                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "You must set your vehicle before you can set your Insurance");
            }
        }