Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------ Cleanup ------------------------------
- local function GetStuff(ply)
- local stuff = {}
- local index = 1
- local name = " "
- name = ply:Nick()
- for k,entity in pairs( ents.GetAll() ) do
- local owner = entity:GetOwner()
- if owner:Nick() == name then
- stuff[index] = entity
- index = index + 1
- end
- end
- return stuff
- end
- function OwnProps(ply,model,prop)
- prop:SetOwner(ply)
- end
- hook.Add("PlayerSpawnedProp", "OwnProps", OwnProps)
- function ulx.cleanup( calling_ply, target_plys )
- local stuff = {}
- for k, plys in pairs(target_plys) do
- stuff = GetStuff(plys)
- for k, v in pairs(stuff) do
- if v:IsValid() then
- v:Remove()
- Print("CleanupWorked")
- end
- end
- end
- end
- cleanup = ulx.command( CATEGORY_NAME, "ulx cleanup", ulx.cleanup, "!cleanup" )
- cleanup:addParam{ type=ULib.cmds.PlayersArg, ULib.cmds.optional }
- cleanup:defaultAccess( ULib.ACCESS_ADMIN )
- cleanup:help( "Cleanup Targets props" )
- ---------------------------------------------------------------------
Add Comment
Please, Sign In to add comment