using Oxide.Core.Plugins;
using Oxide.Game.Rust.Cui;
using UnityEngine;
using System.Collections.Generic;
namespace Oxide.Plugins
{
[Info("ServerMessage", "WuyZar", "1.0.1")]
[Description("Discord : https://discord.gg/NVwRcQwGwh")]
public class ServerMessage : RustPlugin
{
private const string CommandTrue = "sm.true";
private const string CommandFalse = "sm.false";
private const string BackgroundTrue = "https://image.noelshack.com/fichiers/2024/39/3/1727287950-server-message-true.png";
private const string BackgroundFalse = "https://image.noelshack.com/fichiers/2024/39/3/1727287947-server-message-false.png";
[ConsoleCommand(CommandTrue)]
private void ConsoleCommandTrue(ConsoleSystem.Arg arg)
{
HandleMessageCommand(arg, BackgroundTrue);
}
[ConsoleCommand(CommandFalse)]
private void ConsoleCommandFalse(ConsoleSystem.Arg arg)
{
HandleMessageCommand(arg, BackgroundFalse);
}
private void HandleMessageCommand(ConsoleSystem.Arg arg, string backgroundUrl)
{
if (!arg.IsAdmin && arg.Connection != null)
{
arg.ReplyWith("Server Message : \nYou do not have permission to use this command.");
return;
}
string[] args = arg.Args;
if (args == null || args.Length < 2)
{
arg.ReplyWith("Server Message : \nUsage: sm.true