So when ever someone is rag dolled on my server this happens:
[IMG]https://i.gyazo.com/4886c63f3a80565e04fc53720bdfe721.png[/IMG]
So they do get ragdolled, but then they float above, so there is two of them (one ragdolled, one floating above). This happens when I do !ragdoll on someone, or an addon ragdolls them (kidnap swep).
I don't know whats causing it, has anyone had this problem before or have any idea why its happening? Thanks in advance.
Can you post the code of the ragdoll command?
[QUOTE=code_gs;49000249]Can you post the code of the ragdoll command?[/QUOTE]
[CODE]------------------------------ Ragdoll ------------------------------
function ulx.ragdoll( calling_ply, target_plys, should_unragdoll )
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
if not should_unragdoll then
if ulx.getExclusive( v, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
elseif not v:Alive() then
ULib.tsayError( calling_ply, v:Nick() .. " is dead and cannot be ragdolled!", true )
else
if v:InVehicle() then
local vehicle = v:GetParent()
v:ExitVehicle()
end
ULib.getSpawnInfo( v ) -- Collect information so we can respawn them in the same state.
local ragdoll = ents.Create( "prop_ragdoll" )
ragdoll.ragdolledPly = v
ragdoll:SetPos( v:GetPos() )
local velocity = v:GetVelocity()
ragdoll:SetAngles( v:GetAngles() )
ragdoll:SetModel( v:GetModel() )
ragdoll:Spawn()
ragdoll:Activate()
v:SetParent( ragdoll ) -- So their player ent will match up (position-wise) with where their ragdoll is.
-- Set velocity for each peice of the ragdoll
local j = 1
while true do -- Break inside
local phys_obj = ragdoll:GetPhysicsObjectNum( j )
if phys_obj then
phys_obj:SetVelocity( velocity )
j = j + 1
else
break
end
end
v:Spectate( OBS_MODE_CHASE )
v:SpectateEntity( ragdoll )
v:StripWeapons() -- Otherwise they can still use the weapons.
ragdoll:DisallowDeleting( true, function( old, new )
v.ragdoll = new
end )
v:DisallowSpawning( true )
v.ragdoll = ragdoll
ulx.setExclusive( v, "ragdolled" )
table.insert( affected_plys, v )
end
elseif v.ragdoll then -- Only if they're ragdolled...
v:DisallowSpawning( false )
v:SetParent()
v:UnSpectate() -- Need this for DarkRP for some reason, works fine without it in sbox
local ragdoll = v.ragdoll
v.ragdoll = nil -- Gotta do this before spawn or our hook catches it
if not ragdoll:IsValid() then -- Something must have removed it, just spawn
ULib.spawn( v, true )
else
local pos = ragdoll:GetPos()
pos.z = pos.z + 10 -- So they don't end up in the ground
ULib.spawn( v, true )
v:SetPos( pos )
v:SetVelocity( ragdoll:GetVelocity() )
local yaw = ragdoll:GetAngles().yaw
v:SetAngles( Angle( 0, yaw, 0 ) )
ragdoll:DisallowDeleting( false )
ragdoll:Remove()
end
ulx.clearExclusive( v )
table.insert( affected_plys, v )
end
end
if not should_unragdoll then
ulx.fancyLogAdmin( calling_ply, "#A ragdolled #T", affected_plys )
else
ulx.fancyLogAdmin( calling_ply, "#A unragdolled #T", affected_plys )
end
end
local ragdoll = ulx.command( CATEGORY_NAME, "ulx ragdoll", ulx.ragdoll, "!ragdoll" )
ragdoll:addParam{ type=ULib.cmds.PlayersArg }
ragdoll:addParam{ type=ULib.cmds.BoolArg, invisible=true }
ragdoll:defaultAccess( ULib.ACCESS_ADMIN )
ragdoll:help( "ragdolls target(s)." )
ragdoll:setOpposite( "ulx unragdoll", {_, _, true}, "!unragdoll" )
local function ragdollSpawnCheck( ply )
if ply.ragdoll then
timer.Simple( 0.01, function() -- Doesn't like us using it instantly
if not ply:IsValid() then return end -- Make sure they're still here
ply:Spectate( OBS_MODE_CHASE )
ply:SpectateEntity( ply.ragdoll )
ply:StripWeapons() -- Otherwise they can still use the weapons.
end )
end
end
hook.Add( "PlayerSpawn", "ULXRagdollSpawnCheck", ragdollSpawnCheck )
local function ragdollDisconnectedCheck( ply )
if ply.ragdoll then
ply.ragdoll:DisallowDeleting( false )
ply.ragdoll:Remove()
end
end
hook.Add( "PlayerDisconnected", "ULXRa[/CODE]
[editline]28th October 2015[/editline]
Sorry, you need to Log In to post a reply to this thread.