How to freeze d/c'd props?

So I made a function for GM:PlayerDisconnected and in that I have for k,v in pairs(ents.FindByClass(“prop_physics”)) do v:GetPhysicsObject():EnableMotion(false) end. How would I make it only freeze players props. The function calls the player that left. So ply has the players name. Im thinking it has something to do with entity:getowner but im not sure. Any help would be appreciated.



function GM:PlayerDisconnected( ply )
	for k,v in pairs(ents.FindByClass("prop_physics")) do
		v:GetPhysicsObject():EnableMotion(false)
	end
end


Depends on the prop protection you have, for the most part it’s probably going to be CPPI compliant in which case you could use

entity:CPPIGetOwner()

So then if v == entity:CPPIGetOwner() then v:GetPhysicsObject():EnableMotion(false), or how would how does it work?

I put entity:CPPIGetOwner() to refer to the fact you’d call it on an entity, I wasn’t giving you the exact code. In your case v is the entity you want the owner of, ply is a player. I’m sure you can figure out the rest.

Sorry for the late reply but kinda like this?



function GM:PlayerDisconnected( ply )
	for k,v in pairs(ents.FindByClass("prop_physics")) do
		if v:CPPIGetOwner() == ply then
			v:GetPhysicsObject():EnableMotion(false)
		end
	end
end