forked from Nebual/NadmodPP
add ability to freeze all player props from nadmod
This commit is contained in:
parent
4617a1c400
commit
5b3b4ca0c0
@ -205,6 +205,7 @@ function NADMOD.AdminPanel(Panel, runByNetReceive)
|
||||
Panel:Button("Cleanup All Ragdolls", "nadmod_cleanclass", "prop_ragdol*")
|
||||
Panel:Button("Cleanup Clientside Ragdolls", "nadmod_cleanclragdolls")
|
||||
Panel:Button("Cleanup World Ropes", "nadmod_cleanworldropes")
|
||||
Panel:Button("Freeze All Props", "nadmod_freezeworld")
|
||||
end
|
||||
|
||||
local metaply = FindMetaTable("Player")
|
||||
|
@ -413,6 +413,25 @@ function NADMOD.CleanupPlayerProps(steamid)
|
||||
return count
|
||||
end
|
||||
|
||||
function NADMOD.FreezePlayerProps(steamid)
|
||||
local count = 0
|
||||
for k,v in pairs(NADMOD.Props) do
|
||||
if(v.SteamID == steamid) then
|
||||
if IsValid(v.Ent) then
|
||||
if !v.Ent:GetPersistent() then
|
||||
local phys = v.Ent:GetPhysicsObject()
|
||||
if IsValid(phys) then
|
||||
phys:Sleep()
|
||||
phys:EnableMotion(false)
|
||||
end
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
function NADMOD.CleanPlayer(ply, tar)
|
||||
if IsValid(tar) and tar:IsPlayer() then
|
||||
local count = NADMOD.CleanupPlayerProps(tar:SteamID())
|
||||
@ -527,6 +546,15 @@ function NADMOD.DebugTotals(ply,cmd,args)
|
||||
end
|
||||
concommand.Add("nadmod_totals", NADMOD.DebugTotals)
|
||||
|
||||
function NADMOD.FreezeWorld(ply,cmd,args)
|
||||
if ply:IsValid() and not NADMOD.IsPPAdmin(ply) then return end
|
||||
NADMOD.Notify("Froze all props on the server")
|
||||
for k,v in ipairs(player.GetAll()) do
|
||||
NADMOD.FreezePlayerProps(v:SteamID())
|
||||
end
|
||||
end
|
||||
concommand.Add("nadmod_freezeworld", NADMOD.FreezeWorld)
|
||||
|
||||
--=========================================================--
|
||||
-- Clientside Callbacks for the Friends/Options panels --
|
||||
--=========================================================--
|
||||
|
Loading…
Reference in New Issue
Block a user