Hey. So what i'm trying to do is prevent certain items being moved using the CanMoveItem. It works the way I want, but you can still move the items using other items. Like if you drag a boonie hat over a hoodie, the hoodie which is blocked will get moved. If anyone has a alternative i would grately appreciate it if you posted. Thanks.
Preventing duplication in CanMoveItem?
Discussion in 'Rust Development' started by Sonny-Boi, Mar 18, 2018.
-
straight stupid way to break:
Code:object CanWearItem(PlayerInventory inventory, Item item) { string name = item.info.displayName.english; if (name == "Hide Halterneck" || name.Contains("Snow Jacket") || name == "Bone Armor" || name == "Burlap Shirt" || name == "Hazmat Suit" || name == "Heavy Plate Jacket" || name == "Shirt" || name == "Longsleeve T-Shirt" || (name == "Hoodie" && !item.IsLocked()) || name == "T-Shirt" || name == "Tank Top" || name == "Hide Vest") return false; return null; }
-
Code:
bool CanPlayerWearItem(BasePlayer player, Item item) { return(item.CanMoveTo(player.inventory.containerWear)); }
-
Also i dont think you got what i meant @HOUGAN_Y , read the top again
-
CanWearItem is pefect work, cause i had plugin that shoult give red hoodie that u cant swap, and CanWearItem that return false at each of hoodie slot items worked good.
-
-
Try to check what is in the target slot, and if it's in your list of prohibited items, return false.