1. Hi guys,

    I'm writing a mod and need to retrieve the Rust Server's title and the network port it's running on.

    In Legacy I could do this with Rust.server.hostname and Rust.server.port.

    What are the equivalents in the new version of Oxide for Rust 2.0?

    I've tried using JustCompile, but can't seem to get anywhere.

    Many thanks in advance,
    JV
     
    Last edited by a moderator: May 2, 2015
  2. Wulf

    Wulf Community Admin

    global.server.name and global.server.port
     
  3. I'll give it a whirl as soon as I get in.

    I'm extremely grateful for the reply, Wulf.

    Thanks again =)
     
  4. Is this method outdated?

    I tried:
    Code:
    print( global.server.name )
    Error:
    Code:
    [Oxide] 10:52 PM [Error] Failed to initialize plugin 'messages v1.0.0'
    File: messages.lua Line: 10 attempt to index field 'server' (a nil value):
      at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unkn
    own>:0
      at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System
    .Type[] returnTypes) [0x00000] in <filename unknown>:0
      at NLua.Lua.CallFunction (System.Object function, System.Object[] args) [0x000
    00] in <filename unknown>:0
      at NLua.LuaFunction.Call (System.Object[] args) [0x00000] in <filename unknown
    >:0
      at Oxide.Ext.Lua.Plugins.LuaPlugin.OnCallHook (System.String hookname, System.
    Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Ext.Lua.Plugins.LuaPlugin.HandleAddedToManager (Oxide.Core.Plugins.Pl
    uginManager manager) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.PluginManager.AddPlugin (Oxide.Core.Plugins.Plugin plugi
    n) [0x00000] in <filename unknown>:0
      at Oxide.Core.OxideMod.PluginLoaded (Oxide.Core.Plugins.Plugin plugin) [0x0000
    I tried in C# as well using:
    Code:
    Puts( Convert.ToString( ConVar.Server.fps) );
    I checked the Server.cs file which contains:

    Code:
    namespace ConVar
    {
      [ConsoleSystem.Factory("server")]
      public class Server : ConsoleSystem
      {
        [ConsoleSystem.Admin]
        public static string ip = string.Empty;
        [ConsoleSystem.Admin]
        public static int port = 28015;
        [ConsoleSystem.Admin]
        public static int maxplayers = 500;
        [ConsoleSystem.Admin]
        public static string hostname = "My Untitled Rust Server";
        [ConsoleSystem.Admin]
        public static string identity = "my_server_identity";
        [ConsoleSystem.Admin]
        public static string level = "Procedural Map";
        [ConsoleSystem.Admin]
        public static int saveinterval = 600;
        [ConsoleSystem.Admin]
        public static bool secure = true;
        [ConsoleSystem.Admin]
        public static int tickrate = 10;
        [ConsoleSystem.Admin]
        public static int entityrate = 16;
        [ConsoleSystem.Admin]
        public static bool globalchat = true;
        [ConsoleSystem.Admin]
        public static bool stability = true;
        [ConsoleSystem.Admin]
        public static float npctickrate = 5f;
        [ConsoleSystem.Admin]
        public static float itemdespawn = 180f;
        [ConsoleSystem.Admin]
        public static float aihandlerms = 5f;
        [ConsoleSystem.Admin]
        public static string description = "No server description has been provided.";
        [ConsoleSystem.Admin]
        public static string headerimage = string.Empty;
        [ConsoleSystem.Admin]
        public static string url = string.Empty;
        [ConsoleSystem.Admin]
        public static int eac = 1;
        [ConsoleSystem.Admin]
        [ConsoleSystem.Help("How many entity updates should we send per loop. Setting this > 1000 might cause lag when a player first joins your server.", "")]
        public static int updatebatch = 128;
        [ConsoleSystem.Help("Plants tick every x seconds. This is how many seconds between ticks.", "")]
        [ConsoleSystem.Admin]
        public static float planttick = 60f;
        [ConsoleSystem.Help("Setting this to 2 will make plants grow, fruit and die two times faster than normal.", "")]
        [ConsoleSystem.Admin]
        public static float planttickscale = 1f;
        [ConsoleSystem.Help("Max amount of unacknowledged messages before we assume we're congested", "")]
        [ConsoleSystem.Admin]
        public static int maxunack = 4;
        [ConsoleSystem.Admin]
        public static int seed;
        [ConsoleSystem.Admin]
        public static int salt;
        [ConsoleSystem.Admin]
        public static int worldsize;
        [ConsoleSystem.Admin]
        public static bool official;
        [ConsoleSystem.Admin]
        public static bool radiation;
        [ConsoleSystem.Admin]
        public static bool pve;
    
    but I am unable to find the correct variable.

    However, running the console command "find server" shows this command:
    Code:
     server.fps( void ) no description

    EDIT: I guess I am trying to read a command as a variable. I am not sure how to access the FPS value.
     
    Last edited by a moderator: Dec 5, 2015
  5. Wulf

    Wulf Community Admin

    Pretty much all of that moved to ConVar @Mathias. You can find everything when searching the DLL for that.
     
  6. EDIT:

    It seems like this works:

    Code:
    Puts( Convert.ToString( Performance.frameRate ) );
     
  7. Wulf

    Wulf Community Admin

    Didn't notice that you looked in ConVar already. You should be able to do this too:
    Code:
    Puts(Performance.frameRate.ToString());
    The ToString() may not be needed in all cases either, such as with string interpolation.
     
  8. Yes that works. Thanks for your help.