Help with Ragdoll crash stopper

We have a ragdoll crash stopper that catches ragdolls going at excessive velocities, tries to stop them and failing that deletes the ragdoll. Users on our ttt server have learned to shake a body like crazy to cause the crash stopper to delete the body and hide their treachery. In order to stop this I would like to add a code that checks if an item is flagged “FVPHYSICS_PLAYER_HELD” and if so, freezes the player (or if that’s to difficult the closest player to the ragdoll) for 10 seconds and announces to everyone that they tried to hide a body. Here is the crash stopper code I have to work with. The freeze should trigger when the velocity exceeds 1500

for k, ent in pairs(ents.FindByClass("prop_ragdoll")) do
if IsValid(ent) then
if ent.player_ragdoll then
local velo = ent:GetVelocity( ):Length()
if velo >= 1500 and velo <= 2499 then
ServerLog("[!CRASHCATCHER!] Caught velocity > 1500 on a ragdoll entity, negating velocity and temporarily disabling motion.
elseif velo >= 2500 then
ServerLog("[!CRASHCATCHER!] Caught velocity > 2500 on a ragdoll entity, removing offending ragdoll entity from world.

function AMB_SetSubPhysMotionEnabled(ent, enable)
   if not IsValid(ent) then return end

   for i=0, ent:GetPhysicsObjectCount()-1 do
      local subphys = ent:GetPhysicsObjectNum(i)
      if IsValid(subphys) then
         if enable then

function AMB_KillVelocity(ent)

   -- The only truly effective way to prevent all kinds of velocity and
   -- inertia is motion disabling the entire ragdoll for a tick
   -- for non-ragdolls this will do the same for their single physobj
   AMB_SetSubPhysMotionEnabled(ent, false)

   timer.Simple(0, function() AMB_SetSubPhysMotionEnabled(ent, true) end)

Of course telling my why this can’t be done would be useful too.

Well I am not positive, but I would suggest looking into the effects of the magneto stick on an entity. I will browse a little, but I believe you can make it so it checks if the body is being held.

Hey Galactic, i was wondering if i could have your permission to use this coding that you made on my server as well. it seems like a very nice fix to resolve the ragdoll velocity crash issue that i am having.

Please let me know


He didn’t make it, this was made by someone else for everyone use.