C#:
using System.Collections.Generic;
using System;
using System.Linq;
using Steamworks;
using Oxide.Core.Plugins;
using System.Reflection;
using Newtonsoft.Json;
using UnityEngine;
using ProtoBuf;
using Oxide.Core;
using Rust;
using Facepunch.Math;
namespace Oxide.Plugins {
[Info("Fake Online Steam", "15FPS", "1.0.1")]
class SteamFakeOnline : RustPlugin {
private class Configuration {
[JsonProperty("'Time': Online")]
public Dictionary<Int32, Int32> ManualTimeOnline = new Dictionary<Int32, Int32>();
public static Configuration Generate() {
return new Configuration {
ManualTimeOnline = new Dictionary<int, int> {
[00]
= 3, [01] = 3, [02] = 3, [03] = 3, [04] = 2, [05] = 2, [06] = 5, [07] = 4, [08] = 5, [09] = 7, [10] = 7, [11] = 8, [12] = 12, [13] = 13, [14] = 16, [15] = 19, [16] = 20, [17] = 21, [18] = 24, [19] = 27, [20] = 29, [21] = 22, [22] = 15, [23] = 7,
}
}
;
}
}
private static Configuration Settings;
protected override void LoadConfig() {
base.LoadConfig();
try {
Settings = Config.ReadObject<Configuration>();
}
catch {
PrintWarning($"Error reading config, creating one new config!");
LoadDefaultConfig();
}
SaveConfig();
}
protected override void LoadDefaultConfig() => Settings = Configuration.Generate();
protected override void SaveConfig() => Config.WriteObject(Settings);
public int FakeOnline = 0;
private Timer timerGenerateOnline;
public class FakePlayer {
public String UserID;
public string DisplayName;
}
void OnServerInitialized() {
timerGenerateOnline = timer.Every(2, () => {
Int32 Time = DateTime.Now.Hour;
Int32 ManualOnline = Settings.ManualTimeOnline.ContainsKey(Time) ? Settings.ManualTimeOnline[Time] : 0;
FakeOnline = ManualOnline;
IOnUpdateServerInformation(FakeOnline);
}
);
}
void Unload() {
if (timerGenerateOnline != null && !timerGenerateOnline.Destroyed) timerGenerateOnline.Destroy();
}
private void IOnUpdateServerInformation(int count) {
string text = "stok";
string text2 = $"born{Epoch.FromDateTime(SaveRestore.SaveCreatedTime)}";
string text3 = $"gm{ConVar.Server.gamemode}";
string text4 = $"wolfua,oxide,modded";
SteamServer.GameTags = $"mp{ConVar.Server.maxplayers},cp{BasePlayer.activePlayerList.Count + count},pt{Network.Net.sv.ProtocolId},qp{SingletonComponent<ServerMgr>.Instance.connectionQueue.Queued},v{Protocol.network},{ConVar.Server.tags},fl{BasePlayer.activePlayerList.Count + count},hil2cpp,{text},{text2},{text3},{text4}";
}
int GetOnline() => FakeOnline;
}
}