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;
[code]
spawnpoint = ents.Create("")
spawnpoint:SetPos(ply:GetPos())
ply:SetPos = spawnpoint
[/code]
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:
[QUOTE=TheNerdPest14;21483825]Hmmm, I think what you would need to do is something like this;
[code]
spawnpoint = ents.Create("")
spawnpoint:SetPos(ply:GetPos())
ply:SetPos = spawnpoint
[/code]
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.[/QUOTE]
:wtc:
My exact thoughts commander204.
Thanks CombineGuru! Works like a charm.
[QUOTE=101kl;21485008]My exact thoughts commander204.
Thanks CombineGuru! Works like a charm.[/QUOTE]
:smug:
[QUOTE=CombineGuru;21483904][lua]if ply and ValidEntity(ply) and ply.POS then[/lua][/QUOTE]
[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.
[QUOTE=TheNerdPest14;21486096]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.[/QUOTE]
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
Sorry, you need to Log In to post a reply to this thread.