I want to create a command which would get two resources (sulfur & charcoal) then if player has X amount of both resources, then remove X amount sulfur & charcoal & gives X amount of gunpowder.
No clue how to do it tho.
Code:PLUGIN.Title = "First Plugin" PLUGIN.Description = "testplugin" PLUGIN.Author = "Unknown" PLUGIN.Version = V(1, 0, 0)function PLUGIN:Init() command.AddChatCommand("test", self.Object, "cmdCraftGunpowder") endfunction PLUGIN:cmdCraftGunpowder(player, cmd, args) local findItem = player.inventory:FindItemID(1436001773); local amount = player.inventory:GetAmount(1436001773); end
Find two items in inventory, get amount & remove amount. (LUA)
Discussion in 'Rust Development' started by metheyes, Feb 18, 2016.
-
This is it in c#, if your line for amount works I dont see why this take line won't. But then again, I haven't done LUA
player.inventory.GetAmount(itemID); // Looks for the item in inventory and returns the amount
player.inventory.Take(null, itemID, amount); // Takes the amount of item -
Sorry, yeah, I was trying to print the GetAmount, (tried with tonumber() and without tonumber())
How would I print the amount that I get?
