Where exactly do you have moved this line?
I tried to change, still does not work.
UPD: Works.![]()
RestoreUponDeath
Moved
Total Downloads: 1,396 - First Release: Apr 21, 2016 - Last Update: Jun 11, 2018
- 5/5, 12 likes
-
It probably could be done a bit differently like an if... else or something to avoid some extra lines but I didn't mess with it.
I believe I actually figured out how to get the torch and rock not adding extras each time they respawn too. It should still add them if they have none and it should still add them if they have more than one for some reason, it just won't add the new ones resulting in extra rocks and torches clogging up the inventory.
I also have a feeling it might still be possible to lose a couple random items if the inventory was completely full of different items but I haven't tested any of that yet. The reason I think something is up here is because of the num var being a random number between the percent and the number of items and this num var being used to process items. It probably would just be for when losing random percents of items. So likely some extra logic has to be added there to ensure random items don't get lost but I haven't played with that yet. I think maybe it could just use the i variable to get the item. It would also be nice if the inventory went back the way it was before instead of being compacted and unsorted but I'm not sure if this is possible either.
Here is a patch which has all the changes I've made to the file so far including moving that other line around.
Code:--- RestoreUponDeath_original.cs +++ RestoreUponDeath_modified.cs @@ -8,6 +8,9 @@ [Info("RestoreUponDeath", "k1lly0u", "0.1.4", ResourceId = 1859)] class RestoreUponDeath : RustPlugin { + private bool skippedTorch; + private bool skippedRock; + #region Fields RODData rodData; private DynamicConfigFile PlayerInvData; @@ -62,6 +65,8 @@ var loot = corpse.GetComponent<LootableCorpse>().containers; if (loot != null) { + skippedTorch = false; + skippedRock = false; ProcessItems(corpse.GetComponent<LootableCorpse>(), 0); ProcessItems(corpse.GetComponent<LootableCorpse>(), 1); ProcessItems(corpse.GetComponent<LootableCorpse>(), 2); @@ -188,14 +193,31 @@ var percentage = GetPercentage(ID); double amount = (float)(items.Count * percentage) / 100; amount = items.Count - amount; + amount = Math.Round(Convert.ToDouble(amount), 0, MidpointRounding.AwayFromZero); if (percentage == 0) amount = items.Count; - amount = Math.Round(Convert.ToDouble(amount), 0, MidpointRounding.AwayFromZero); for (int i = 0; i < amount; i++) { var num = UnityEngine.Random.Range(0, items.Count); var item = items[num]; var savedItem = ProcessItem(item, cont); - plyrInv.Add(savedItem); + + // don't give torch and rock once since we respawn with one of each + if(savedItem.itemid == 110547964) { + if(skippedTorch == true) { + plyrInv.Add(savedItem); + } else { + skippedTorch = true; + } + } else if(savedItem.itemid == 3506021) { + if(skippedRock == true) { + plyrInv.Add(savedItem); + } else { + skippedRock = true; + } + } else { + plyrInv.Add(savedItem); + } + items.Remove(item); }; }
-
need update
-
Is this working for anyone since Rust update? I even removed and re-added the plugin.
-
k1lly0u updated Restore Upon Death with a new update entry:
0.1.5
-
error CS1955: The member `BasePlayer.IsAdmin' cannot be used as method or delegate
im using 0.1.5
i've updated oxide aswell -
Wulf Community Admin
-
Update fixed it all working thanks
-
Hello, by defaut, this plugin work fine.
if you added a group, this lugin don't work... by defaultCode:"PercentageOfItemsLost": 0
with
Code:/rod add vip 70 /rod add premium 30 /rod add admin 0
I remove group admin:
Code:/rod remove restoreupondeath.admin
Code:/rod add admin 10
Code:"Permissions": { "restoreupondeath.vip": 70, "restoreupondeath.premium": 30, }
-
k1lly0u updated Restore Upon Death with a new update entry:
0.1.51
-
Would it be possible to duplicate the user inventory? I don't want to take anything from the corpse, but I want the player to spawn with exactly what they died with (in the same slots too).
-
hello i gave the permission to default group, now even i removed the permission from default group people are still having their inventory recovered. i tried to remove the permission totally and added a new permission and not even gave it to default group but still the new added permission works for default group, very strange, i tried to remove all config and plugin file and did install it again but still no luck, and on oxide permission shows that the permission removed for default group but still it works for default group. i need help. thanks.
-
-
If you could find the time to add console commands, that'd be great! Love the mod.
-
It seems like something might have broken with the last patch. I've had multiple reports of explosives just disappearing upon death. And nobody being there to loot the bodies.
Anyone else encountered this? -
my players have found a way to carry their inventory over from a wipe they kill themselves and dont respawn untill the server is updated Is there a way I can keep this from happening?
If they are active or sleeping during the wipe they dont keep their inventory if they are dead during wipe they do -
Is there a file I can wipe to keep players from carrying over inventory by killing themselves before wipe?
-
Does this plugin affect the Backpacks plugin? As in if a loss percentage higher than 0 is set, will it remove items from the backpack as well?
I am trying to create a deathmatch event but it seems to conflict with this plugin. Anyone know a way to fix this?Last edited by a moderator: Feb 21, 2018 -
please update give a setting so only admins may have perm get get all items back
-
Hi,
There is an issue with this plugin,
When player respawn, the weapon is auto repaired. The orange line on the left of the gun is not here and you can repair it on a repair bench like the first time...
Can you fix it please ?