So I am not exactly sure what causes this effect.
function GM:EntityTakeDamage( ent, dmginfo )
ent.entpos = ent:GetPos()
ent.entmdl = ent:GetModel()
ent.entskin = ent:GetSkin()
if ent:IsPlayer() then
ent:CreateRagdoll()
curHealth = ent:Health()
dmg = dmginfo:GetDamage()
testdmg = math.abs(curHealth - dmg)
print(testdmg)
if math.abs(curHealth - dmg) >= 50 and curHealth - dmg <= 0 then
ent:GetRagdollEntity():SetPos(ent.entpos)
ent:Spectate(6)
ent:SpectateEntity(ent:GetRagdollEntity())
ent:SetParent(ent:GetRagdollEntity())
ent.IsUnconscious = true
net.Start("unconscious_start")
net.WriteInt(testdmg, 32)
net.Send(ent)
timer.Create("unconscious_end", math.abs(curHealth - dmg) / 3, 1, function()
net.Start("unconscious_end")
net.Send(ent)
ent:Spectate(0)
ent:SpectateEntity(nil)
ent:UnSpectate()
ent:SetParent( nil )
timer.Simple(1, function()
ent:Respawn()
end)
timer.Simple(1.25, function()
ent:Respawn()
end)
timer.Simple(1.5, function()
net.Start("unconscious_disable")
net.Send(ent)
end)
local body = ent:GetRagdollEntity()
local eyes = body:GetAttachment( body:LookupAttachment( "eyes" ) )
ent:SetPos(eyes.Pos)
ent:GetRagdollEntity():Remove()
timer.Simple(1.75, function()
ent:SetModel(ent.entmdl)
ent:SetSkin(ent.entskin)
ent:RestartGesture( ACT_IDLE )
end)
end)
else
ent:GetRagdollEntity():Remove()
end
end
end
I tried reseting player’s model and I tried a function that I randomly found but none of these work…
Edit:
Here is a screenshot http://imgur.com/a/leKU2 Yes, I am infront of the camera