Fixing server crash, need help(lua problem).

Hello, Facepunch!

I’m trying to fix a bug on my server. Do you know rape swep?
This makes two players to ragdolls on some time, then turnes it back. But when you try to use remover on one of then - server crashes.
I found code in init.lua, which makes this ragdolls. This is(it’s same for each other player):



ragd = ents.Create("prop_ragdoll")
ragd:SetModel( plyVictim:GetModel() )
ragd:SetPos( plyVictimPos )
ragd:Spawn()
ragd:Activate()


I wanted to make this ragdoll to world model, but I didn’t found function for this.
I looked for it here: http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexd46d.html
Can you show me this function, does it helps?
Or I must find another way to fix it?
Thank you.

As far as i know, you don’t need :Activate().

But i am not sure if it is no longer crashing then.

Certain models can crash the server atm, like the hobo model from darkrp can crash it when you ragdoll them as a hobo(Sry for using dakrp for a example) but yeah that explains why it might crash, find player mdels that dont crash

Acvtivate() needs to play models animation.

I am using this in darkrp. Thank you. But hobo is off, server crashes, because players turnes to ragdolls, and when you remove this ragdolls - server crashes.
I need to make ragdolls unremovable, such a world props.
Cfn anybody help me, I cant found lua function, which I need.

[LUA]Ragdoll.Owner = “world”
Ragdoll:Own(“world”) [/LUA]

to make it world if you want , put this where you create the ragdoll

Thank you. I try to do it.

That does not prevent removing them.

I would simply disable creating ragdoll of Hobo.

[lua]
function CanPlyTool(ply,tr,toolmode)
if (tr.Entity:GetClass() == “prop_ragdoll” and toomode == “remover”) then return false end
end
hook.Add(“CanTool”,“DRP_CanTool”, CanTool)
[/lua]

Since the code is ment for a little kid that wont be able to fix it him self, you wrote “toomode” there, change it to “toolmode” :slight_smile:

Well I guess that plan didn’t work out… hm… SHHHH.