LUA to remove Map props.

Hello Facepunch!

It feels like I have browsed the entire internet looking for this, you’re my last hope.

And I know how alot of you guys and girls hate DarkRP, but I’m trying to remove the map props from rp_c18_v1 with no success at all.

So if any of you has a script lying around for this or could point me in the right direction here, that would be awesome!

Merry christmas! :smiley:

-Jeff

I would say … go learn, ask a scripter or pay for a script … tho its xmas and not hard todo.
First thing you need to know is, all props/entities spawn after someone joined the server … so you need to put a timer on it.

[lua]
local List = {}
local function AddPosition(pos,radius)
table.insert(List,{pos,radius})
end
function RemoveProps()
local L = ents.FindByClass( “prop_physics” ) – List everything
for I=1,#L do – For each prop do
for II=1,#List do – Check each position if it matches
if L*:GetPos():Distance(List[II][1])<List[II][2] then – If the distance is within the given radius … then …
L*:Remove() – … remove it.
break; – No need to continue the check for this entity
end
end
end
end
timer.Simple(2,RemoveProps)
– TLDR (You should … if you want to learn lua) …
– Use “AddPosition(Vector(x,y,z),Radius)” below

AddPosition(Vector(0,0,0),10)
AddPosition(Vector(0,10,0),10)
AddPosition(Vector(0,0,523),10)

[/lua]

Thanks man, I appreciate it!

Something like this perhaps?



if SERVER then
        timer.Create("cleanshit", 15, 1, function()
	        for k, v in pairs(ents.FindByClass("prop_physics")) do v:Remove() end
        end)
end


I used this one, works excellent, thanks alot!