C#:
using UnityEngine;
using System;
using Oxide.Core;
using Oxide.Core.Plugins;
namespace Oxide.Plugins
{
[Info("Time Command", "chay", "1.0.0")]
[Description("Displays the Server's current time.")]
class TimeCommand : RustPlugin
{
private void OnServerInitialized()
{
permission.RegisterPermission("timecommand.use", this);
}
[ChatCommand("time")]
private void timeCommand(BasePlayer player, string command, string[] args)
{
if (!permission.UserHasPermission(player.UserIDString, "timecommand.use"))
{
player.ChatMessage("You do not have permission to do this...");
return;
}
int hour = Mathf.FloorToInt(TOD_Sky.Instance.Cycle.Hour);
int minute = Mathf.FloorToInt(TOD_Sky.Instance.Cycle.DateTime.Minute);
player.ChatMessage($"The time is currently <color=#00FFFF>{hour}:{minute}</color>");
}
}
}