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
Solved Getting server title and port (Lua)
Discussion in 'Rust Development' started by Richard Ellis, May 2, 2015.
-
Wulf Community Admin
global.server.name and global.server.port
-
I'll give it a whirl as soon as I get in.
I'm extremely grateful for the reply, Wulf.
Thanks again =) -
I tried:
Code:print( global.server.name )
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
Code:Puts( Convert.ToString( ConVar.Server.fps) );
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;
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 -
Wulf Community Admin
Pretty much all of that moved to ConVar @Mathias. You can find everything when searching the DLL for that.
-
EDIT:
It seems like this works:
Code:Puts( Convert.ToString( Performance.frameRate ) );
-
Wulf Community Admin
Code:Puts(Performance.frameRate.ToString());
-