Freezing Player when Shot

So basically,
Does anybody know a quick way to Freeze a player when he is shot?
Lets say I have the SWEP, I shoot him, he freezes, like a Freezer SWEP.
I know there are lots of long ways to make it, I tried the wiki reference but I always end up with a long script which fails. I tried using reference from others but there code is too long and I eventually don’t want to rip it. Anybody know how to make it?
Thank You.

http://wiki.garrysmod.com/?title=Player.Freeze?

Well for some reason, every time I try to use the Freeze() function, it tells me that it is a nil value…

That’s because you have to tell whether or not you’re freezing or unfreezing. If you read the documentation, it tells you the function requires you to pass a boolean value. True means you are freezing them, false means unfreeze. So,


player:Freeze(true)

freezes them in place.

kk, yah I know I read the documentation, I just had to reorganize a bit the code for it to work because even if true was written, it would fail, but now it works, now all thats letf to do is to make it so that the shot only affects the player being shot instead of everyone.


local ent = self.Owner:GetEyeTrace().Entity
if ent:IsPlayer() then ent:Freeze(true) end

Thanks alot man, that was very useful. <3