C#:
using System;
using Facepunch.Math;
using Oxide.Core;
using Oxide.Core.Plugins;
namespace Oxide.Plugins
{
[Info("FreeOnline", "Uberhatchet", "0.0.1")]
public class FreeOnline : RustPlugin
{
public static int Online = 30;
private int m_cacheCount = 0;
void UpdateCurentOnline()
{
this.m_cacheCount = BasePlayer.activePlayerList.Count + 3;
if (this.m_cacheCount >= ConVar.Server.maxplayers)
this.m_cacheCount = ConVar.Server.maxplayers - 1;
}
private string AssemblyHash = string.Empty;
[HookMethod("OnServerInitialized")]
void OnServerInitialized()
{
this.UpdateCurentOnline();
timer.Repeat(1, 0, UpdateCurentOnline);
timer.Repeat(0.01f, 0, () =>
{
if (string.IsNullOrEmpty(AssemblyHash) && string.IsNullOrEmpty(Rust.Global.SteamServer.GameTags) == false)
{
int startLen = Rust.Global.SteamServer.GameTags.IndexOf(",h", StringComparison.Ordinal);
string tmp = Rust.Global.SteamServer.GameTags.Substring(startLen + 2, 4);
if (tmp != "null" && tmp[0] != ',')
{
AssemblyHash = Rust.Global.SteamServer.GameTags.Substring(startLen + 2, 7);
this.Puts("Detected Hash: " + AssemblyHash);
}
}
string text = "stok";
string text2 = string.Format("born{0}", Epoch.FromDateTime(global::SaveRestore.SaveCreatedTime));
string text3 = string.Format("mp{0},cp{1},qp{5},v{2}{3},h{4},{6},{7}", new object[]
{
ConVar.Server.maxplayers,
m_cacheCount,
Rust.Protocol.network,
(!ConVar.Server.pve) ? string.Empty : ",pve",
AssemblyHash,
0,
text,
text2
});
if (Interface.Oxide.Config.Options.Modded)
text3 += ",modded,oxide";
Rust.Global.SteamServer.GameTags = text3;
});
}
}
}