C#:
// Все права принадлежат дискорд сообществу https://discord.gg/VgNHPpNrz6
using System.Collections.Generic;
namespace Oxide.Plugins
{
[Info("LootProtection", "Wulf/lukespragg", "0.3.1")]
[Description("Protects players with permission from being looted by other players")]
class LootProtection : CovalencePlugin
{
// Do NOT edit this file, instead edit LootProtection.en.json in the oxide/lang directory,
// or create a new language file for another language using the 'en' file as a default
#region Initialization
const string permBypass = "lootprotection.bypass";
const string permProtect = "lootprotection.enabled";
void Init()
{
permission.RegisterPermission(permBypass, this);
permission.RegisterPermission(permProtect, this);
lang.RegisterMessages(new Dictionary<string, string> { ["LootProtection"] = "{0} has loot protection enabled" }, this);
}
#endregion
#region Loot Protection
#if RUST
object OnLootEntity(BasePlayer player, BaseEntity entity)
{
var target = entity as BasePlayer;
if (target == null) return null;
if (!HasPerm(target.UserIDString, permProtect) || HasPerm(player.UserIDString, permBypass)) return null;
NextFrame(player.EndLooting);
player.ChatMessage(Lang("LootProtection", player.UserIDString, target.displayName));
return true;
}
#endif
#endregion
#region Helpers
string Lang(string key, string id = null, params object[] args) => string.Format(lang.GetMessage(key, this, id), args);
bool HasPerm(string id, string perm) => permission.UserHasPermission(id, perm);
#endregion
}
}