Is there a way to freeze all default map props when the server starts?

I have this map gm_underground_iv_fix and all the props it spawnes with you can pick them up or move them.

I there any lua code that freezes the default map props when the server starts up?

Thanks in advance Jeromy Han

My guess:



hook.Add( "InitPostEntity", "FreezePropPhysics", function()

    for Key, Entity in pairs( ents.FindByClass( "prop_physics" ) ) do

        local PhysicsObject = Entity:GetPhysicsObject()

        if ( IsValid( PhysicsObject ) ) then

            PhysicsObject:EnableMotion( false )

        end

    end

end )


Untested

and place that in lua/autorun/server in a file named whatever you want.

He probably doesn’t need THAT much spoonfeeding

You might also want to use

Entity:CreatedByMap

I used to help people with DarkRP servers… I’m used to people not knowing what an FTP is.

I don’t even know what an FTP is, but okay then…

wat

Thank you everyone the code works but somehow it messes with the doorgroups they just get deleted