i have a plugin that gives the player 2 items, everytime that bit of code is reached i get the RPC Error In MoveItem message
RPC error when moving an itemSolved
With out seeing that bit of code and the error cant help mutch.
mk
object CanMoveItem(Item item, PlayerInventory playerLoot, uint targetContainer, int targetSlot, int amount)
{
if (item == itemstop[playerLoot.GetComponent<BasePlayer>() .UserIDString])
{
itemstopbox[playerLoot.GetComponent<BasePlayer>().UserIDString].Kill();
foreach(var i in playerLoot.GetComponent<BasePlayer>().inventory.containerMain.itemList)
{
i.Remove();
}
foreach (var i in playerLoot.GetComponent<BasePlayer>().inventory.containerBelt.itemList)
{
i.Remove();
}
foreach (var i in playerLoot.GetComponent<BasePlayer>().inventory.containerWear.itemList)
{
i.Remove();
}
Item bnoc = ItemManager.CreateByItemID(-1262185308);
Item bnoc2 = ItemManager.CreateByItemID(-1266045928);
bnoc.MoveToContainer(playerLoot.GetComponent<BasePlayer>().inventory.containerBelt);
bunnysuit.MoveToContainer(playerLoot.GetComponent<BasePlayer>().inventory.containerWear);
return false;
}
return null; Forstarts i would add a
BasePlayer player = playerLoot.GetComponent<BasePlayer>();
if (player == null) return null;also i would check to make sure ther inventory is not full to be able to take the item.. also add a check to see if bnoc and bnoc2 is null
Try this object CanMoveItem(Item item, PlayerInventory playerLoot, uint targetContainer, int targetSlot, int amount)
{
BasePlayer player = playerLoot.GetComponent<BasePlayer>();
if (player == null) return null;
if (!itemstop.ContainsKey(player.UserIDString)) return null;
if (itemstopbox[player.UserIDString] == null) return null;
if (item == itemstop[player.UserIDString])
{
itemstopbox[player.UserIDString].Kill();
if (player.inventory.containerMain.itemList.Count >= 1)
foreach(var i in player.inventory.containerMain.itemList)
{
i.Remove();
}
if (player.inventory.containerBelt.itemList.Count >= 1)
foreach (var i in player.inventory.containerBelt.itemList)
{
i.Remove();
}
if (player.inventory.containerWear.itemList.Count >= 1)
foreach (var i in player.inventory.containerWear.itemList)
{
i.Remove();
}
Item bnoc = ItemManager.CreateByItemID(-1262185308);
Item bnoc2 = ItemManager.CreateByItemID(-1266045928);
if (bnoc == null || bnoc2 == null) return null;
bnoc.MoveToContainer(player.inventory.containerBelt);
bnoc2.MoveToContainer(player.inventory.containerWear);
return false;
}
return null;
}
that seemed to fix it, thank you very very much
Locked automatically