palka, ну их много, есть тот что везде ходит от Lomarine(вечная память - он не сдох еще вроде), но есть иностранный с чаоскода. Можешь скинуть, посмотрю щас и скажу как сделать
я там изменил инфо))
[automerge]1547997544[/automerge]
using System;
using System.Collections.Generic;
using Oxide.Core;
using UnityEngine;
using Physics = UnityEngine.Physics;
namespace Oxide.Plugins
{
[Info("Rec", "Dadya Stepa", "1")]
public class Rec : RustPlugin
{
#region oxidehook
private void OnEntityBuilt(Planner planner, GameObject gameobject)
{
var entity = gameobject.ToBaseEntity();
if (entity == null) return;
if (entity.skinID != skin) return;
var player = planner.GetOwnerPlayer();
if (player == null) return;
entity.Kill();
var ePos = entity.transform.position;
var Recycler = GameManager.server.CreateEntity("assets/bundled/prefabs/static/recycler_static.prefab", ePos, entity.transform.rotation);
Recycler.OwnerID = player.userID;
Recycler.Spawn();
if (entity is BuildingBlock)
{
if (!Recyclers.ContainsKey(entity.net.ID)) Recyclers.Add(entity.net.ID, 0);
Recyclers[entity.net.ID] = Recycler.net.ID;
SaveData();
}
}
#endregion
private bool Radtown, nope, prev, rem, gg;
private void OnHammerHit(BasePlayer player, HitInfo info)
{
var entity = info.HitEntity;
if (entity == null) { return; }
if (30 - player.inventory.containerMain.itemList.Count - player.inventory.containerBelt.itemList.Count < 1)
{
Player.Message(player, "Освободи место!");
return;
}
if (gg)
{
return;
}
if (!entity.ShortPrefabName.Contains("recycler")) return;
if (!gg && !player.CanBuild())
{
Player.Message(player, "Автоизируйся в шкафу!");
return;
}
if (!Radtown && entity.OwnerID == 0)
{
Player.Message(player, "а как же другие? ))");
return;
}
Recycler(player);
entity.Kill();
}
#region stack
private void OnEntityDeath(BaseNetworkable entity, HitInfo info)
{
if (info == null || entity == null) return;
if (entity is BuildingBlock && Recyclers.ContainsKey(entity.net.ID)) DestroyRecycler(entity);
}
private void DestroyRecycler(BaseNetworkable entity)
{
var rEntity = BaseNetworkable.serverEntities.Find(Recyclers[entity.net.ID]);
if (rEntity != null) rEntity.Kill();
Recyclers.Remove(entity.net.ID);
SaveData();
}
private object CanStackItem(Item item, Item targetItem)
{
if (item.info.shortname.Contains("table"))
if (item.skin != 0 || targetItem.skin != 0)
return false;
return null;
}
private object CanCombineDroppedItem(DroppedItem item, DroppedItem targetItem)
{
if (item.item.info.shortname.Contains("table"))
if (item.skinID != 0 || targetItem.skinID != 0)
return false;
return null;
}
#endregion
#region command
[ConsoleCommand("rec")]
private void AddRec(ConsoleSystem.Arg args)
{
if (!args.IsAdmin)
{
return;
}
var player = BasePlayer.Find(args.Args[0]);
if (player == null) return;
Recycler(player);
}
private void Recycler(BasePlayer player)
{
var rec = ItemManager.CreateByName("research.table", 1, skin);
rec.name = "Переработчик";
rec.MoveToContainer(player.inventory.containerMain);
}
private const ulong skin = 1358334523;
#endregion
#region Data
private Dictionary<uint, uint> Recyclers = new Dictionary<uint, uint>();
private const string filename = "PortableRecyclers";
private void LoadData()
{
Recyclers = Interface.Oxide.DataFileSystem.ReadObject<Dictionary<uint, uint>>(filename);
}
private void SaveData()
{
Interface.Oxide.DataFileSystem.WriteObject(filename, Recyclers);
}
#endregion
}
}