Getpos

How would i set the players next spawn position to his current position within the DoPlayerDeath Function.

Hmmm, I think what you would need to do is something like this;



spawnpoint = ents.Create("")
spawnpoint:SetPos(ply:GetPos())
ply:SetPos = spawnpoint


Or something like that, only problem with it is I’m highly doubtful if this would work. But I trust it helps you to get the general gist.

[lua]
hook.Add(“DoPlayerDeath”, “Spawnpoints”, function( ply )
ply.POS = ply:GetPos()
end )

hook.Add(“PlayerSpawn”, “Spawnpoints”, function( ply )
timer.Simple( .1, function()
if ply and ValidEntity(ply) and ply.POS then
ply:SetPos( ply.POS )
end
end )
end )
[/lua]

:v:

:wtc:

My exact thoughts commander204.
Thanks CombineGuru! Works like a charm.

:smug:

[lua]if ValidEntity(ply) and ply.POS then[/lua]

The nil check isn’t needed, it is carried out in the ValidEntity function.

Sorry, I was just trying to help him get the general idea. >_> Didn’t mean to screw things up. X.x

[editline]01:38PM[/editline]

Oh… Wow. My epic fail. X.x I realized there wasn’t anything to be called when the player dies, so maybe add like a hook or something. >_> Idk. I was just trying to help.

You cant create an entity with nothing.
+
[lua]
ply:SetPos = spawnpoint
[/lua]
You want the player to set the position of an entity. not the entitys pos.

Er. My bad. Thanks though, again I’m new. I’m sorry, I was just trying to help. XP