Hello all,
Would it be possible to make it so when a player dies they get turned into a statue and can use Spectate(OBS_MODE_ROAMING). I have tried when the player dies to create a ragdoll get the ent and use the sandbox "statue" contextmenu code but it still fell to the floor.
Thanks rtm516
Try using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetRagdollEntity]Player:GetRagdollEntity[/url] in a [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerDeath]GM:PlayerDeath[/url] hook, and run [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/PhysObj/EnableMotion]PhysObj:EnableMotion[/url] for each of the ragdoll's physics bones
[editline]18th June 2016[/editline]
E.G.
[CODE]
hook.Add( 'PlayerDeath', 'testhook', function( ply )
local rag = ply:GetRagdollEntity()
if !IsValid( rag ) then return end
timer.Simple( 1, function() -- freeze the player after 1 second
for i = 0, rag:GetPhysicsObjectCount() - 1 do
local bone = rag:GetPhysicsObjectNum( i )
if ( IsValid( bone ) ) then
bone:EnableMotion( false )
end
end
ply:Spectate( OBS_MODE_ROAMING ) -- spectate
end )
end )
[/CODE]
Untested
ok i tried to manipulate your code so when i call a func the player is frozen and spec here is what i have (doesnt work)
[lua]
local function DoEndThings()
for k,v in pairs(player.GetAll()) do
local pos = v:GetPos()
v:Kill()
local rag = v:GetRagdollEntity()
if !IsValid(rag) then continue end
for i = 0, rag:GetPhysicsObjectCount() - 1 do
local bone = rag:GetPhysicsObjectNum(i)
if (IsValid(bone)) then
bone:EnableMotion(false)
end
end
v:Spawn()
v:Spectate(OBS_MODE_ROAMING)
v:SetPos(pos)
end
end
[/lua]
Try using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/CreateRagdoll]Player:CreateRagdoll[/url] as well as the Kill command you're doing.
[editline]18th June 2016[/editline]
Killing the player doesn't necessarily mean they will have a ragdoll when they die.
Sorry, you need to Log In to post a reply to this thread.