addon that autocleans players props after he has left?
7 replies, posted
I used to use DPP (a prop protection addon) but we decidet that its not what we need. I own a sandbox server and freezing shit constantly really ruins the fun.
So all I need is something to autoclean someones stuff 60 secs after he has left. Is there an addon like this? (DPP used to do that)
Falco's Prop Protection can do this.
[QUOTE=vkk;52713255]Falco's Prop Protection can do this.[/QUOTE]
Preferrably not a prop protection. We want to build without being annoyed lol
The GM:PlayerDisconnected hook is called every time a player leaves your server and the player entity is passed through. Add a hook for GM: PlayerDisconnected. In the hook, create a timer that executes in 60 seconds. The function in this timer could then loop through each prop on the map and check if if it was spawned by this (disconnected) player. If it is, then the prop can be removed.
I made a tiny addon years ago that did this for my build server named [url=https://steamcommunity.com/sharedfiles/filedetails/?id=189426501]Keep Clean[/url], should still work.
[QUOTE=colincooke;52713644]The GM:PlayerDisconnected hook is called every time a player leaves your server and the player entity is passed through. Add a hook for GM: PlayerDisconnected. In the hook, create a timer that executes in 60 seconds. The function in this timer could then loop through each prop on the map and check if if it was spawned by this (disconnected) player. If it is, then the prop can be removed.[/QUOTE]
How can I get the original creator?
[editline]26th September 2017[/editline]
[QUOTE=Looter;52716922]I made a tiny addon years ago that did this for my build server named [url=https://steamcommunity.com/sharedfiles/filedetails/?id=189426501]Keep Clean[/url], should still work.[/QUOTE]
Thanks! I will try it
[code]
hook.Add( "PlayerDisconnected", "prop_janitor_3000", function( ply )
for k, v in pairs( ents.GetAll() ) do
if v:CPPIGetOwner() and v:CPPIGetOwner() == ply then
local killtimer = 59 + math.Rand( 0, 2 ) -- change to change cleanup time, added a math.Rand so it looks cooler rather than all their stuff spontaneously vanishing at once
timer.Simple( killtimer, function() if v:IsValid() and !v:CPPIGetOwner():IsValid() then v:Remove() end end)
end
end
end )[/code]
not tested but it should work as long as whatever system you use for prop ownership supports CPPI
Sorry, you need to Log In to post a reply to this thread.