C#:
using Oxide.Core;
using Oxide.Core.Plugins;
using UnityEngine;
using System.Collections.Generic;
namespace Oxide.Plugins
{
[Info("FixCargoShipDoors", "chatgpt", "1.0.0")]
[Description("Удаляет сломанные или 'зависшие' двери cargo_ship_side")]
public class FixCargoShipDoors : RustPlugin
{
[Command("fixshipdoors")]
private void CmdFixDoors(ConsoleSystem.Arg arg)
{
int removed = 0;
foreach (BaseNetworkable ent in BaseNetworkable.serverEntities)
{
if (ent == null || ent.IsDestroyed) continue;
string prefab = ent?.ShortPrefabName;
if (string.IsNullOrEmpty(prefab)) continue;
if (prefab == "door.hinged.cargo_ship_side")
{
BaseEntity entity = ent as BaseEntity;
if (entity != null && !entity.IsDestroyed)
{
removed++;
entity.Kill();
}
}
}
if (arg?.Player() != null)
arg.ReplyWith($"Удалено дверей cargo_ship_side: {removed}");
else
Puts($"Удалено дверей cargo_ship_side: {removed}");
}
}
}