RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

House bann/kick by PK/criminals

Melantus

Sorceror
Currently, along with a group of friends are preparing a new server that contains a large quantity of rules known from the server Siege Perilous. We are currently working on the implementation of, inter alia, the following rule. I know that some shards apply it and hence my request to you for any suggestions as to how to introduce it in the current version of runuo. Thanks for any your help.

"Murderers and Criminals will not be able to kick/ban others from their home. In addition, if a murderer or flagged criminal opens the door to a house in which a blue player has banned players/monsters, the ban list for the house will be cleared."
 

ThatDudeJBob

Sorceror
In HouseDoors.cs there is OnOpened.
C#:
        public override void OnOpened(Mobile from)
        {
            BaseHouse house = this.FindHouse();
 
            if (house != null && house.IsFriend(from) && from.IsPlayer() && house.RefreshDecay())
                from.SendLocalizedMessage(1043293); // Your house's age and contents have been refreshed.
 
            if (house != null && house.Public && !house.IsFriend(from))
                house.Visits++;
        }

In this section i would do some if statements

C#:
            if ((pm.Kills > 3) || (pm.Criminal != false))
            {
                house.Bans.Clear();
            }

Add the Above code below this
C#:
            if (house != null && house.Public && !house.IsFriend(from))
                house.Visits++;
___________________________________________________

And in BaseHouse.cs there is...
C#:
        public void Ban(Mobile from, Mobile targ)
        {
            if (!this.IsFriend(from) || this.m_Bans == null)
                return;
                  ...
        }

Under the Above code put this...
C#:
            if ((from.Kills > 4) || (from.Criminal != false))
            {
                from.SendMessage("You cannot ban anyone at this time.");
                return;
            }

I tested the above code and it works for what you are asking.
 
Top