Getting NPC's ragdoll?

I use **[Gamemode.CreateEntityRagdoll](** to get NPC’s ragdoll when convar ai_keepragdolls is set to 1, but how do I get the ragdoll that gets created when its set to 0? I know that SilverLan’s Trex SNPC does controls the ragdolls movement, but does he actually gets the ragdoll or does he create a new ragdoll instead?

That ragdoll is clientside,you’d need to check on the client a CRagdollwhatever(can’t remember the exat classname) with the same model as the npc in the ents.GetAll().
You can use **[Ents.FindByModel](**,I know,you will not know which ragdoll is owned by which npc when there are multiple with the same model.

Thanks, did a quick check, its C-ClientRagdoll when searched on client, but how can I do this one a moment when an NPC is killed**? ****[**[]Gamemode.OnNPCKilled

Garry's Mod Wiki - Garry's Mod Wiki](Garry's Mod Wiki - Garry's Mod Wiki)**** **[Gamemode.EntityTakeDamage

Garry's Mod Wiki - Garry's Mod Wiki](Garry's Mod Wiki - Garry's Mod Wiki)** both run only on server.

Sadly,i don’t know how you would do that.
You can hook **[Gamemode.OnEntityCreated](** clientside,so when a npc dies it’s ragdoll will be passed as an argument if the npc was in your pvs.

How on earth does silverlan do it? I’m having a really hard time reading other peoples code, especially silverlans :confused: Searching for C-ClientRagdoll would work, but I also need the NPC that this entity belonged to, which I have no idea how to get, so I guess I’ll quit on this part of the project. Still wonder how silverlan does it tho.