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

FREE ProtectAnimals : 1.0.2 1.0.2

Нет прав для скачивания
C#:
namespace Oxide.Plugins;

[Info("Protect Animals", "&anhe", "1.0.2")]
[Description("Reflects damage back to players who hurt animals on foreign property.")]
public class ProtectAnimals : RustPlugin
{
    private object OnEntityTakeDamage(BaseCombatEntity target, HitInfo info) =>
        // Prevent if
        (
            // Target is an animal
            target is BaseAnimalNPC &&
            // Attacked by unauthorised player
            (
                // Attacked by player
                (
                    info.InitiatorPlayer ??
                    BasePlayer.FindByID(info.Initiator?.OwnerID ?? 0)
                ) is BasePlayer attacker &&
                // Not authorised
                target.GetBuildingPrivilege(true)
                    ?.IsAuthed(attacker) == false &&
                // Not admin
                !attacker.IsAdmin &&
                // Reflect damage back to attacker
                ReflectDamage(attacker, info)
            )
        )
            ? false : null;

    #region Reflect damage
    
    bool ReflectDamage(BasePlayer attacker, HitInfo info) {
        attacker.Hurt(
            info.damageTypes.Total(),
            info.damageTypes.GetMajorityDamageType(),
            attacker,
            false
        );

        return true;
    }

    #endregion
}

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