Respawner

Automatically respawns players with permission and optionally wakes them up

Total Downloads: 6,689 - First Release: Oct 22, 2014 - Last Update: Nov 9, 2017

5/5, 4 likes
  1. Wulf

    Wulf Community Admin

    Wulf submitted a new resource:

    Respawner - Automatically respawns players after they die

    Read more about this resource...
     
  2. And if a person has a sleeping bag, it will appear in it?
     
  3. Wulf

    Wulf Community Admin

    No idea, will test that now, but I assume so. :)

    All this does is trigger the respawn sequence.

    Update: Nope, doesn't appear that they spawn in it. Will do more testing.
     
  4. Lol! That walk around to detect players dieing xD!!
     
  5. Code:
    [Oxide] 8:37 AM [Error] respawner: [string "respawner.lua"]:11: attempt to index local 'player' (a nil value)
      at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0
      at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0
      at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
      at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
     
    Last edited by a moderator: Oct 26, 2014
  6. Wulf

    Wulf Community Admin

    Wulf updated Respawner with a new update entry:

    Fix for latest update, support for kill command, and config

     
  7. Wulf

    Wulf Community Admin

    Wulf updated Respawner with a new update entry:

    Fixed settings not being used properly

     
  8. Wulf

    Wulf Community Admin

    Wulf updated Respawner with a new update entry:

    Added support for sleeping bags thanks to @Reneb

     
  9. For me using this allowed players to respawn automatically, however they saw the "You have died" spawn selection menu on most respawns.

    To get around this I added a line:
    Code:
    function PLUGIN:Respawn(player)
        spawnTimer = timer.Once(1, function()
            if self.Config.Settings.SleepingBags ~= "false" then
                local sleepingBags = self:FindSleepingBagByPlayer(player)
                if #sleepingBags >= 1 then
                    local sleepingBag = sleepingBags[math.random(1, #sleepingBags)]
                    player.transform.position = sleepingBag.transform.position
                    player.transform.rotation = sleepingBag.transform.rotation
                    player:Respawn(false)
                end
            elseif self.Config.Settings.SameLocation ~= "false" then
                player.transform.position = player.transform.position
                player.transform.rotation = player.transform.rotation
                player:Respawn(false)
            else
                player:Respawn(true)
            end
           
            player:StartSleeping() --Added:Force the sleeping player back to sleep before waking
            player:EndSleeping() --This now wakes up every time as intended (instead of "you are dead")
        end)
    end
    Thanks for the awesome code!
     
  10. Wulf

    Wulf Community Admin

    They normally wouldn't see it if the timer wasn't there as well, but I can't remember why I put the timer in. :p That change you added doesn't affect it at all for me either. The player:Respawn already puts them to sleep, so what you've added would only add a duplicate step.
     
    Last edited: Oct 28, 2014
  11. I tried without the timer, it works on / off. Without the timer I ran into an interesting issue. Sometimes you would die, respawn and then it would seem fine but trying to use doors etc would say something along the lines of "Unable to use command you are x meters away!". Logging out and in shows that you don't actually respawn, you come back to the you are dead screen, Strange lol.

    If I remove player:StartSleeping while the timer is in, I still 7/10 times "wake up" but I have the death screen in front of me, with it 100% so far not one has messed up. Not sure why it helps in my case, maybe loading times or something like that its not triggering correctly like it is on your side?

    I agree though it is duplicating the step, but as facepunch said them selves its a very tricky bug. At least it might help for some like in my case, the reason I added it is because in game to resolve you're dead the issue I had to F1 sleep > wakeup so I replicated that.
     
  12. Wulf

    Wulf Community Admin

    Wulf updated Respawner with a new update entry:

    Hopefully fix random error that makes no sense

     
  13. Wulf

    Wulf Community Admin

  14. Wulf

    Wulf Community Admin

    Wulf updated Respawner with a new update entry:

    Fixed giving of default items from respawning multiple times

     
  15. Code:
    [2/25/2015 7:29:53 PM] [Oxide] 7:29 PM [Error] Failed to run a timer.
    File: respawner.lua Line: 56 :
      at (wrapper managed-to-native) UnityEngine.Component:get_transform ()
      at BasePlayer.Respawn (Boolean newPos) [0x00000] in <filename unknown>:0
      at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
      at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
     
  16. Wulf

    Wulf Community Admin

    Wulf updated Respawner with a new update entry:

    Fixed error when sleepers get killed

     
  17. If the spawn increased for example up to 30 seconds
    Code:
    spawnTimer[steamId] = timer.Once(30, function()
    then the spawn themselves.
    After 30 seconds pererespaun console and will give the inscription:
    Assertion failed: Stomping old lifeStory
     
  18. It keeps respawning back in the death position, even with "SameLocation": "false" set. O.O any idea?

    Other problems:
    The menu pops up to respawn in sleeping bag if "SleepingBags": "true"
    http://puu.sh/iDG85/f4bc65d3a8.jpg

    and the Guns get left in the air after death,
    http://puu.sh/iDFWU/e00f5c8a06.jpg
    [DOUBLEPOST=1435348116][/DOUBLEPOST]
    Code:
    7:36 PM [Error] Failed to run a 1.00 timer in respawner
    File: respawner.lua Line: 33 bad argument #2 to 'random' (interval is empty):
      at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0
      at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0
      at NLua.LuaFunction.Call (System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0
      at NLua.Method.LuaDelegate.CallFunction (System.Object[] args, System.Object[] inArgs, System.Int32[] outArgs) [0x00000] in <filename unknown>:0
      at LuaGeneratedClass1.CallFunction () [0x00000] in <filename unknown>:0
      at Oxide.Core.Libraries.Timer+TimerInstance.Update () [0x00000] in <filename unknown>:0
    [DOUBLEPOST=1435429029,1435343680][/DOUBLEPOST]It's just be spawning in the same position, i dont know if thats because im admin?
     
    Last edited by a moderator: Jun 27, 2015
  19. Wulf

    Wulf Community Admin

    I'll test and see once I get a chance.
     
  20. Thanks, the respawn in same position is only if your admin. i removed ownerid and it worked fine after that