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!

Staff Moongate

A

asmir03

Guest
Staff Moongate

pvp timer or fucker da owner is me the person who scripted this moongate
it john on your shard

this scrpit is where only staffcan go inthe moongate and this moongateis like custom moongate but with AccessLevel
To Install just drop it in the Custom Script file

To Change The AccessLevel just find
public override void OnDoubleClick( Mobile from )
{
if ( from.AccessLevel >= AccessLevel.Counselor )
{
if ( m_Destinations.Count > 0 )
{
if ( Utility.InRange( this.Location, from.Location, 1 ) )
from.SendGump( new StaffMoongateGump( from, this, false ));
else
from.SendMessage("That is too far away");
}
else
from.SendMessage("The moongate doesn't appear to go anywhere...");
}
}
 

Attachments

  • StaffMoongate.cs
    8.9 KB · Views: 189

Darkness_PR

Wanderer
you know this is how we all learn by doing small stuff =D keep it up btw lol maybe ur next post will be a system who knows lol
 
your script is great i love it but i want 2 use it a lil differnt. i want player to be able to use it. i altered the script so that players can use it but if they double click on the gate they can change cords,name ,ext.. how can i make it so that players can use it but not alter it?
Thanks in advance
FoCkEr
 

Crepti

Wanderer
I quite like it :)

I think I'll edit it slightly though... Make it into a donator's gate, so people who donate can go to places normal players can't :)
 
A

asmir03

Guest
fock this is how u change it
Code:
public class StaffMoongate : Item
	{
		private AccessLevel m_AccessLevel = (AccessLevel)3;//4 = Admin, 3 = Seer, 2 = Gm etc
 
		private ArrayList m_Destinations = new ArrayList();
		private ArrayList m_DestX = new ArrayList();
		private ArrayList m_DestY = new ArrayList();
		private ArrayList m_DestZ = new ArrayList();
		private ArrayList m_DestMaps = new ArrayList();
 
		[Constructable]
		public StaffMoongate() : base( 3948 )//moongate
		{
			Movable = false;
			Light = LightType.Circle225;
		}
 
		public StaffMoongate( Serial serial ) : base( serial )
		{
		}
 
		public override bool OnMoveOver( Mobile m )
		{
			if ( m_Destinations.Count > 0 )
			{
				m.SendGump( new StaffMoongateGump( m, this,false ));
			}
			else
			{
				m.SendMessage("The moongate doesn't appear to go anywhere...");
				if ( m.AccessLevel >= AccessLevel.Player )
					m.SendMessage("Double-Click this to configure it");
			}
			return true;
		}
 
		public override void OnDoubleClick( Mobile from ) 
		{
			if ( from.AccessLevel >= [color=red]AccessLevel.Player )[/color]
				from.SendGump(new StaffMoongateGump(from, this,true));
			else
			{
				if ( m_Destinations.Count > 0 )
				{
					if ( Utility.InRange( this.Location, from.Location, 1 ) )
						from.SendGump( new StaffMoongateGump( from, this, false ));
					else
						from.SendMessage("That is too far away");
				}
				else
					from.SendMessage("The moongate doesn't appear to go anywhere...");
			}
		}
 
		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
 
			writer.Write( (int) 0 ); // version
 
			writer.Write( (int)m_Destinations.Count );
			for ( int i = 0; i < m_Destinations.Count; ++i )
			{
				writer.Write( (string)m_Destinations[i] );
				writer.Write( (int)m_DestX[i] );
				writer.Write( (int)m_DestY[i] );
				writer.Write( (int)m_DestZ[i] );
				writer.Write( (int)m_DestMaps[i] );
			}
		}
 
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
 
			int version = reader.ReadInt();
			switch ( version )
			{
				case 0:
				{
					int count = reader.ReadInt();
					for ( int i = 0; i < count; ++i )
					{
						m_Destinations.Add( reader.ReadString() );
						m_DestX.Add( reader.ReadInt() );
						m_DestY.Add( reader.ReadInt() );
						m_DestZ.Add( reader.ReadInt() );
						m_DestMaps.Add( reader.ReadInt() );
					}
					break;
				}
			}
		}
 
		private class StaffMoongateGump : Gump
		{
			private StaffMoongate m_Gate;
			private bool EditMode;
			public void AddTextField( int x, int y, int width, int height, int index )
			{
				AddBackground( x - 2, y - 2, width + 4, height + 4, 0x2486 );
				AddTextEntry( x + 2, y + 2, width - 4, height - 4, 0, index, "" );
			}
 
			public StaffMoongateGump( Mobile from, StaffMoongate gate, bool editmode ) : base( 100,50 )
			{
				EditMode = editmode;
				from.CloseGump( typeof( StaffMoongateGump ) );
				PlayerMobile pm = from as PlayerMobile;
				m_Gate = gate;
				int width = 248;
				if ( EditMode == true )
					width = 435;
				else
					Effects.PlaySound( from.Location, from.Map, 0x20E );
				int height = 224;
				if ( m_Gate.m_Destinations.Count > 3 )
					height = ((m_Gate.m_Destinations.Count*32)+95);//350;//Varies for no. Entries
				AddBackground( 0, 0, width, height, 2600 ); 
				if ( EditMode == true )
					AddLabel( (width/2)-128, 16, 33, "Gate Edit Mode (Walk on to test)" );
				else
					AddLabel( (width/2)-80, 16, 33, "Select your destination" );
				AddPage( 1 );
 
				if ( EditMode == true )
				{
					AddButton( 128, 48, 4029, 4031, 11, GumpButtonType.Reply, 0 );// Add Destination
					AddLabel(160, 48, 33, "Add Destination" );
					AddTextField( 128, 96, 150, 20, 1 );
					AddLabel(128, 72, 33, "Map Dest" );
					AddTextField( 128, 144, 150, 20, 0 );
					AddLabel(128, 120, 33, "Location Name" );
					AddTextField( 148, 168, 80, 20, 2 );
					AddLabel(128, 168, 33, "X" );
					AddTextField( 248, 168, 80, 20, 3 );
					AddLabel(228, 168, 33, "Y" );
					AddTextField( 348, 168, 60, 20, 4 );
					AddLabel(328, 168, 33, "Z" );
				}
 
				for ( int i = 0; i < m_Gate.m_Destinations.Count; ++i )
				{
					AddLabel( 48, (32*i)+40, 33, (string)m_Gate.m_Destinations[i] );
					if ( EditMode == true )
						AddButton( 16, (32*i)+40, 4017, 4019, i+12, GumpButtonType.Reply, 0 );//Del Destination
					else
						AddButton( 16, (32*i)+40, 4005, 4007, i+1, GumpButtonType.Reply, 0 );//Teleport
				}
 
				AddPage( 0 );
			} 
 
			public override void OnResponse( NetState state, RelayInfo info )
			{
				Mobile from = state.Mobile;
				string name = "";
				Point3D dest = new Point3D( 0, 0, 0 );
				string map = "";
				int m_Map = 0;
				int x = 0;
				int y = 0;
				int z = 0;
 
				foreach( TextRelay tr in info.TextEntries )
				{
					switch ( tr.EntryID )
					{
						case 0: //Name
						{
							if ( tr.Text != null )
							{
								if ( tr.Text != "" )
								{
									name = tr.Text;
								}
							}
							break;
						}
						case 1://Map
						{
							if ( tr.Text != null )
							{
								if ( tr.Text != "" )
								{
									map = tr.Text;
								}
							}
							break;
						}
						case 2://X
						{
							if ( tr.Text != null )
							{
								if ( tr.Text != "" )
								{
									x = int.Parse(tr.Text);
								}
							}
							break;
						}
						case 3://Y
						{
							if ( tr.Text != null )
							{
								if ( tr.Text != "" )
								{
									y = int.Parse(tr.Text);
								}
							}
							break;
						}
						case 4://Z
						{
							if ( tr.Text != null )
							{
								if ( tr.Text != "" )
								{
									z = int.Parse(tr.Text);//Convert to Int
								}
							}
							break;
						}
					}
				}
 
				if ( info.ButtonID == 0 )
				{
				}
				else if ( info.ButtonID >= 1 && info.ButtonID <= 10 )
				{//Go
					if ( Utility.InRange( m_Gate.Location, from.Location, 2 ) )
					{
						dest = new Point3D(((int)m_Gate.m_DestX[info.ButtonID-1]), ((int)m_Gate.m_DestY[info.ButtonID-1]), ((int)m_Gate.m_DestZ[info.ButtonID-1]) );
						m_Map = (int)m_Gate.m_DestMaps[info.ButtonID-1];
 
						Map mp = Map.Internal;
						if ( dest == Point3D.Zero )
							dest = from.Location;
 
						if ( m_Map == 0 )
							mp = Map.Felucca;
						else if ( m_Map == 1 )
							mp = Map.Trammel;
						else if ( m_Map == 2 )
							mp = Map.Ilshenar;
						else if ( m_Map == 3 )
							mp = Map.Malas;
 
						if ( m_Map == 0 )
						{
							from.Location = dest;
						}	
						else
						{//Swap comments inside brackets if beta36
							//from.Location = dest;
							//from.Map = (Map)mp;
							from.MoveToWorld( dest, (Map)mp );
						}
 
						Effects.PlaySound( from.Location, from.Map, 0x1FE );
					}
					else
						from.SendMessage("You are too far away");
				}
				else if ( info.ButtonID == 11 )
				{//ADD
					if ( m_Gate.m_Destinations.Count <= 14 )//Change to max. entries, more than about 15 will be offscreen to some players
					{
					if ( ( ( x != 0 ) || ( y != 0 ) ) && ( name != "" ) )
					{
						if ( map == "felucca" || map == "Felucca" )
							m_Gate.m_DestMaps.Add( 0 );
						else if ( map == "trammel" || map == "Trammel" )
							m_Gate.m_DestMaps.Add( 1 );
						else if ( map == "ilshenar" || map == "Ilshenar" )
							m_Gate.m_DestMaps.Add( 2 );
						else if ( map == "malas" || map == "Malas" )
							m_Gate.m_DestMaps.Add( 3 );
						else
						{
							if ( m_Gate.Map == Map.Felucca )
								m_Gate.m_DestMaps.Add( 0 );
							else if ( m_Gate.Map == Map.Trammel )
								m_Gate.m_DestMaps.Add( 1 );
							else if ( m_Gate.Map == Map.Ilshenar )
								m_Gate.m_DestMaps.Add( 2 );
							else if ( m_Gate.Map == Map.Malas )
								m_Gate.m_DestMaps.Add( 3 );
						}
						m_Gate.m_DestX.Add( x );
						m_Gate.m_DestY.Add( y );
						m_Gate.m_DestZ.Add( z );
						m_Gate.m_Destinations.Add( name );
						from.SendMessage("Destination Added");
					}
					else
						from.SendMessage("Please enter at least x, y and Name");
					}
					else
						from.SendMessage("Gump is too full");
					from.SendGump( new StaffMoongateGump( from, m_Gate,true ));
				}
				else if ( info.ButtonID >= 12 && info.ButtonID <= 21 )
				{//DEL
					m_Gate.m_DestMaps.RemoveAt( info.ButtonID-12 );
					m_Gate.m_DestX.RemoveAt( info.ButtonID-12 );
					m_Gate.m_DestY.RemoveAt( info.ButtonID-12 );
					m_Gate.m_DestZ.RemoveAt( info.ButtonID-12 );
					m_Gate.m_Destinations.RemoveAt( info.ButtonID-12 );
					from.SendMessage("Destination removed");
					from.SendGump( new StaffMoongateGump( from, m_Gate,true ));
				}
			}
		}
	}
}
 
Top