Skip to content

Commit

Permalink
add ghost ability
Browse files Browse the repository at this point in the history
  • Loading branch information
JustMarfix committed Oct 27, 2024
1 parent 220684b commit ca8b47c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions Commands/VudGhost.cs
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;
}
}
}
1 change: 1 addition & 0 deletions VeryUsualDay.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
<Compile Include="Commands\SupplyCassie.cs" />
<Compile Include="Commands\VudClassD.cs" />
<Compile Include="Commands\VudClear.cs" />
<Compile Include="Commands\VudGhost.cs" />
<Compile Include="Commands\VudGuard.cs" />
<Compile Include="Commands\VudMedic.cs" />
<Compile Include="Commands\VudMood.cs" />
Expand Down

0 comments on commit ca8b47c

Please sign in to comment.