ULX

Author Topic: Freeze all props  (Read 7916 times)

0 Members and 1 Guest are viewing this topic.

Offline Son_Of_Flynn

  • Newbie
  • *
  • Posts: 5
  • Karma: 2
Freeze all props
« on: June 04, 2016, 08:03:22 AM »
A simple small script to freeze every prop on your server.
Great way to reduce lag and prevent prop spammers.

To install simply drop the file into your addons folder.

Raw Code:
Code: [Select]
function ulx.freezeprops( calling_ply )
        local Ent = ents.FindByClass("prop_physics")
                for _,Ent in pairs(Ent) do
                        if Ent:IsValid() then
                                local phys = Ent:GetPhysicsObject()
                                phys:EnableMotion(false)
                        end
                end
        ulx.fancyLogAdmin( calling_ply, "#A froze all props" )
end
local freezeprops = ulx.command( CATEGORY_NAME, "ulx freezeprops", ulx.freezeprops, "!freezeprops" )
freezeprops:defaultAccess( ULib.ACCESS_ADMIN )
freezeprops:help( "Freeze every prop on the server." )

Offline Raimondas Ivaska

  • Newbie
  • *
  • Posts: 1
  • Karma: -4
Re: Freeze all props
« Reply #1 on: June 18, 2016, 03:32:19 AM »
Commands ?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Freeze all props
« Reply #2 on: June 18, 2016, 06:46:01 AM »
If you'd taken the 10 seconds to look at the bit of code, EVEN if you have no idea how to code, you could have guessed with 80% or more accuracy the name of the command needed.
ulx freezeprops

That being said, this code won't work without adding it to another file that already exists.
There's an undeclared variable in the code for the ULX command setup.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming