Basically, I want every player to have their body in the game at all times.
Some players suicide/die and then disconnect/log off so that their body doesn't stay in the game.
Is it possible to force the spawning of a players body if they disconnect after death/suicide?
Rust No body despawning
Discussion in 'Plugin Requests' started by Togoshige, May 1, 2017.
-
Potential Uses:
Pick Pocketing, Bounty Hunting, Capturing, etc -
Wulf Community Admin
If they've been connected before, they'd have a sleeper and would still be there.
-
There's a corpse duration plugin which extends the duration that a corpse exists but doesn't have a true/false for corpse despawn.
I imagine you could set the time limit so high that it addresses your problem although I don't know how it was written - It may, or may not, carry across restarts. -
@Steenamaroo I use the CorpseDuration modifier plugin, works well!
But my current understanding, not sure if its wrong, is that its possible, after a player is killed/suicided, for them to _not_ spawn back in to a sleeping bag or randomly on the map, and then disconnect, and the player will _not_ have a sleeper (sleeping body) in the game, like they're in a sort of limbo/purgatory with no physical body in the game.
Theres a plugin, Respawner ----> Respawner for Rust | Oxide
But I havent tested it out yet. -
Oh yes, sorry. I see what you mean.
At a glance that respawner plug should do the job but it would also interfere with other players (who intend to stay) having the choice over their respawn locations.
I bet you could get what you want from between the respawner and OnPlayerDisconnect() -
I got it to work for when a Player disconnects without a body, I can respawn them
Im having trouble now, for when a player is killed while sleeping, I cant respawn them, heres the Error:
Code:[ForceBody] ForceBody - OnEntityDeath - Player was killed while sleeping - Sm0k3T1m3 Stomping old lifeStory Assertion failed. Value was False Expected: True at BasePlayer.SendFullSnapshot () [0x00000] in <filename unknown>:0 at BasePlayer.RespawnAt (Vector3 position, Quaternion rotation) [0x00000] in <filename unknown>:0 at Oxide.Plugins.ForceBody.OnEntityDeath (.BaseCombatEntity entity, .HitInfo info) [0x00000] in <filename unknown>:0 at Oxide.Plugins.ForceBody.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
Code:void OnEntityDeath(BaseEntity entity, HitInfo info) { if (entity == null) return; if (entity is BasePlayer == false) return; BasePlayer player = (BasePlayer)entity; if (!player.IsSleeping()) { Puts("ForceBody - OnEntityDeath - Player was killed while Alive - " + player.displayName); return; } player.RespawnAt(randomPos, new Quaternion()); }
References:
Can't force a respawn | Oxide
Solved - Getting name from user ID? | Oxide
FindPlayer function including offline players | Oxide -
Maybe try OnHitInfo, get the victim and then do something with that. Not quite sure how you'd handle that though off the top of my head. -
I guess, and that's all it is, that OnPlayerDisconnected() is letting you push a respawn through before their disconnect completes?
I suppose you could print player display names for each online player OnPlayerDisconnected to see if the disconnecting player shows up.
If he does, that would prove it.
If that's the case, I don't know how you'd respawn an offline player.
A less than ideal solution might be to null sleeper damage?