SWEP + RAGDOLL [Support]

Hello, I bring myself here this evening to ask for an answer, an answer what hopefully someone has enough gLua knowledge. I’m just wondering If I created my own SWEP(wrench, crowbar etc) I want it so when you hit a player they’ll go into a ragdoll for x amount of seconds.

Now just for ?baby Jesus" no I’m not asking anyone to give me step-by-step tutorial on how to do this I just want to know like how would I “attach” the code from hitting a player then the player been put into ragdoll. What would this use like would it be a add.hook or function for this?

If you’re confused what I’m saying I basically want an explanation on what I would use for the SWEP to work with the player going into ragdoll.

I really hope this made enough sense.

(Sorry for my poor English, it’s not my first language)

This might help you out a little.

If you need more:
Find out what player you’re turning into a ragdoll.
Look at the code I linked and check out the ragdoll creation code (and setting of model, pos, etc.)
Check the code again for what they did to get the player out of the way and focused on the ragdoll.
Then create a timer which removes the ragdoll and brings back the player.

Thanks a bunch! I’ll take a look at this.