1. n00b feelings... :(

    Guys, when you find a namespace with a decompiler on Assembly-CSharp, how do we "read" that namespace in order to know if we could use it with a hook? I hate to disturb you all with my inquiries, so I want to understand that process...
     
  2. Have similar question. For example i want to understand what i can do with hook "OnGather", there is "Assembly-CSharp/Item item", how to understand what is inside this variable? Right now by looking inside other plugins i found only "item.amount" and "item.info.displayname", but how to look everything what i have? Same goes to other options like "Assembly-CSharp/ResourceDispenser dispenser, Assembly-CSharp/BaseEntity entity".

    Can someone help with this? I know lua/python/php but don't know C# and can't find any documentation about "what is inside this variables".
     
  3. Like what can you use in the hook or more like create new hooks?
    You'll need to disassemble the the server files, more in particular, Assembly-CSharp.dll which contains most of the classes used in plugins. For what you're talking about here is the classes Item, ResourceDispenser and BaseEntity. All these classes have their own fields, properties, methods available.

    There are multiple programs available that you can use, some paid, some for free. Telerik JustDecompile is a good free one.

    upload_2015-2-16_14-7-20.png
     
  4. @Mughisi

    Thank you very much! Going to learn this)
     
  5. @Mughisi how would I manage to search for a specifc item in a player inventory for example?

    We have BasePlayer class that calls the class PlayerInventory to check the object Inventory. Using this info, how could we call the PlayerInventory from BasePlayer to print it in the console for instance?

    I know that we have our Rust hooks stated here: https://github.com/OxideMod/Oxide/blob/master/Oxide.Ext.Rust/hooks.txt
    But the most acceptable hooks there IMO is OnPlayerLoot, but that would make me create a data file to store the player inventory while I want only to detect a single Item in this inventory.
    [DOUBLEPOST=1424130097][/DOUBLEPOST]I supose that I have to create a new Hook to work with that then?
     
  6. Get a reference to BasePlayer and the rest comes easy..

    Code:
    foreach (var item in basePlayer.inventory.AllItems())
    {
    Puts(item.info.displayname);
    }
    
     
  7. Who to do it in LUA xD

    Seems like in C# its sooo easy.
     
  8. Your kidding right? Its looping over a collection...
    Code:
    local items = player.inventory:AllItems()
    for i=0, items.Length - 1, 1 do
           local item = items[i]
           print(item.info.displayname)
    end
    
     
  9. Actually I now how to check the player Inv, my problem is that I didnt knew that basePlayer.inventory.AllItems() should be player.inventory:AllItems( ) in LUA... and that is a big issue for me, because I don't know how to convert what I write in C# to LUA. I'm really a noob in this matter... its that easy to convert basePlayer.inventory.AllItems() in player.inventory:AllItems( )???
    I know that basePlayer is simply player on LUA, and the inventory continues to be inventory, also AllItems continues the same from C# to LUA with the diference that we use colon ":" in LUA and dot "." in C#. Just dont get how LUA needs to read "player" and not "BasePlayer" as in C# (AFAIK C# can read the Type Names from the dlls and its Members easily without conversion).
     
  10. You read player in LUA because that's what you have defined as your variable in your command. Here's a simple stupid example :p :
    Code:
    function PLUGIN: cmdViewInventory( player, cmd, args )
      local inventory = player.inventory
    end
    Is exactly the same as
    Code:
    function PLUGIN:cmdViewInventory( someRandomBasePlayerDude, theCommand, someStupidArgumentsThatWeDontUse )
      local inventory = someRandomBasePlayerDude.inventory
    end
    It's not that it's a BasePlayer in C# and a player in LUA, the player in lua is just a variable of the type BasePlayer, and regarding the difference between the colon and the dot, have a look at http://www.lua.org/pil/16.html
     
  11. Ohh sure! I already had that idea before :)

    How about:
    function PLUGIN:OnEntityAttacked( foo, bar ) -- foo would be Entity and bar HitInfo then? What means that the variables set within ( ) are exactly the same from the Hooks.
     
  12. The function is passing values to your parameters, so yes, but keep in mind, if this would be C# you would use something like "void OnEntityAttacked(Entity foo, HitInfo bar)"