As the title says. I wanna check if the player has the requested item and the amount of it.
Any good examples?
Thanks for any help.
More info: I wanna check if the player has 100xC4
Only that i know:
Code:target.inventory.containerMain/Belt/Wear
Looping through player's inventory (C#)
Discussion in 'Rust Development' started by PaiN, Jul 15, 2015.
-
target.inventory.containerWear.GetAmount(itemid, true);
-
Tried some weird combinations but cannot find how to do it.
Cannot convert int to string... stuff like that .. tried to make it string the it said Cannot convert string to int LoL
Code:{ [ChatCommand("test")] void cmdTest(BasePlayer player, string cmd, string[] args) { Puts("This player has {0} timed explosives", GetAmount()); } string GetAmount(BasePlayer player) { return player.inventory.containerWear.GetAmount(498591726, true); } } -
GetAmount().ToString() ?
-
or int GetAmount(BasePlayer player)
as string.Format is able to pickup other varibles
Here made a func for u
GetAmount(player, 498591726, 0); // from belt
GetAmount(player, 498591726, 1); // from main
GetAmount(player, 498591726, 2); // from wear
Code:int GetAmount(BasePlayer player, int itemid, int type) { switch(type) { case 0: return player.inventory.containerBelt.GetAmount(itemid, true); case 1: return player.inventory.containerMain.GetAmount(itemid, true); } return player.inventory.containerWear.GetAmount(itemid, true); }Last edited by a moderator: Jul 15, 2015 -
Okay okay .. What about removing the item.. ?
-
Code:
bool Remove(Item item) or int Take(List<Item> collect, int itemid, int iAmount) ?
-
Look at EasyFurnace all you need is in there
