using System.Collections.Generic; using Oxide.Core; using Oxide.Core.Plugins; using UnityEngine; namespace Oxide.Plugins { [Info("AdminKick", "Ali", "1.0.0")] [Description("Allows admins or player to kick any player from the server")] public class AdminKick : RustPlugin { private void Init() { permission.RegisterPermission("adminkick.use", this); } [ChatCommand("kick")] private void KickCommand(BasePlayer player, string command, string[] args) { if (!permission.UserHasPermission(player.UserIDString, "adminkick.use")) { SendReply(player, "You don't have permission to use this command!"); return; } if (args.Length < 2) { SendReply(player, "Usage: /kick "); return; } string targetName = args[0]; BasePlayer targetPlayer = FindPlayerByName(targetName); if (targetPlayer == null) { SendReply(player, $"Player '{targetName}' not found!"); return; } string kickMessage = string.Join(" ", args, 1, args.Length - 1); targetPlayer.Kick(kickMessage); SendReply(player, $"Player '{targetName}' has been kicked from the server with the message: {kickMessage}"); } private BasePlayer FindPlayerByName(string name) { foreach (BasePlayer player in BasePlayer.activePlayerList) { if (player.displayName.ToLower().Contains(name.ToLower())) { return player; } } return null; } } }