Give

Moved

Total Downloads: 21,434 - First Release: Oct 21, 2014 - Last Update: Mar 9, 2017

5/5, 35 likes
  1. Reneb submitted a new resource:

    Give - Give a player or yourself

    Read more about this resource...
     
  2. Wow Reneb! Thanks so much!
     
  3. Reneb updated Give with a new update entry:

    all items all the time

     
  4. Nice thank you, you're doing alot today btw ^^
     
  5. Your code example was perfect for what I needed. Thanks a lot Reneb!
     
  6. Has errors while loading give and tphome
    6:39 PM [Error] Failed to initialise plugin give (NullReferenceException: Object reference not set to an instance of an object)
    6:39 PM [Debug] at ItemManager.GetItemDefinitions () [0x00000] in <filename unknown>:0
    at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
    at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
    6:39 PM [Error] Failed to initialise plugin tphome (ArgumentException: An element with the same key already exists in the dictionary.)
    6:39 PM [Debug] at System.Collections.Generic.Dictionary`2[System.String,Oxide.Rust.Libraries.Command+ChatCommand].Add (System.String key, ChatCommand value) [0x00000] in <filename unknown>:0
    at Oxide.Rust.Libraries.Command.AddChatCommand (System.String name, Oxide.Core.Plugins.Plugin plugin, System.String callbackname) [0x00000] in <filename unknown>:0
    at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
    at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
     
  7. Code:
    function PLUGIN:cmdKit ( player, cmd, args )    self.Table = {}
        local itemlist = global.ItemManager.GetItemDefinitions();
        local it = itemlist:GetEnumerator()
        while (it:MoveNext()) do
            local correctname = string.lower(it.Current.displayname,"%%","t")
            self.Table[correctname] = tostring(it.Current.shortname)
            self.Table[correctname].itemid = tostring(it.Current.itemid)
        end    local targetinv = player.inventory
        local prefMain = targetinv.containerMain;
        local giveitem = global.ItemManager.CreateByName( "wood", 3000 )
        targetinv:GiveItem ( giveitem, prefMain );    local prefWear = targetinv.containerWear;
        giveitem = global.ItemManager.CreateByName( "burlap_trousers", 1 )
        targetinv:GiveItem ( giveitem, prefWear );    local prefBelt = targetinv.containerBelt;
        giveitem = global.ItemManager.CreateByName( "stonehatchet", 1 )
        targetinv:GiveItem ( giveitem, prefBelt );
    end
    
    Very simple example of a hard-coded kit deploy using some of Reneb's code. Of course a full kit mod would need a lot more.
     
  8. Im finding that a lot of the resources is coming up and saying not valid.
     
  9. If you get 1 valid resource then it's because you dont write the rest Well.
    If it's not working at all, then just reload the plugin (normally you shouldnt have to)
     
  10. seem to be getting this error when i try to give a player something
    Code:
    [Oxide] 6:43 PM [Error] give: [string "give.lua"]:81: attempt to index global 'playerplayer' (a nil value)
      at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0
      at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0
      at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
      at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
     
  11. Find the following line:
    Code:
    playerplayer:ChatMessage("You have received " .. tostring(amount) .. "x " .. string.lower(args[1]))
    And replace it with:
    Code:
    targetplayer:ChatMessage("You have received " .. tostring(amount) .. "x " .. string.lower(args[1]))
     
    Last edited by a moderator: Oct 23, 2014
  12. Dat fail --'
    I'll fix that tonight
     
  13. thanks guys!
    Just noticed that when giving a player something, they dont receive the message saying they received it seems to come to the person doing the command.
     
  14. How do I give myself cooked chicken ? /give name cooked chicken 1 doesnt seem to work
     
  15. Okay so the list must be wrong with a lot of items because bear meat is not an item yet bearmeat is an item, must be a trial and error[DOUBLEPOST=1414059323][/DOUBLEPOST]Okay so thats a bug eating the pile eats the lot lol thank you prawin
     
  16. No it's because you need to pût "
    /give "Cooked Chicken" 1