Respawn Question

Hello Facepunch,

I was wondering how I would go about making a respawn/revive option for my deathrun server, as people are dying in such ways that they shouldn’t… Help would be greatly appreciated, thanks.

It can either be a !respawn /respawn or a ulx addon, I just want to know how I would go about actually doing it, thanks.

Cut out the command you need from that.

This is what I wrote up for my server, so you’ll have to modify the GetGlobalFloat bit so it works with your DR round system but this is the gist of what you’d do

You’d also want to add in a bit when round starts to make ply.Respawns 0 again.



hook.Add("PlayerSay", "Respawn", function(ply, text)
	if( string.sub( text, 1, 6) == "/retry" ) then
		if ply.Respawns < 1 then
		if !ply:Alive() and GetGlobalFloat("RoundStartTime",CurTime()) + 30 > CurTime() then
				ply:Spawn()
				ply:GodEnable()
				ply:ChatPrint("You've used your one respawn!")
				ply.Respawns = 1

				timer.Simple(15, function()
					ply:GodDisable()
					ply:ChatPrint("/retry god mode disabled!")
				end)
		else
			ply:ChatPrint("Sorry! /retry can only be used during the first 30 seconds.")
		end	
	end
	end
end)


I seemed to have did with goodman suggested, having it working although it gives an error as obviously it is meant for TTT, it says



addons/ulx/lua/ulx/modules/sh/deathrun_admin.lua:378: attempt to call method 'SpawnForRound' (a nil value)
1. call - addons/ulx/lua/ulx/modules/sh/deathrun_admin.lua:378
  2. __fn - addons/ulib/lua/ulib/shared/commands.lua:943
    3. unkown - addons/ulib/lua/ulib/shared/commands.lua:1296
      4. Run - lua/includes/modules/concommand.lua:69
        5. unknown - addons/ulib/lua/ulib/shared/commands.lua:1310
          6. unknown - lua/includes/modules/concommand.lua:69


The line it seems to point to is.



v:SpawnForRound( true )


What would I modify/change that to get it to work with deathrun? Help would be appreciated.

[editline]8th June 2014[/editline]

Nevermind, I seemed to have completely figured it out, thanks for all the help.

Try this one it works on my DR server. http://forums.ulyssesmod.net/index.php?topic=5549.0

The thread is a bit hard to follow but just read through it.

I figured it out Jewno, but it doesn’t actually allow me to use the command through ULX Menu, I have to !respawn or !respawntp in chat without ulx menu, ideas?

Hmm it should be under the utility part of ulx. When I get on my computer I might be able to help. But you might need to put the file in a certain directory.

It fixed itself, server just needed a restart, i’m just trying to figure out how to give the player a weapon on respawn and remove the current one, but it isn’t working (Using the following)



ply:StripWeapons()
ply:GiveWeapon("weapon_crowbar")


It doesn’t seem to work though.

Try
ply:Give(“weapon_crowbar”)

My bad, That is what I currently have, just checked the lua file.

Any errors?

No, I got it fixed by the help of someone, thanks though.