Advertisement
minifisch

sh_stoplag.lua

Jul 24th, 2015
1,066
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.32 KB | None | 0 0
  1. /*-------------------------------------------------------------------------------------------------------------------------
  2.     This command stops serverlags. Very useful if crappy adv-dupe shit was spawned and fucked up the server.
  3. -------------------------------------------------------------------------------------------------------------------------*/
  4.  
  5. local PLUGIN = {}
  6. PLUGIN.Title = "Stop-Lag"
  7. PLUGIN.Description = "Freezes all props and entitys at once."
  8. PLUGIN.Author = "minifisch"
  9. PLUGIN.ChatCommand = "stoplag"
  10. PLUGIN.Privileges = { "StopLag" }
  11.  
  12. function PLUGIN:Call( ply )
  13.     if ( ply:EV_HasPrivilege( "StopLag" ) ) then
  14.         local Ent = ents.FindByClass("prop_physics*")
  15.         Ent = table.Add(Ent, ents.FindByClass("prop_vehicle*"))
  16.         Ent = table.Add(Ent, ents.FindByClass("base_gmodentity"))
  17.         Ent = table.Add(Ent, ents.FindByClass("gmod_*"))
  18.         local x = 0
  19.         for _,Ent in pairs(Ent) do
  20.             if Ent:IsValid() then
  21.                 local phys = Ent:GetPhysicsObject()
  22.                 if( phys:IsValid() && phys:IsMoveable()) then
  23.                     phys:EnableMotion( false )
  24.                     x = x+1
  25.                 end
  26.             end
  27.         end
  28.         evolve:Notify( evolve.colors.blue, ply:Nick(), evolve.colors.white, " has frozen " .. tostring(x) .. " entitys on the server." )
  29.     else
  30.         evolve:Notify( ply, evolve.colors.red, evolve.constants.notallowed )
  31.     end
  32. end
  33. evolve:RegisterPlugin( PLUGIN )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement