|
| 1 | +using System; |
| 2 | +using Exiled.API.Features; |
| 3 | +using CommandSystem; |
| 4 | +using Exiled.Permissions.Extensions; |
| 5 | +using Exiled.CustomRoles.API.Features; |
| 6 | +using SCP_600V.Extension; |
| 7 | +using SCP_600V.API.Role; |
| 8 | + |
| 9 | +namespace SCP_600V.Command |
| 10 | +{ |
| 11 | + [CommandHandler(typeof(RemoteAdminCommandHandler))] |
| 12 | + internal class Spawn : ICommand |
| 13 | + { |
| 14 | + public string Command { get; set; } = "SpawnScp600"; |
| 15 | + |
| 16 | + public string[] Aliases { get; set; } = { "S600", "sp6", "scp600" }; |
| 17 | + |
| 18 | + public string Description { get; set; } = "Spawn your as scp-600v\nsp6 <userID>"; |
| 19 | + |
| 20 | + public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) |
| 21 | + { |
| 22 | + Player writer = Player.Get(sender); |
| 23 | + if (writer != null) |
| 24 | + { |
| 25 | + if (writer.CheckPermission("s6.SelfSpawn")) |
| 26 | + { |
| 27 | + if (arguments.Count == 0) |
| 28 | + { |
| 29 | + if (writer.Role.Type != PlayerRoles.RoleTypeId.Spectator) |
| 30 | + { |
| 31 | + if (RoleGet.IsScp600(writer)) |
| 32 | + { |
| 33 | + CustomRole.Get(typeof(Scp600CotumRoleBase)).AddRole(writer); |
| 34 | + response = "Your are forced class to SCP-600V"; |
| 35 | + return true; |
| 36 | + } |
| 37 | + else |
| 38 | + { |
| 39 | + response = "? your are scp-600 now"; |
| 40 | + return false; |
| 41 | + } |
| 42 | + } |
| 43 | + if (writer.Role.Type == PlayerRoles.RoleTypeId.Spectator) |
| 44 | + { |
| 45 | + response = Sai.Instance.Config.SpawnCommandEr; |
| 46 | + return false; |
| 47 | + } |
| 48 | + } |
| 49 | + else |
| 50 | + { |
| 51 | + Player neded = Player.Get(arguments.At(0)); |
| 52 | + if (neded != null) |
| 53 | + { |
| 54 | + if (neded.Role.Type == PlayerRoles.RoleTypeId.Spectator) |
| 55 | + { |
| 56 | + response = Sai.Instance.Config.SpawnCommandEr; |
| 57 | + return false; |
| 58 | + } |
| 59 | + if (RoleGet.IsScp600(neded)) |
| 60 | + { |
| 61 | + CustomRole.Get(typeof(Scp600CotumRoleBase)).AddRole(neded); |
| 62 | + response = $"Player {neded.Nickname} spawned as SCP-600V"; |
| 63 | + return true; |
| 64 | + } |
| 65 | + else |
| 66 | + { |
| 67 | + response = "? is scp-600 playing now"; |
| 68 | + return false; |
| 69 | + } |
| 70 | + } |
| 71 | + if (neded == null) |
| 72 | + { |
| 73 | + response = Sai.Instance.Config.PlayerNF; |
| 74 | + return false; |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | + else |
| 79 | + { |
| 80 | + response = Sai.Instance.Config.PermissionDenied; |
| 81 | + return false; |
| 82 | + } |
| 83 | + } |
| 84 | + response = "Idk"; |
| 85 | + return false; |
| 86 | + } |
| 87 | + } |
| 88 | +} |
0 commit comments