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!

Jail System

W

walmart

Guest
sirens song said:
post the whole script you edited and please use [code ] and [/code ].
Code:
using System;
using System.Reflection;
using System.Collections;
using Server;
using Server.Mobiles;
using Server.Items;
using Server.Targeting;

namespace Server.Scripts.Commands
{
	public class Jail
	{
		public static void Initialize()
		{
			Server.Commands.Register( "Jail", AccessLevel.GameMaster, new CommandEventHandler( Jail_OnCommand ) );
			Server.Commands.Register( "UnJail", AccessLevel.GameMaster, new CommandEventHandler( UnJail_OnCommand ) );
			EventSink.Speech += new SpeechEventHandler( EventSink_Speech );
		}

		public static void EventSink_Speech( SpeechEventArgs args )
		{
			bool Found = false;
			Mobile from = args.Mobile;
			string Said = args.Speech;
			ArrayList badwords = new ArrayList();

			badwords.Add( "Fuck" );
			badwords.Add( "Whore" );
			badwords.Add( "Bitch" );
			badwords.Add( "Cunt" );
			badwords.Add( "Nigger" );
			badwords.Add( "Shit" );
			badwords.Add( "wtf" );
			badwords.Add( "Fag" );
			badwords.Add( "Slut" );
			badwords.Add( "FU" );
			badwords.Add( "Queer" );
			badwords.Add( "Fucker" );
			badwords.Add( "Fucking" );
			badwords.Add( "Ass" );
			badwords.Add( "Whores" );
			badwords.Add( "Bitches" );
			badwords.Add( "Sluts" );
			badwords.Add( "Niggers" );
			badwords.Add( "Faggots" );
			badwords.Add( "Queers" );
			badwords.Add( "Bitches" );
			badwords.Add( "Faggot" );
			badwords.Add( "Fags" );
			badwords.Add( "Cunts" );
			badwords.Add( "Fuckin" );
			badwords.Add( "Fuk" );
			badwords.Add( "Fukin" );
			badwords.Add( "Fucken" );
			badwords.Add( "Bitching" );
			badwords.Add( "Bitchin" );
			badwords.Add( "stfu" );
			badwords.Add( "Nigga" );
			badwords.Add( "Homo" );
			badwords.Add( "Homos" );
			badwords.Add( "Cock" );
			badwords.Add( "Pussy" );
			badwords.Add( "Pussys" );
			badwords.Add( "Tit" );
			badwords.Add( "Tits" );
			badwords.Add( "Titties" );
			badwords.Add( "Sucks" );
			badwords.Add( "B i t c h" );
			badwords.Add( "Asshole" );
                  badwords.Add( "F u c k" );
			badwords.Add( "C o c k" );
                  badwords.Add( "N i g g e r" );
                  badwords.Add( "A s s" );
			badwords.Add( "A s s h o l e" );
                  
                  if ( from is PlayerMobile )
			{
				PlayerMobile m = from as PlayerMobile;

				Said = Mytolower(Said);
				ArrayList saidwords = toarray(Said);

				foreach ( string said in badwords )
				{
					string saidl = Mytolower(said);

					foreach ( string strtest in saidwords )
					{
						if ( saidl == strtest )
							Found = true;
					}
				}

				if ( Found )
				{
					JailThem(from);
				}
			}
		}

		[Usage( "Jail" )]
		[Description( "Jails a targeted Player." )]
		private static void Jail_OnCommand( CommandEventArgs e )
		{
			e.Mobile.Target = new JailTarget();
			e.Mobile.SendMessage( "Whom do you wish to Jail?" );
		}

		[Usage( "UnJail" )]
		[Description( "UnJails a targeted Player." )]
		private static void UnJail_OnCommand( CommandEventArgs e )
		{
			e.Mobile.Target = new UnJailTarget();
			e.Mobile.SendMessage( "Whom do you wish to UnJail?" );
		}

		private class JailTarget : Target
		{
			public JailTarget() : base( -1, true, TargetFlags.None )
			{
			}

			protected override void OnTarget( Mobile from, object targ )
			{
				if ( !(targ is PlayerMobile) )
				{
					from.SendMessage( "You can only Jail Players." );
					return;
				}

				Mobile m = targ as Mobile;
				JailThem ( m );
			}
		}

		private static void JailThem( Mobile targ )
		{
			PlayerMobile m = targ as PlayerMobile;

			if ( m.AccessLevel >= AccessLevel.GameMaster )
				return;

			bool Found = false;

			foreach (Item item in m.Items)
			{
				if ( item is JailHammer )
				{
					JailHammer hammer = item as JailHammer;
					Found = true;
					hammer.StoneAmount *= 2;
					m.SendMessage( "Your remaining sentence has been doubled." );
				}
			}

			if ( !Found )
			{
				m.SendMessage( "You have been JAILED!" );
				if ( m.Mounted )
				{
					if ( m.Mount is EtherealMount )
					{
						EtherealMount pet = m.Mount as EtherealMount;
						pet.Internalize();
						pet.Rider = null;
					}
					else if ( m.Mount is BaseMount )
					{
						BaseMount petm = m.Mount as BaseMount;
						petm.Rider = null;

						BaseCreature pet = petm as BaseCreature;
						pet.Internalize();
						pet.ControlTarget = null;
						pet.ControlOrder = OrderType.Stay;

						pet.SetControlMaster( null );
						pet.SummonMaster = null;

						Mobile targm = targ as Mobile;
						pet.IsStabled = true;
						targm.Stabled.Add( pet );
						m.SendMessage( "Your mount has been stabled" );
					}
				}

				Backpack bag = new Backpack();
				Container pack = m.Backpack;
				BankBox box = m.BankBox;
				ArrayList equipitems = new ArrayList(m.Items);
				ArrayList bagitems = new ArrayList( pack.Items );

				foreach (Item item in equipitems)
				{
					if ((item.Layer != Layer.Bank) && (item.Layer != Layer.Backpack) && (item.Layer != Layer.Hair) && (item.Layer != Layer.FacialHair))
					{
						pack.DropItem( item );
					}
				}

				Container pouch = m.Backpack;
				ArrayList finalitems = new ArrayList( pouch.Items );

				foreach (Item items in finalitems)
				{
					bag.DropItem(items);
				}

				bag.Hue = 2665;
				box.DropItem(bag);

				m.X = 5280;
				m.Y = 1185;
				m.Z = 0;
				m.Map = Map.Trammel;
				m.AddItem( new JailHammer() );
				Item robe = new Robe();
				robe.Hue = 2665;
				m.AddItem( robe );				
			}
		}

		private class UnJailTarget : Target
		{
			public UnJailTarget() : base( -1, true, TargetFlags.None )
			{
			}

			protected override void OnTarget( Mobile from, object targ )
			{
				if ( !(targ is PlayerMobile) )
				{
					from.SendMessage( "You can only UnJail Players." );
					return;
				}

				PlayerMobile m = targ as PlayerMobile;

				m.SendMessage( "You have been RELEASED!" );
				foreach (Item item in m.Items)
				{
					if ( item is JailHammer )
					{
						item.Delete();
						break;
					}
				}
				m.SendMessage( "Step on the teleporter to exit the jail." );
			}
		}

		private static string Mytolower( string str )
		{
			string s1 = "";
			int strlen=str.Length;
			for (int i=0;i < strlen;i++)
			{
				char ch=str[i];
				if (ch >= 'A' && ch <= 'Z')
				{
					int ucode=(int)ch;
					ucode += 32;
					s1 += (char)ucode;
				}
				else
				{
					s1 += ch;
				}
			}
			return s1;
		}

		private static ArrayList toarray( string str )
		{
			ArrayList retarray = new ArrayList();
			string s1 = "";
			int strlen=str.Length;
			for (int i=0;i < strlen;i++)
			{
				char ch=str[i];
				if (ch >= 'a' && ch <= 'z')
				{
					s1 += ch;
				}
				else
				{
					if ( s1 != "" )
					{
						retarray.Add( s1 );
						s1 = "";
					}
				}
			}

			if ( s1 != "" )
				retarray.Add( s1 );

			return retarray;
		}
	}
}
heres the script as you can see i had to take this out cause would not complie this>>>}
else if ( item is JailStone )
{
item.Delete();
break;
 

sirens song

Wanderer
Seems to me you posted the wrong script. Perhaps Im not clear on what you are asking. Your trying to get the rock/stone to delete from the players bags when they leave the jail area??
If you deleted it when they gave the last rock over (like the hammer) then they could pick up any stone they left on the ground.
 

stinknmonk

Wanderer
Just wondering, would there be any way to have the jail system but then have an "Adult Area" where the cursing would be allowed or have it to where it isnt active inside houses? the main area that i would be concerend with the cursing would be in public areas, banks, gate rooms, event areas etc... if this is possible could someone give me a heads up as to where i might put this and in which script?
 

sirens song

Wanderer
This line in Jail command....
Code:
if ( Found )
				{
					JailThem(from);
				}

You would need to insert an If in there like.

. if (found)
. {
. if //they are in region allowed to curse
. {
. }
. else
. {
. JailThem(from);
. }
 

stinknmonk

Wanderer
sirens song said:
This line in Jail command....
Code:
if ( Found )
				{
					JailThem(from);
				}

You would need to insert an If in there like.

. if (found)
. {
. if //they are in region allowed to curse
. {
. }
. else
. {
. JailThem(from);
. }


so would i need to specify the coords for that region they are allowed to curse in?
 

sirens song

Wanderer
thats correct, rather than making a region and refering them you could just compare the mobiles X Y..

something like
if ( from.X >= 0 ) && ( from.X <= 100 ) && (from.Y >= 0 ) && ( from.Y <= 100 )
{
//do nothing here
}
else
{
JailThem(from);
}

That makes a box from 100 tiles squared at the top left corner of map thats "cursable"

Im sure theres easier way but this is easy enough isnt it??
 

WebSiter

Wanderer
There is a serious bug in Jail System.
If a player get jail with bad word and he/she say bad words in jail area till jailrock amount reach 1Million. The jail hammer counter get zero value and jailed player get out with out any jail rock mining.
It is very bad condition.
And also sime times when jail rock amount reachs 1M server crash also.
 

sirens song

Wanderer
Find the JailThem() method in the JailCommand.cs script....

inside this method there is a block of code that is..
Code:
if ( item is JailHammer )
				{
					JailHammer hammer = item as JailHammer;
					Found = true;
					hammer.RockAmount *= 2;
					m.SendMessage( "Your remaining sentence has been doubled." );
				}
Change that to this...
Code:
if ( item is JailHammer )
				{
					JailHammer hammer = item as JailHammer;
					if ( hammer.RockAmount > 999999 ) //Your max amount here
						{
						Found = true;
						}
					else
						{
						Found = true;
						hammer.RockAmount *= 2;
						m.SendMessage( "Your remaining sentence has been doubled." );
						}
				}
I didnt compile or test it, nor did I write this command, but I feel that should solve the problem, Ill let Grim_Reaper update the download.

-Jamie
 

DuGrand

Sorceror
If you jail a gost, the player will have a death shroud in is bank box.

The player will also be send to the jail point dead but with is normal body.

Very nice idea and script.
 

WebSiter

Wanderer
Thanks Sirens Song for quick reply for solution.

Yes DuGrand when a player goes jail as ghost. It loses all his/her coarpse adn mount. But its normal I think.

For Ghost players I add a ResurrectionGate in Jail Area for quick solution, maybe there is another solution for this situation.
 

sirens song

Wanderer
I dont have death shrouds on my shard. If they arent located ON a player they delete themselves. But I dont see a problem with putting a

<mobilereferance>.Resurrect();

line in there before it checks their items and moves them.
That should fix the problem, but yes a death shroud will appear in their bankbox i believe.
-Jamie
 

stinknmonk

Wanderer
sirens song said:
thats correct, rather than making a region and refering them you could just compare the mobiles X Y..

something like
if ( from.X >= 0 ) && ( from.X <= 100 ) && (from.Y >= 0 ) && ( from.Y <= 100 )
{
//do nothing here
}
else
{
JailThem(from);
}

That makes a box from 100 tiles squared at the top left corner of map thats "cursable"

Im sure theres easier way but this is easy enough isnt it??

Easy enough? Im not really sure. Im really new to scripting and all. Where would i put what you suggested? i know in the jailcommand.cs, but where in that script? I want them to also be "free" in their houses too. Im sure that would require much more than just making a 100 square area that they are "free" in. any ideas on that?
 

sirens song

Wanderer
In the JailTarget class in the OnTarget overridden method.
Code:
protected override void OnTarget( Mobile from, object targ )
			{
				if ( !(targ is PlayerMobile) )
				{
					from.SendMessage( "You can only Jail Players." );
					return;
				}

				Mobile m = targ as Mobile;
				m.Resurrect();   //this was added
				JailThem ( m );
			}
You can see where I added the line to res them then jail them. If you have deathrobes on your shard they should be sent to bank when you jail the ghost. Theres no need to check if their alive or dead before using the res() method because I dont think it even matters.

As far as letting them curse in houses....
On this section of code...
Code:
if ( Found )
      {
      JailThem(from);
      }
You need to edit it to check if they are in their house or friends of the house their in. Look at the script for the "I ban thee" command because friends of house can use that too. That should have a way to see if they are in the house. then edit the above code to be like..
Code:
if ( found )
     (
      if ( they are owner or friends of house they are in )  //<------
                  {
                   //Do nothing here
                  }
      else
                  {
                   JailThem( from );
                   }
      }
that should work, Im not sure how to check the house thing without looking through the scripts and such, but Ill leave that part up to you guys.
-Jamie
 

jjarmis

Wanderer
sirens song said:
Find the JailThem() method in the JailCommand.cs script....

inside this method there is a block of code that is..
Code:
if ( item is JailHammer )
				{
					JailHammer hammer = item as JailHammer;
					Found = true;
					hammer.RockAmount *= 2;
					m.SendMessage( "Your remaining sentence has been doubled." );
				}
Change that to this...
Code:
if ( item is JailHammer )
                                {
                                        JailHammer hammer = item as JailHammer;
                                        if ( hammer.RockAmount > 999999 ) //Your max amount here
                                                {
                                                Found = true;
                                                }
                                        else
                                                {
                                                Found = true;
                                                hammer.RockAmount *= 2;
                                                m.SendMessage( "Your remaining sentence has been doubled." );
                                                }
                                }

That wont entirely stop it from going over 100000. You would need to check the amount after doubling also...

Code:
if ( item is JailHammer )
                                {
                                        JailHammer hammer = item as JailHammer;
                                        Found = true;
                                        hammer.RockAmount *= 2;
                                        m.SendMessage( "Your remaining sentence has been doubled." );
                                        if ( hammer.RockAmount >= 1000000 ) //Your max here
                                        {
                                               hammer.RockAmount = 1000000;  //and here
                                        }
                                }
 

Reggie

Wanderer
i would like to implent a [jail 300 to let him mine 300 rock and so on, i tried it but im not very expierienced with scripting commands, would be nice if u could do that or at least tell me how....
 
Top