Hello, someone once created the plugin for me. But I no longer have contact with them. Can anyone help me get it working again?
Error while compiling Common: 'PlayerInventory' does not contain a definition for 'AllItems' and no accessible extension method 'AllItems' accepting a first argument of type 'PlayerInventory' could be found (are you missing a using directive or an assembly reference?) | Line: 34, Pos: 48
using System;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
using Oxide.Core;
using Random = System.Random;
namespace Oxide.Plugins
{
[Info("Common", "whazza", "0.0.1")]
public class Common : RustPlugin
{
#region EconomyMiddleware
private void OnEconomicsDeposit(string playerId, double amount)
{
var player = BasePlayer.Find(playerId);
if (!player) return;
if (player.IsAlive())
{
player.GiveItem(ItemManager.CreateByItemID(-932201673, (int)Math.Round(amount, 0)), BaseEntity.GiveItemReason.PickedUp);
}
}
private void OnEconomicsWithdrawl(string playerId, double amount)
{
var player = BasePlayer.Find(playerId);
if (!player) return;
if (!player.IsAlive()) return;
var playerItems = player.inventory.AllItems();
var am = (int) amount;
if (ItemCount(playerItems, "scrap", 0) < am) return;
player.inventory.Take(null, -932201673, am);
}
private static int ItemCount(IEnumerable<Item> items, string shortname, ulong skin)
{
return items.Where(item => item.info.shortname == shortname && !item.isBroken && (skin == 0 || item.skin == skin)).Sum(item => item.amount);
}
#endregion
}
}