-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
220684b
commit ca8b47c
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Linq; | ||
using CommandSystem; | ||
using Exiled.API.Features; | ||
using Exiled.API.Features.Roles; | ||
|
||
namespace VeryUsualDay.Commands | ||
{ | ||
[CommandHandler(typeof(RemoteAdminCommandHandler))] | ||
public class VudGhost : ICommand | ||
{ | ||
public string Command => "vudghost"; | ||
public string[] Aliases => null; | ||
public string Description => "Использование: vudghost ghostId targetIds. Делает/отменяет действие игрока невидимым для всех, кроме targets."; | ||
|
||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
if (!VeryUsualDay.Instance.IsEnabledInRound) | ||
{ | ||
response = "Режим FX не включён."; | ||
return false; | ||
} | ||
|
||
var args = arguments.ToArray(); | ||
var targets = args.Skip(1).ToArray(); | ||
if (!Player.TryGet(args[0], out var ghost)) | ||
{ | ||
response = "Не удалось получить человека по ID."; | ||
return false; | ||
} | ||
if (!ghost.Role.Is<FpcRole>(out var fpcRole)) | ||
{ | ||
response = "Призрак не имеет роль, которая может быть видна другим."; | ||
return false; | ||
} | ||
|
||
foreach (var player in Player.List.ToList().Where(p => !targets.Contains(p.Id.ToString()))) | ||
{ | ||
if (!fpcRole.IsInvisibleFor.Add(player)) | ||
{ | ||
fpcRole.IsInvisibleFor.Remove(player); | ||
} | ||
} | ||
|
||
response = "Успешно!"; | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters