|
||
|
|||||||
| LearnUO Team Irro\'s Team of LearnUO and their Documentation for RunUO |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Expert
|
Ok, tired of the name "Runuo Test Center?"
goto "runuo dir"/scripts/misc/ open "Serverlist.cs" and this is what it looks like. I will bold the part you need to change. I also put italics on the line where you can change your servers public IP. using System; using System.Net; using System.Net.Sockets; using Server; using Server.Network; namespace Server.Misc { public class ServerList { /* Address: * * The default setting, a value of 'null', will attempt to detect your IP address automatically: * private const string Address = null; * * This detection, however, does not work for servers behind routers. If you're running behind a router, put in your IP: * private const string Address = "12.34.56.78"; * * If you need to resolve a DNS host name, you can do that too: * private const string Address = "shard.host.com"; */ public const string Address = "Enter public IP here'; public const string ServerName = "RunUO Test Center"; public static void Initialize() { Listener.Port = 2593; EventSink.ServerList += new ServerListEventHandler( EventSink_ServerList ); } public static void EventSink_ServerList( ServerListEventArgs e ) { try { IPAddress ipAddr; if ( Resolve( Address != null && !IsLocalMachine( e.State ) ? Address : Dns.GetHostName(), out ipAddr ) ) e.AddServer( ServerName, new IPEndPoint( ipAddr, Listener.Port ) ); else e.Rejected = true; } catch { e.Rejected = true; } } public static bool Resolve( string addr, out IPAddress outValue ) { try { outValue = IPAddress.Parse( addr ); return true; } catch { try { IPHostEntry iphe = Dns.Resolve( addr ); if ( iphe.AddressList.Length > 0 ) { outValue = iphe.AddressList[iphe.AddressList.Length - 1]; return true; } } catch { } } outValue = IPAddress.None; return false; } private static bool IsLocalMachine( NetState state ) { Socket sock = state.Socket; IPAddress theirAddress = ((IPEndPoint)sock.RemoteEndPoint).Address; if ( IPAddress.IsLoopback( theirAddress ) ) return true; bool contains = false; IPHostEntry iphe = Dns.Resolve( Dns.GetHostName() ); for ( int i = 0; !contains && i < iphe.AddressList.Length; ++i ) contains = theirAddress.Equals( iphe.AddressList[i] ); return contains; } } } |
|
|
|
|
|
#2 (permalink) |
|
Newbie
Join Date: Nov 2006
Posts: 13
|
I followed the instructions to the T to change the IP because I am behind a router. I am getting several errors. Help?
-Error: Scripts\Misc\ServerList.cs: CS1002: <line23, column 38> <line25, column 48> -Error: Scripts\Misc\ServerList.cs: CS1519 <line25, column 57> Those are the errors, and here is what my Serverlist.cs looks like as of right now. using System; using System.Net; using System.Net.Sockets; using Server; using Server.Network; namespace Server.Misc { public class ServerList { /* Address: * * The default setting, a value of 'null', will attempt to detect your IP address automatically: * private const string Address = null; * * This detection, however, does not work for servers behind routers. If you're running behind a router, put in your IP: * private const string Address = "12.34.56.78"; * * If you need to resolve a DNS host name, you can do that too: * private const string Address = "shard.host.com"; */ public const string Address = 12.38.240.252'; public const string ServerName = Everlasting Darkness'; public static void Initialize() { Listener.Port = 2593; EventSink.ServerList += new ServerListEventHandler( EventSink_ServerList ); } public static void EventSink_ServerList( ServerListEventArgs e ) { try { IPAddress ipAddr; if ( Resolve( Address != null && !IsLocalMachine( e.State ) ? Address : Dns.GetHostName(), out ipAddr ) ) e.AddServer( ServerName, new IPEndPoint( ipAddr, Listener.Port ) ); else e.Rejected = true; } catch { e.Rejected = true; } } public static bool Resolve( string addr, out IPAddress outValue ) { try { outValue = IPAddress.Parse( addr ); return true; } catch { try { IPHostEntry iphe = Dns.Resolve( addr ); if ( iphe.AddressList.Length > 0 ) { outValue = iphe.AddressList[iphe.AddressList.Length - 1]; return true; } } catch { } } outValue = IPAddress.None; return false; } private static bool IsLocalMachine( NetState state ) { Socket sock = state.Socket; IPAddress theirAddress = ((IPEndPoint)sock.RemoteEndPoint).Address; if ( IPAddress.IsLoopback( theirAddress ) ) return true; bool contains = false; IPHostEntry iphe = Dns.Resolve( Dns.GetHostName() ); for ( int i = 0; !contains && i < iphe.AddressList.Length; ++i ) contains = theirAddress.Equals( iphe.AddressList[i] ); return contains; } } } The areas that are in bold in the script is where the problem is coming from I think, but I dont know what is the problem. |
|
|
|
|
|
#3 (permalink) |
|
ConnectUO Creator
Join Date: Jan 2004
Location: In your mom
Age: 27
Posts: 4,763
|
public const string ServerName = Everlasting Darkness';
is spose to be a string, a string is defined by putting the words in quotes. public const string ServerName = "Everlasting Darkness"; See the difference?
__________________
Jeff Boulanger ConnectUO - Core Developer Want to help make ConnectUO better? Click here to submit your ideas/requests Use your talent to compete against other community members in RunUO hosted coding competitions If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team. Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|