Advertisement
FlyFar

Admin Toolkit Panel: Ban/Add/Terminate

Jun 5th, 2023
820
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.35 KB | Cybersecurity | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. /* Hello! this is a script to ban/terminate/add players to a game. This is a script inside the game software called "Admin Toolkit Panel". (ATP) */
  4. public class Player
  5. {
  6.     public string Name { get; set; }
  7.     public bool IsBanned { get; set; }
  8.     public bool IsTerminated { get; set; }
  9. }
  10.  
  11. public class PlayerManager
  12. {
  13.     private List<Player> players;
  14.  
  15.     public PlayerManager()
  16.     {
  17.         players = new List<Player>();
  18.     }
  19.  
  20.     public void AddPlayer(string playerName)
  21.     {
  22.         players.Add(new Player { Name = playerName });
  23.     }
  24.  
  25.     public void BanPlayer(string playerName)
  26.     {
  27.         Player player = FindPlayer(playerName);
  28.         if (player != null)
  29.         {
  30.             player.IsBanned = true;
  31.             Console.WriteLine($"Player '{playerName}' has been banned.");
  32.         }
  33.         else
  34.         {
  35.             Console.WriteLine($"Player '{playerName}' not found.");
  36.         }
  37.     }
  38.  
  39.     public void TerminatePlayer(string playerName)
  40.     {
  41.         Player player = FindPlayer(playerName);
  42.         if (player != null)
  43.         {
  44.             player.IsTerminated = true;
  45.             Console.WriteLine($"Player '{playerName}' has been terminated.");
  46.         }
  47.         else
  48.         {
  49.             Console.WriteLine($"Player '{playerName}' not found.");
  50.         }
  51.     }
  52.  
  53.     private Player FindPlayer(string playerName)
  54.     {
  55.         return players.Find(p => p.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase));
  56.     }
  57. }
  58.  
  59. public class ToolkitPanel
  60. {
  61.     private PlayerManager playerManager;
  62.  
  63.     public ToolkitPanel()
  64.     {
  65.         playerManager = new PlayerManager();
  66.     }
  67.  
  68.     public void Run()
  69.     {
  70.         Console.WriteLine("Welcome to the Toolkit Panel!");
  71.  
  72.         bool isRunning = true;
  73.         while (isRunning)
  74.         {
  75.             Console.WriteLine("\nEnter a command (add, ban, terminate, exit):");
  76.             string command = Console.ReadLine();
  77.  
  78.             switch (command.ToLower())
  79.             {
  80.                 case "add":
  81.                     Console.WriteLine("Enter player name:");
  82.                     string playerName = Console.ReadLine();
  83.                     playerManager.AddPlayer(playerName);
  84.                     Console.WriteLine($"Player '{playerName}' added.");
  85.                     break;
  86.  
  87.                 case "ban":
  88.                     Console.WriteLine("Enter player name to ban:");
  89.                     string playerToBan = Console.ReadLine();
  90.                     playerManager.BanPlayer(playerToBan);
  91.                     break;
  92.  
  93.                 case "terminate":
  94.                     Console.WriteLine("Enter player name to terminate:");
  95.                     string playerToTerminate = Console.ReadLine();
  96.                     playerManager.TerminatePlayer(playerToTerminate);
  97.                     break;
  98.  
  99.                 case "exit":
  100.                     isRunning = false;
  101.                     Console.WriteLine("Exiting the Toolkit Panel.");
  102.                     break;
  103.  
  104.                 default:
  105.                     Console.WriteLine("Invalid command. Please try again.");
  106.                     break;
  107.             }
  108.         }
  109.     }
  110. }
  111.  
  112. public class Program
  113. {
  114.     public static void Main()
  115.     {
  116.         ToolkitPanel toolkitPanel = new ToolkitPanel();
  117.         toolkitPanel.Run();
  118.     }
  119. }
  120.  
Tags: Toolkit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement