C#:
// ============================================================================
// Plugin: Last Wipe Map Info
// Author: fullwiped
// Version: 1.0.0
// Official Source: https://codefling.com/fullwiped
//
// Description:
// Displays the last wipe age dynamically in the server browser map field
// using Rust's SaveCreatedTime. Helps server owners provide clear info to players.
//
// Notice:
// This plugin is free to use and must not be sold under any circumstances.
// Provided under the fullwiped brand.
// Updates may be released if necessary, but no future update guarantee is provided.
// ============================================================================
using System;
using Oxide.Plugins;
using Steamworks;
namespace Oxide.Plugins
{
[Info("Last Wipe Map Info", "fullwiped", "1.0.0")]
[Description("Displays wipe age in the map field using Rust's SaveCreatedTime.")]
public class LastWipeMapInfo : RustPlugin
{
private string _cachedMapName;
private DateTime _wipeTime;
private void OnServerInitialized()
{
_wipeTime = SaveRestore.SaveCreatedTime.ToLocalTime();
Puts($"[LastWipeMapInfo] Wipe time detected: {_wipeTime} | Source: https://codefling.com/fullwiped");
UpdateMapName();
timer.Every(300f, UpdateMapName); // update every 5 minutes
}
private string GetRelativeTime(DateTime date)
{
var span = DateTime.Now - date;
if (span.TotalMinutes < 1)
return "just now";
if (span.TotalMinutes < 60)
return $"{(int)span.TotalMinutes} minutes ago";
if (span.TotalHours < 24)
return $"{(int)span.TotalHours} hours ago";
if (span.TotalDays < 30)
return $"{(int)span.TotalDays} days ago";
return $"{(int)(span.TotalDays / 30)} months ago";
}
private void UpdateMapName()
{
string newName = $"Wiped {GetRelativeTime(_wipeTime)}";
if (_cachedMapName == newName) return;
_cachedMapName = newName;
SteamServer.MapName = _cachedMapName;
Puts($"[LastWipeMapInfo] Map name updated: {_cachedMapName}");
}
private void OnServerInformationUpdated()
{
if (!string.IsNullOrEmpty(_cachedMapName))
{
SteamServer.MapName = _cachedMapName;
}
}
[ConsoleCommand("lastwipemapinfo")]
private void CmdWipeInfo(ConsoleSystem.Arg arg)
{
if (arg.Connection != null && arg.Connection.authLevel < 2) return;
arg.ReplyWith($"Wipe started: {_wipeTime} | Age: {GetRelativeTime(_wipeTime)}");
}
}
}