• Need help with removing default map props
    5 replies, posted
I have searched on the interner for like 2 days straight to find this with no luck. All I can do now is ask facepunch cause I try to remove the default props on rp_catalyst_v1 and I don´t want to mess arround with editing the map. If anyone had a lua fix for this I would realy appriciate it. Thanks in advance Jeromy Han
[lua] timer.Simple(1, function() if game.GetMap() == "rp_catalyst_v1" then for k,v in pairs(ents.GetAll()) do v:Remove() end end end) [/lua]
[QUOTE=deinemudda32;49804536][lua] timer.Simple(1, function() if game.GetMap() == "rp_catalyst_v1" then for k,v in pairs(ents.GetAll()) do v:Remove() end end end) [/lua][/QUOTE] This will remove every single entity, which isn't always good. To remove all props (as in chairs etc.) you might try this [lua] hook.Add("PostGamemodeLoaded", "CleanupProps",function () if game.GetMap()=="rp_catalyst_v1" then for k,v in pairs(ents.GetAll()) do if v:GetClass()=="prop_physics" then v:Remove() end end hook.Remove("PostGamemodeLoaded", "CleanupProps") end end)[/lua] Note: I didn't test the code and it might not work properly.
Where do I put this code exactly?
I personnaly would put it in "lua/autorun/server/" so it gets executed when the server starts up.
[QUOTE=Amic;49804564]This will remove every single entity, which isn't always good. To remove all props (as in chairs etc.) you might try this [lua] hook.Add("PostGamemodeLoaded", "CleanupProps",function () if game.GetMap()=="rp_catalyst_v1" then for k,v in pairs(ents.GetAll()) do if v:GetClass()=="prop_physics" then v:Remove() end end hook.Remove("PostGamemodeLoaded", "CleanupProps") end end)[/lua] Note: I didn't test the code and it might not work properly.[/QUOTE] This doesn´t work but I found this code [lua] if SERVER then timer.Create("cleanshit", 15, 1, function() for k, v in pairs(ents.FindByClass("prop_physics")) do v:Remove() end end) end[/lua] This code deletes the props but also all the permaprops I placed on the map is there maby a way to make a timer to reload permaprops 10 minutes after server restart The addon I'm talking about [url]http://steamcommunity.com/sharedfiles/filedetails/?id=220336312&searchtext=perma[/url] Thanks in advance Jeromy Han
Sorry, you need to Log In to post a reply to this thread.