using System.Collections.Generic; using System.Linq; namespace Oxide.Plugins { [Info("Skip Death Screen", "bsdinis", "0.0.2")] [Description("Skips the death screen if the player doesn't have an available bag to spawn.")] public class SkipDeathScreen : RustPlugin { List players = new List(); private void OnPlayerDeath(BasePlayer player) { NextTick(() => { if (player == null || !player.IsConnected || player.IsAlive()) return; SleepingBag[] array = SleepingBag.FindForPlayer(player.userID, true); SleepingBag sleepingBag = array.FirstOrDefault((SleepingBag x) => x.deployerUserID == player.userID && x.unlockTime < UnityEngine.Time.realtimeSinceStartup); if (sleepingBag == null) { players.Add(player); player.Respawn(); } }); } private void OnPlayerSleep(BasePlayer player) { if (!players.Contains(player)) return; NextTick(() => { players.Remove(player); if (player.IsValid() && player.IsConnected && player.IsAlive()) player.EndSleeping(); }); } } }