How would I remove the ragdoll that's left behind after a NPC is killed (It's not solid, so just getting rid of prop_ragdoll won't work. Right?)?
[QUOTE=.\\Shadow};28867470]How would I remove the ragdoll that's left behind after a NPC is killed (It's not solid, so just getting rid of prop_ragdoll won't work. Right?)?[/QUOTE]
Those are client-side ragdolls. I think there is an addon that does this somewhere on gmod.org. Basically client-side stuff can not be found VIA searching server-side, you'd need to loop through the entities client-side and remove the ragdolls through there, they also have a class named "C_ClientRagdoll", instead of "prop_ragdoll".
This was way was shown to me when I was working on a game mode a while back,
place in a client side file, like cl_init.lua if you're making a game mode or for single player sandbox put in garrysmod\lua\autorun\client\removerags.lua
[lua]
function RemoveDeadRag( ent )
if (ent == NULL) or (ent == nil) then return end
if (ent:GetClass() == "class C_ClientRagdoll") then
if ent:IsValid() and !(ent == NULL) then
SafeRemoveEntityDelayed(ent,0)
end
end
end
hook.Add("OnEntityCreated", "RemoveDeadRag", RemoveDeadRag)
[/lua]
NOTE: Never remove anything from the client that's not client side only, if you removed a prop_ragdoll it would crash you off server with a missing entity if it's still exists on the server.
[QUOTE=Fantym420;28872958]This was way was shown to me when I was working on a game mode a while back,
place in a client side file, like cl_init.lua if you're making a game mode or for single player sandbox put in garrysmod\lua\autorun\client\removerags.lua
[lua]
function RemoveDeadRag( ent )
if (ent == NULL) or (ent == nil) then return end
if (ent:GetClass() == "class C_ClientRagdoll") then
if ent:IsValid() and !(ent == NULL) then
SafeRemoveEntityDelayed(ent,0)
end
end
end
hook.Add("OnEntityCreated", "RemoveDeadRag", RemoveDeadRag)
[/lua]
NOTE: Never remove anything from the client that's not client side only, if you removed a prop_ragdoll it would crash you off server with a missing entity if it's still exists on the server.[/QUOTE]
Been trying to figure this out for a long time, lot of thanks, dude.
Sorry, you need to Log In to post a reply to this thread.