C#:
using System.Linq;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("SafeZone loot fix", "turner#7777", "1.0.0")]
[Description("Fixes a long standing bug where a player that goes outside a safezone can loot player's bodies inside the safezone")]
public class SafeZoneLootFix : RustPlugin
{
object CanLootEntity(BasePlayer player, DroppedItemContainer container) => CanLoot(player, container);
object CanLootEntity(BasePlayer player, LootableCorpse corpse) => CanLoot(player, corpse);
object CanLoot(BasePlayer looter, BaseCombatEntity lootedEntity)
{
if (Physics.OverlapSphere(lootedEntity.transform.position, 0).Any(c => c.name.Contains("SafeZone")))
{
return false;
}
else
{
return null;
}
}
}
}