sirens song
Wanderer
post the whole script you edited and please use [code ] and [/code ].
sirens song said:post the whole script you edited and please use [code ] and [/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;
}
}
}
The Dragon Reborn is a scripter, sweet.Grim_Reaper said:...Special thanks to Rand'alThor for the help ...
if ( Found )
{
JailThem(from);
}
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);
. }
if ( item is JailHammer )
{
JailHammer hammer = item as JailHammer;
Found = true;
hammer.RockAmount *= 2;
m.SendMessage( "Your remaining sentence has been doubled." );
}
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." );
}
}
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??
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 );
}
if ( Found )
{
JailThem(from);
}
if ( found )
(
if ( they are owner or friends of house they are in ) //<------
{
//Do nothing here
}
else
{
JailThem( from );
}
}
David said:The Dragon Reborn is a scripter, sweet.
sirens song said:Find the JailThem() method in the JailCommand.cs script....
inside this method there is a block of code that is..
Change that to this...Code:if ( item is JailHammer ) { JailHammer hammer = item as JailHammer; Found = true; hammer.RockAmount *= 2; m.SendMessage( "Your remaining sentence has been doubled." ); }
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." ); } }
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
}
}