So i developed a plugin called Inventory Guardian that saves and restores players inventories.
The problem is that sometimes it does not fully restore the inventory, Normally that happens when the players open the inventory it stops the item give process.
So i put a print on start of the process and at the end.
Then the plugin batch give item restoration finishes about half-second or so, But the items restoration finishes about 5 seconds later, And if the player opens the inventory before that the inventory is not fully restored.
So my question is: There is a way to block the inventory from being opened before X seconds? Or if there is anyway to speed the process or something like that?
Any help will be much appreciated.
Solved GiveItem batch slow
Discussion in 'Rust Development' started by NexusBR, Jan 14, 2015.
-
-
But that is not the problem, The player spawn is not the problem, Because on my plugin there is a command to restore the inventory manually and if i open the inventory before 5 seconds it stops the restoration process.
The problem is not the player spawn, but the slow give Item process, I don't know if is there a time that GiveItem takes to send the package to the client, or it is really slow by purpose. -
-
I can't say about the button block, because i tried to remove button bit from 'inputState' on OnReceiveTick and this has no effect. But you can catch when client press BUTTON.INVENTORY and don't give items.
-
So detect if the player have the inventory is open doesn't really matter.
The problem is not with the lua plugin but the delay between i run GiveItem and the item reach the player inventory. -
You could disable the inventory keybind and rebind it after everything is done.
However thats a very dirty and in no way a recommended way to handle this. -
So what you recommend? And as i said the problem is not the plugin that is too slow to loop by all the table and give the items, But the GiveItem itself that takes too long to send each item to the client/inventory.
-
You could use SendSnapshot() by modifing the ItemContainers of the fields:
containerMain, containerBelt, and containerWear.
Another option is using SendUpdatedInventory(PlayerInventory.Type type, ItemContainer container, bool bSendInventoryToEveryone = false) and pass it the container instead. -
Hatemail if is not to ask too much, Can you give me a simple example to how to use those functions?
And player:SendFullSnapshot() would do the same thing? or player:SendNetworkUpdateImmediate() would help too? -
Try getting them to work yourself first, I'm not really the one to give out code as the receiver doesn't learn much from it usually. If you have no success I'll look into it when I get time.
-
Is hard to develop any plugins without any documentation, The wiki documentation is for legacy and is totally outdated.Last edited by a moderator: Jan 15, 2015 -
-
We should be doing a lot more awesome plugins if we had the right documentation.
Is hard to do something without knowing it, And to know we need a good documentation.
And you will spend much more time to research the oxide and rust classes, hooks and libraries then developing the plugin itself, That kind of thing is not viable or even pratical -
+1
-
Wulf Community Admin
There is no full API in Oxide 2, the documentation is the hooks.txt. -
yeah Rust documentation i guess he ment
-
Wulf Community Admin
-
On the wiki there is a small list of documented libraries and classes, If Oxide Team could update to work with Experimental rust and add a little more of documentation would be nice. -
Wulf Community Admin