Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Rocket.API;
- using Rocket.Core.Plugins;
- using Rocket.Unturned.Player;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace UBans
- {
- public class UbanCommand : IRocketCommand
- {
- public AllowedCaller AllowedCaller => AllowedCaller.Player;
- public string Name => "UBan";
- public string Help => "/UBan [Player] [Reason]";
- public string Syntax => "<player> <Reason>";
- public List<string> Aliases => new List<string>() {"uban","UBAN"};
- public List<string> Permissions => new List<string>() { "staff" };
- public void Execute(IRocketPlayer caller, string[] command)
- {
- UnturnedPlayer target = UnturnedPlayer.FromName(command[0]);
- UbanCore test = new UbanCore();
- string BanType = command[1].ToLower();
- test.BanSystem(target,BanType,caller);
- }
- }
- public class UbanCore : RocketPlugin <UbanConfig>
- {
- public static int ReasonCode1 = 1;
- public static int ReasonCode2 = 2;
- public static int ReasonCode3 = 3;
- public static int ReasonCode4 = 4;
- public string directory = System.IO.Directory.GetCurrentDirectory() + "/..";
- public static UbanCore instance;
- protected override void Load()
- {
- instance = this;
- if (File.Exists(directory + "/UBans.txt"))
- {
- Rocket.Core.Logging.Logger.Log(directory + "UBans Has Been Loaded");
- }
- else
- {
- File.CreateText(directory + "/UBans.txt");
- Rocket.Core.Logging.Logger.Log(directory + "UBans Has Created Bans Folder....");
- }
- }
- protected override void Unload()
- {
- instance = null;
- }
- public void BanSystem(UnturnedPlayer target, string BanType, IRocketPlayer caller)
- {
- if (BanType == "masskos" || BanType.Substring(0,5) == "masskos".Substring(0,5) && caller.HasPermission(instance.Configuration.Instance.MassKP))
- {
- target.Ban("MassKos", instance.Configuration.Instance.MassKos);
- }
- else if (BanType == "massvdm" || BanType.Substring(0, 5) == "massvdm".Substring(0, 5) && caller.HasPermission(instance.Configuration.Instance.MassVdmP))
- {
- target.Ban("MassVdm", instance.Configuration.Instance.MassVdm);
- }
- else if (BanType == "micspam" || BanType.Substring(0, 5) == "micspam".Substring(0, 5) && caller.HasPermission(instance.Configuration.Instance.MicspamP))
- {
- target.Ban("MicSpam", instance.Configuration.Instance.MicSpam);
- }
- else if (BanType == "minge" || BanType.Substring(0, 3) == "minge".Substring(0, 3) && caller.HasPermission(instance.Configuration.Instance.MingeP))
- {
- target.Ban("Minge", instance.Configuration.Instance.Minge);
- BanWriter(target, ReasonCode4);
- }
- }
- public void BanWriter(UnturnedPlayer target, int ReasonCode)
- {
- using (StreamWriter w = File.AppendText(directory + "/UBans"))
- {
- w.WriteLine((ulong)target.CSteamID + (ulong)ReasonCode);
- w.Close();
- }
- }
- }
- public class UbanConfig : IRocketPluginConfiguration
- {
- public uint MassKos;
- public uint MassVdm;
- public uint Minge;
- public uint MicSpam;
- public string MassKP;
- public string MassVdmP;
- public string MingeP;
- public string MicspamP;
- public void LoadDefaults()
- {
- MassKos = 99999999;
- MassVdm = 99999999;
- Minge = 999999999;
- MicSpam = 500;
- MassKP = "U.BanMassK";
- MassVdmP = "U.MassVdmP";
- MingeP = "U.MineP";
- MicspamP = "U.MicP";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement