C#:
using System;
using System.Linq;
using UnityEngine;
using Rust;
namespace Oxide.Plugins
{
[Info("Wod", "sdapro", "1.0.4")]
//YouTube https://www.youtube.com/channel/UCaatLYzqycP6He7TEbK-IDA
//https://t.me/+jb13FvJyK4o5MTli
public class Wod : RustPlugin
{
#region Hooks
private void OnEntitySpawned(BaseNetworkable entity)
{
if (entity != null && entity.name.Contains ("hemp.entity") || entity.name.Contains("debris.wood.external.wall") || entity.name.Contains("debris.stone.external.wall"))
{
timer.Once(despawnTimer, () =>
{
if(!entity.IsDestroyed)
entity?.Kill();
});
}
}
void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo)
{
var player = entity as BasePlayer;
if (player != null && hitInfo.damageTypes.Has(DamageType.Bleeding))
{
hitInfo.damageTypes.Set(DamageType.Bleeding, 0); // устанавливаем урон кровотечения в 0
player.metabolism.bleeding.value = 0; // устанавливаем уровень кровотечения в 0
}
}
#endregion
#region Config
private int despawnTimer;
private new void LoadConfig()
{
GetConfig(ref despawnTimer, "Settings", "Despawn timer (seconds)");
SaveConfig();
}
private void Init() => LoadConfig();
private void GetConfig<T>(ref T variable, params string[] path)
{
if (path.Length == 0)
return;
if (Config.Get(path) == null)
{
Config.Set(path.Concat(new object[] { variable }).ToArray());
}
variable = (T)Convert.ChangeType(Config.Get(path), typeof(T));
}
protected override void LoadDefaultConfig() => PrintWarning("Generating new configuration file...");
#endregion
}
}