Inventory Guardian

Restore players inventory even after server wipe

Total Downloads: 3,604 - First Release: Jan 12, 2015 - Last Update: Feb 4, 2017

5/5, 19 likes
  1. NexusBR submitted a new resource:

    Inventory Guardian - Restore players inventory even after server Wipe!

    Read more about this resource...
     
  2. Hello !

    It works like charm!

    Is there a way to control off and on mode in another way?
    In my server having the mode on and doing a restart, just after this, players logged on fast , and they started killing each other not loosing anything from inventory, even more, they were able to duplicate their items at will.

    For sure they had fun after the restart haha. I had to run like crazy in order to deactivate it .

    Is there a way for just allow it for restarts only?

    Thanks :)
     
  3. It does not work on restarts because we need the player object that can only get if the players are online.
    Well by default the Restoration Upon Death is disabled, And /restoreinv do not duplicate the items, It strips whole inventory before restore the saved, You still would have a problem with that?
    [DOUBLEPOST=1421140585][/DOUBLEPOST]
    I see your problem, with /saveinv they can save the inventory throw things away and /restoreinv and get back.
    But the problem is they can trow things away disconnect and the items are restored.

    I could add a command to restore the inventory once for each player on connect then when connected destroy the saved inventory.

    And i can give a command to act as a on/off switch.

    I'll do that and post an update when ready
    [DOUBLEPOST=1421157310,1421140150][/DOUBLEPOST]I already developed that features just waiting for Oxide Update to fix Memory Leak to the current version, Then i'll test, fix if needed and publish the update.
     
  4. NexusBR updated Inventory Guardian with a new update entry:

    Major update


    [DOUBLEPOST=1421171818][/DOUBLEPOST]
    Done!

    I even tried to add a command to to restore all players inventories but if the server is wiped so there is no players to be found so that does not work.
    So i changed a few things and added a few things too.
    You can take a look at the changelog and on the description.

    Tell me what you think about the new update and if you tested and if it solved your problems.
     
  5. [Oxide] 9:45 PM [Error] Inventory-Guardian: [string "Inventory-Guardian.lua"]:254: attempt to index field '?' (a nil value)
    at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0
     
  6. NexusBR updated Inventory Guardian with a new update entry:

    Minor bug fix


    [DOUBLEPOST=1421229915][/DOUBLEPOST]
    I think i fixed it, download the update test if is working for you.
     
  7. Can the admin save player inventories if the server is empty and restore them after the wipe automatically?
     
  8. I've tried today something different in order to see if it could work or not. It worked but in a half way (not bad)

    I did a wipe in the sever. Before the wipe, I activated the mod, did the wipe, and there , as admin I kept everything in my inventory (perhaps becuase I am the owner flagged as admin).As for the players, there were a lot of situations, some were having half of their stuff, some others nothing at all, and the rest almost everything.

    I was surprised it worked in a half way lol

    I just wanted to let it know if someone tries, in order to know what it can happen since I tested it.

    Thank you Nexus, the plugin works good now without the index field issue.
     
  9. Well that is not the plugin fault, but rust/oxide, The items restoration is a slow process, but if the player opens the inventory before it completes not all items are restored.
    As you can see on the description: Note: If the Inventory Guardian not fully restored your saved inventory is because you pressed TAB (Open Inventory) before the server completed the restoration, That can happen because a server lag, Just run the restoration again with/restoreinv and wait about 5 seconds before press TAB.

    So is not possible to detect if the server was wiped, so i did the best way that i thought.

    I don't know how to improve this plugin in anyway.
     
  10. NexusBR updated Inventory Guardian with a new update entry:

    Fixed incomplete restoration and add batch process and more

     
  11. NexusBR updated Inventory Guardian with a new update entry:

    Complete code rewrite

     
  12. I get this on ig.saveall

    Initiating all players inventories salvation...
    Code:
    [Oxide] 12:00 AM [Error] Inventory-Guardian: [string "Inventory-Guardian.lua"]:846: parameters do not match signature
      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
      at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [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
     
    Last edited by a moderator: Sep 15, 2015
  13. NexusBR updated Inventory Guardian with a new update entry:

    Minor bug fix

     
  14. I love this plugin, working like a charm with the lastest update. Thank you NexusBR
     
  15. how do you type in or use the command to delete all inventories that have been saved
     
  16. There is no command for that.

    You need delete the server/(ServerID)/oxide/data/Inventory-Guardian.json and reload the plugin with oxide.reload Inventory-Guardian.
     
  17. Something wrong with RestoreInventory() after wipe. Second cycle skipped without errors/warnings and inventory becomes empty after player.inventory:Strip().

    UPD: I found the reason why inventory doesn't restored.
    When called RestoreInventory() code will execute after 1 sec (timer.Once(1, f()…end)). But ClearSavedInventory() in the hook OnPlayerSpawn() executed earlier, so nothing is restored.
    Change
    Code:
    Line 791:                     IG:ClearSavedInventory(playerID)
    to
    Code:
    timer.Once(3, function() IG:ClearSavedInventory(playerID) end)
    I think that 3 sec should be enough.
     
    Last edited by a moderator: Feb 1, 2015