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

FREE NoFreeSpray : 0.0.2 0.0.2

Нет прав для скачивания
C#:
// Reference: 0Harmony

using HarmonyLib;
using System.Collections.Generic;
using System.Reflection.Emit;
using UnityEngine;
using System.Linq;
using Facepunch;

namespace Oxide.Plugins
{
    [Info("No Free Spray", "ViolationHandler", "0.0.2")]
    [Description("Prevents ALL users from using Free Spray with Spray Cans.")]
    public class NoFreeSpray : RustPlugin
    {

        private Harmony _harmonyInstance;

        private void Loaded()
        {
            _harmonyInstance = new Harmony("com.ViolationHandler" + Name);

            _harmonyInstance.Patch(AccessTools.Method(typeof(SprayCan), nameof(SprayCan.CanSprayFreehand)), transpiler: new HarmonyMethod(typeof(SprayFreehandFix), nameof(SprayFreehandFix.Transpiler)));
        }
        private void Unload()
        {
            _harmonyInstance?.UnpatchAll(_harmonyInstance.Id);
        }

        public class SprayFreehandFix
        {
            internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
            {
                List<CodeInstruction> list = instructions.ToList();
                list.InsertRange(0, new List<CodeInstruction>
                {
                    new CodeInstruction(OpCodes.Ldc_I4_0),
                    new CodeInstruction(OpCodes.Ret)
                });
                return list;
            }
        }

    }
}

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