How to slow down ragdoll after death or after shot on TTT
I have a script from someone that Used to be on these forums a while ago. I use this on my TTT server and it helps alot. It basically freezes ragdolls for a couple seconds, or if they go too fast, deletes them
[CODE]-- Ragdoll Crash Catcher for TTT and any other gamemode
-- By SirJayHarmony
-- Run shared (lua/autorun)
-- Config
local EchoFreeze = false -- Tell players when a body is frozen
local EchoRemove = false -- Tell players when a body is removed
local FreezeSpeed = 600 -- Velocity ragdoll is frozen at
local RemoveSpeed = 2000 -- Velocity ragdoll is removed at
local FreezeTime = 5 -- Time body is frozen for
if ( GAMEMODE_NAME == "terrortown" ) then
local IsTTT = true
else
local IsTTT = false
end
local function SetSubPhysMotionEnabled( ent, enable )
if not IsValid( ent ) then return end
ent:SetVelocity( vector_origin )
if ( not enable ) then
ent:SetColor( Color( 255, 0, 255, 255 ) )
if IsValid( ent:GetOwner() ) then
if ( IsTTT ) then
ent:GetOwner():GetWeapon( "weapon_zm_carry" ):Reset( false )
end
end
else
ent:SetColor( Color( 255, 255, 255, 255 ) )
end
for i = 0, ent:GetPhysicsObjectCount() - 1 do
local subphys = ent:GetPhysicsObjectNum( i )
if IsValid( subphys ) then
subphys:EnableMotion( enable )
if ( not enable ) then
subphys:SetVelocity( vector_origin )
subphys:SetMass( subphys:GetMass() * 20 )
else
subphys:SetMass( subphys:GetMass() / 20 )
subphys:Wake()
end
end
end
ent:SetVelocity( vector_origin )
end
local function KillVelocity( ent )
SetSubPhysMotionEnabled( ent, false )
if ( EchoFreeze ) then
PrintMessage( HUD_PRINTTALK, "[GS_CRASH] Body frozen for " .. FreezeTime .. " seconds!" )
end
timer.Simple( FreezeTime, function()
SetSubPhysMotionEnabled( ent, true )
if ( EchoFreeze ) then
PrintMessage( HUD_PRINTTALK, "[GS_CRASH] Body unfrozen!" )
end
end )
end
local function IdentifyCorpse( corpse )
if ( corpse and IsTTT ) then
local ply = player.GetByUniqueID( corpse.uqid )
ply:SetNWBool( "body_found", true )
CORPSE.SetFound( corpse, true )
end
end
function GS_CrashCatch()
for k, ent in pairs( ents.FindByClass( "prop_ragdoll" ) ) do
if ( IsValid( ent ) ) then
if ( ent.player_ragdoll ) then
local velo = ent:GetVelocity():Length()
local nick = ent:GetNWString( "nick" )
if ( velo >= RemoveSpeed ) then
ent:Remove()
local message = "[GS_CRASH] Removed body of " .. nick .. " for moving too fast"
ServerLog( message .. " (" .. velo .. ")\n" )
if ( EchoRemove ) then
PrintMessage( HUD_PRINTTALK, message )
end
if ( IsTTT and CORPSE.GetFound( ent, true ) ) then
IdentifyCorpse( ent )
end
elseif ( velo >= FreezeSpeed ) then
KillVelocity( ent )
ServerLog( "[GS_CRASH] Disabling motion for the body of " .. nick .. " (" .. velo .. ") \n" )
end
end
end
end
end[/CODE]
i dont think that works anymore cause of up date
[QUOTE=Mike Wazowski;51181756]i dont think that works anymore cause of up date[/QUOTE]
It will still work, but the ConVars work just fine.
Works like a charm on my server still
Sorry, you need to Log In to post a reply to this thread.