Guest User

Untitled

a guest
Jan 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. ------------------------------ Cleanup ------------------------------
  2. local function GetStuff(ply)
  3.     local stuff = {}
  4.     local index = 1
  5.     local name = " "
  6.     name = ply:Nick()
  7.     for k,entity in pairs( ents.GetAll() ) do
  8.         local owner = entity:GetOwner()
  9.         if owner:Nick() == name then
  10.             stuff[index] = entity
  11.             index = index + 1
  12.         end
  13.     end
  14.     return stuff
  15. end
  16.  
  17. function OwnProps(ply,model,prop)
  18.     prop:SetOwner(ply)
  19. end
  20. hook.Add("PlayerSpawnedProp", "OwnProps", OwnProps)
  21.  
  22. function ulx.cleanup( calling_ply, target_plys )
  23.    
  24.     local stuff = {}
  25.     for k, plys in pairs(target_plys) do
  26.        
  27.         stuff = GetStuff(plys)
  28.         for k, v in pairs(stuff) do
  29.             if v:IsValid() then
  30.                 v:Remove()
  31.                 Print("CleanupWorked")
  32.             end
  33.         end
  34.        
  35.        
  36.     end
  37.    
  38. end
  39. cleanup = ulx.command( CATEGORY_NAME, "ulx cleanup", ulx.cleanup, "!cleanup" )
  40. cleanup:addParam{ type=ULib.cmds.PlayersArg, ULib.cmds.optional }
  41. cleanup:defaultAccess( ULib.ACCESS_ADMIN )
  42. cleanup:help( "Cleanup Targets props" )
  43. ---------------------------------------------------------------------
Add Comment
Please, Sign In to add comment