1. Wulf

    Wulf Community Admin

    An issue with JSON I believe. I need to finish my rewrite. :/
     
  2. I got this today:
    Code:
    [Oxide] 5:30 PM [Error] Failed to call hook 'OnPlayerInit' on plugin 'Welcome Gifts'
    File: welcomegifts.lua Line: 31 invalid arguments to method call:
      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 NLua.Lua.CallFunction (System.Object function, System.Object[] args) [0x00000] in <filename unknown>:0 
      at NLua.LuaFunction.Call (System.Object[] args) [0x00000] in <filename unknown>:0 
      at Oxide.Ext.Lua.Plugins.LuaPlugin.OnCallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0 
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0 
     
  3. I've been trying to fix this, the json seems to go crazy when you use a "."... tried rewriting from scratch as well with same result lol
    [DOUBLEPOST=1439615274,1439453810][/DOUBLEPOST]I've updated this plugin if anyone is interested:

    New config looks like:

    Code:
    {
      "Messages": {
        "GiftsGiven": "Welcome gift(s) given to {player}",
        "GiftsReceived": "Enjoy your welcome gift(s) {player}!",
        "InvalidItem": "{itemname} is not a valid item!"
      },
      "Settings": {
        "ChatName": "Welcome Gifts",
        "ConfigVersion": "0.0.2",
        "Gifts": [
          {
            "amount": 2,
            "name": "can.tuna"
          },
          {
            "amount": 3,
            "name": "apple"
          },
          {
            "amount": 3,
            "name": "lock.code BP"
          }
        ]
      }
    }
    
    Adding " BP" makes the script know that you intend on spawning a blueprint, although at the moment I haven't added it, but this is as far as I got. Enjoy. Seems to be working well on my server atm.
     

    Attached Files:

  4. an update planned?
     
  5. How can I set this so that the "welcome gifts" are given on every respawn (after death)
     
  6. Wulf

    Wulf Community Admin

    It'd need to be reworked. I'll add an option in the re-write.
     
  7. Re installed this plugin and although it was validated with jsonLint it still does not give anything to new players,

    welcome gifts error.jpg
     
    Last edited by a moderator: Aug 18, 2015
  8. Hi Wulf,

    Another of the many great plugins you've created is this one - welcomegifts. I've had the following error message in RCON a few times (sorry I can't provide more info - I'm not sure if it's working or not, as I am not a new member to the server, and therefore don't receive the gifts):
    Code:
    [Oxide] 12:01 AM [Error] Failed to call hook 'OnPlayerInit' on plugin 'welcomegifts v0.1.2'
    File: welcomegifts.lua Line: 31 invalid arguments to method call:
      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 NLua.Lua.CallFunction (System.Object function, System.Object[] args) [0x00000] in <filename unknown>:0
      at NLua.LuaFunction.Call (System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Ext.Lua.Plugins.LuaPlugin.OnCallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0
    Not sure if this is actually an issue or not, but thought I'd post it to let you know.
     
    Last edited by a moderator: Aug 23, 2015
  9. Wulf

    Wulf Community Admin

    Make sure you are using valid items in your config.
     
  10. Hi Wulf,

    You're correct the config file is likely the problem! One odd thing however - I just tested this a few times...

    I edit the config file to look like this:
    Code:
    {
      "Messages": {
      "GiftsGiven": "Welcome gift(s) given to {player}",
      "GiftsReceived": "Enjoy your welcome gift(s) {player}!",
      "InvalidItem": "{itemname} is not a valid item!"
      },
      "Settings": {
      "Gifts": {
      "apple": 5,
      "bandage": 3,
      "blueprint_fragment": 20,
      "can.tuna": 3,
      "spear.wooden": 1
      }
      }
    }
    I then reload the plugin, and when I check the config file again, it's been changed to:
    Code:
    {
      "Messages": {
      "GiftsGiven": "Welcome gift(s) given to {player}",
      "GiftsReceived": "Enjoy your welcome gift(s) {player}!",
      "InvalidItem": "{itemname} is not a valid item!"
      },
      "Settings": {
      "Gifts": {
      "apple": 5,
      "bandage": 3,
      "blueprint_fragment": 20,
      "can": {
      "tuna": 3
      },
      "spear": {
      "wooden": 1
      }
      }
      }
    }
    Only thing I can see is that it maybe doesn't like the "." in some item names?
     
  11. Wulf

    Wulf Community Admin

    Yup, I need to update it to work around that. You can try the version posted here: Welcome Gifts | Page 5 | Oxide.
     
  12. Apologies Wulf, I didn't see that version when I first downloaded... :-$
     
  13. already tried that version and it didnt work either, i have been trying this one, which also does not work.
    Code:
    {
      "Messages": {
      "GiftsGiven": "Welcome gift(s) given to {player}",
      "GiftsReceived": "Enjoy your welcome gift(s) {player}!",
      "InvalidItem": "{itemname} is not a valid item!"
      },
      "Settings": {
      "ConfigVersion": "0.0.2",
      "Gifts": [
      {
      "amount": 20,
      "name": "berries"
      },
      {
      "amount": 3,
      "name": "apple"
      },
      {
      "amount": 1,
      "name": "bow.hunting"
      },
      {
      "amount": 40,
      "name": "arrow.hv"
      },
      {
      "amount": 10,
      "name": "bandage"
      },
      {
      "amount": 2,
      "name": "hatchet"
      },
      {
      "amount": 1,
      "name": "jacket.snow3"
      },
      {
      "amount": 1,
      "name": "shoes.boots"
      },
      {
      "amount": 1,
      "name": "burlap.trousers"
      },
      {
      "amount": 2,
      "name": "campfire"
      },
      {
      "amount": 2,
      "name": "pickaxe"
      },
      {
      "amount": 2,
      "name": "torch"
      }
      ]
      }
    }this is accepted as a valid json script but no one gets anything
     
    Last edited by a moderator: Aug 25, 2015
  14. Actually it does work but you used an item called "berries" which doesn't exist, so my guess is the script escaped from giving any more after that thus not working at all.

    Have my updated version.

    Delete /config/welcomegifts.json & /data/welcomegifts.json before you run this. It'll probably work anyway, but just to be safe.

    Also I added a command "/resetgifts" for people with level 2 auth level which just wipes the data file.

    /data/welcomegifts.json will look like:

    Code:
    {
      "Count": 3,
      "Recipients": {
        "76561198078138369": {
          "Gifts": "bow.hunting, apple, blueberries, arrow.hv, bandage, hatchet, jacket.snow3, shoes.boots, burlap.trousers, campfire, pickaxe, torch"
        },
        "76561198113096834": {
          "Gifts": "bow.hunting, apple, blueberries, arrow.hv, bandage, hatchet, jacket.snow3, shoes.boots, burlap.trousers, campfire, pickaxe, torch"
        },
        "76561198205569597": {
          "Gifts": "bow.hunting, apple, blueberries, arrow.hv, bandage, hatchet, jacket.snow3, shoes.boots, burlap.trousers, campfire, pickaxe, torch"
        }
      }
    }
    
    and /config/welcomegifts.json will look like:

    Code:
    {
      "Messages": {
        "GiftsGiven": "Welcome gift(s) given to {player}",
        "GiftsReceived": "Enjoy your welcome gift(s) {player}!",
        "InvalidItem": "{itemname} is not a valid item!"
      },
      "Settings": {
        "AuthLevel": 2,
        "ChatName": "Welcome Gifts",
        "ConfigVersion": "0.0.2",
        "FirstUse": false,
        "Gifts": [
          {
            "amount": 1,
            "name": "bow.hunting"
          },
          {
            "amount": 3,
            "name": "apple"
          },
          {
            "amount": 20,
            "name": "blueberries"
          },
          {
            "amount": 40,
            "name": "arrow.hv"
          },
          {
            "amount": 10,
            "name": "bandage"
          },
          {
            "amount": 2,
            "name": "hatchet"
          },
          {
            "amount": 1,
            "name": "jacket.snow3"
          },
          {
            "amount": 1,
            "name": "shoes.boots"
          },
          {
            "amount": 1,
            "name": "burlap.trousers"
          },
          {
            "amount": 2,
            "name": "campfire"
          },
          {
            "amount": 2,
            "name": "pickaxe"
          },
          {
            "amount": 2,
            "name": "torch"
          }
        ]
      }
    }
    
    Once it's all setup correctly.
     

    Attached Files:

    Last edited by a moderator: Aug 25, 2015
  15. Hello can someone help me with plugins because im put 4 plugins and none not working oxide im upgrade to last wersion,or just plugins not working because there need change .lua .cs .json im Download plugins example welcomegifts.lua and im put in config folder the same welcomegifts.lua! there need change something?? in config folder i hewe .py .cs .lua!!
     
  16. Wulf

    Wulf Community Admin

    You are putting plugins in the config folder, they do not go there. Put them under oxide/plugins. See Installing plugins for Rust | Oxide.
     
  17. Im putting in plugin folder and config folder to because in config folder i can edit something
     
  18. Wulf

    Wulf Community Admin

    The plugins generate the configs, the actual plugins do not go under the config folder.
     
  19. and then where i can edit plugin if i wan change something?
     
  20. Wulf

    Wulf Community Admin

    You edit the config it generates under oxide/config, not the plugin itself.