As I understand it I can capture the moment a player dies using:
OnEntityDeath
How would I access their inventory?
I am looking to access what attire a player has and what the player has in their belt specifically their map when they die. I'd like to take, at the very least, their map and place it in a storage box.
My idea is what I call a deathbox. When a player dies, their attire and map go into the last box they made and deployed. I play with a group who tend to give you map back after you die and we felt this would be a great mod for us.
Thank you!
Solved Accessing a player's inventory/map upon death?
Discussion in 'Rust Development' started by carny666, Dec 9, 2015.
-
Calytic Community Admin Community Mod
Here is some psuedo-code for the death procedure.
Code:void OnEntityDeath(BaseEntity entity, HitInfo info) { if (entity is BasePlayer) { BasePlayer player = (BasePlayer)entity; foreach (Item item in player.inventory.containerBelt.itemList) { item.MoveToContainer(someOtherContainer); } foreach (Item item in player.inventory.containerWear.itemList) { item.MoveToContainer(someOtherContainer); } } }
-
-
Possibly if the container is full.