Иконка ресурса

FREE DisableLandmines : 1.0.0 1.0.0

Нет прав для скачивания
C#:
using System;
using HarmonyLib;
using Oxide.Core.Plugins;
using UnityEngine;

namespace Oxide.Plugins;

[Info("Disable Landmines", "&anhe", "1.0.0")]
[Description("Prevents player landmines from triggering on other players.")]
public class DisableLandmines : RustPlugin
{
    [AutoPatch]
    [HarmonyPatch(typeof(Landmine), nameof(Landmine.ObjectEntered), typeof(GameObject))]
    public static class Landmine_ObjectEntered_Patch
    {
        private static bool Prefix(Landmine __instance, GameObject obj)
        {
            if (__instance.isClient)
                return false;

            if (!__instance.Armed())
            {
                __instance.CancelInvoke(new Action(((BaseTrap)__instance).Arm));
                __instance.blocked = true;
                return false;
            }

            // Trigger if
            if (
                obj.ToBaseEntity() is BasePlayer player &&
                (
                    // Your landmine
                    __instance.OwnerID == player.userID ||
                    // Team’s
                    player.Team
                        ?.members.Contains(__instance.OwnerID) == true
                )
            )
                __instance.Trigger(player);

            return false;
        }
    }
}

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок
Сверху