Hey guys.
I am new in programming plugins so I want to build some easy Plugins for helping me to be better in programming.
I 've 2 questions.
First: I want to create a Plugin which give me on a command a Item to my inventory which I set in my code for example I write in code /giveitems = giveitem_ak
Its a simple example ^^
Second:
Is there a oppurtunity to see all commands?
I mean for example where I can see how the GiveItem function works or which functions exists in Oxide Rust.
Thank you I hope you understand my problem ^^
Solved AddItem to Inventory and Command Library
Discussion in 'Rust Development' started by iMpAviDo, Nov 2, 2015.
-
Just decompile the Assembly-CSharp.dll file which can be found in the zip you get when downloading Oxide. -
Ok I decompiled it and founded for example a Script "PlayerInventory".
Its hard for me to take from this Script the knowledge how to create or use the function to Additems :/
I just created now:
Code:public BasePlayer player; [ChatCommand("item")] private void SaveCommand(BasePlayer player, string command, string[] args) { this.GiveItem(ItemManager.CreateByName("rock", 1); }
Last edited by a moderator: Nov 2, 2015 -
You will need to use player.inventory to get that -
Code:
player.inventory("rock, 1");
Sry I am a noob ^^
And how I know for example that the command is player.inventory and not giveItem how in the Assembly.dll?
Would be nice if I would have a list for example To kill Player: player.kill() and more.. -
-
Ok thank you it worked.
How I can add for example silencer to a weapon?
And is it possible to set the ak to my first inventory slot?
I just found lua Scipting not for c#
Code:player.inventory.GiveItem(ItemManager.CreateByName("rifle.ak", 1));
Last edited by a moderator: Nov 2, 2015 -
Code:
Item item = ItemManager.CreateByName("rifle.ak", 1); item.position = 1; item.contents.itemList.Add(ItemManager.CreateByName("weapon.mod.silencer", 1));player.inventory.GiveItem(item);