Spawn Where You Die

I’m sure it’s a relatively simple script, but can someone make me a script so while playing gmod single player, I respawn where I died? I had mobile spawn point for a while, but it gets annoying having to tug around where you go.

[lua]hook.Add(“PlayerDeath”, “SetRespawnPos”, function§
p.SpawnPos = p:GetPos()
end)

hook.Add(“PlayerSpawn”, “GetRespawnPos”, function§
if p.SpawnPos then
p:SetPos(p.SpawnPos)
end
end)[/lua]

Put that in autorun/server

Just for Wizey!:


hook.Add("PlayerDeath", "SetRespawnPos", function(p)
	p.SpawnPos = p:GetPos()
end)

hook.Add("PlayerSpawn", "GetRespawnPos", function(p)
	if p.SpawnPos then
		p:SetPos(p.SpawnPos)
	end
end)

Thanks =D

You’re welcome.

I now know there is a code, but is there not a addon or two for this somewhere?


(User was banned for this post ("dumb bump" - Orkel))

I don’t think so but you can ask MakeR for permission to upload it to the workshop ( if you know how to ).

EDIT:

Holy necro!

Reviving a nearly 6 year old thread? Wtf lol


(User was banned for this post ("bumping to complain about a bump" - Orkel))

Holy sh** this thread is as old as my brother


(User was banned for this post ("bumping to complain about a bump" - Orkel))

ok

Please, any moderator that sees this: CLOSE IT PLEASE!


(User was banned for this post ("use the report button instead of bumping it further" - Orkel))

You must close it by pressing “Solved”

I didn’t create it… Also its from 4 years ago.

Are you in 2013?

No…
Srly, look at when my account was created