Please change this Cleanup Script (easy)

Hello, can someone please change this LUA from FAdmin (A built in DarkRP Admin mod) to cleanup everything BUT: Sents, Sweps, Door Groups. Currently FAdmin cleanup literally wipes the map clean, including Doorgroups… I just want the props, ropes and other crap gone…

[lua]local function ClearDecals(ply, cmd, args)
if not FAdmin.Access.PlayerHasPrivilege(ply, “CleanUp”) then FAdmin.Messages.SendMessage(ply, 5, “No access!”) return end

for k,v in pairs(player.GetAll()) do
	v:ConCommand("r_cleardecals")
end
FAdmin.Messages.ActionMessage(ply, player.GetAll(), "You have removed all decals", "All decals have been removed", "Removed all decals")

end

local function StopSounds(ply, cmd, args)
if not FAdmin.Access.PlayerHasPrivilege(ply, “CleanUp”) then FAdmin.Messages.SendMessage(ply, 5, “No access!”) return end

umsg.Start("FAdmin_StopSounds")
umsg.End()

FAdmin.Messages.ActionMessage(ply, player.GetAll(), "You have stopped all sounds", "All sounds have been stopped", "Stopped all sounds")

end

local function CleanUp(ply, cmd, args)
if not FAdmin.Access.PlayerHasPrivilege(ply, “CleanUp”) then FAdmin.Messages.SendMessage(ply, 5, “No access!”) return end
game.CleanUpMap()
hook.Call(“InitPostEntity”, GAMEMODE)

FAdmin.Messages.ActionMessage(ply, player.GetAll(), "You have cleaned up the map", "The map has been cleaned up", "Cleaned up the map")

end

FAdmin.StartHooks[“CleanUp”] = function()
FAdmin.Commands.AddCommand(“ClearDecals”, ClearDecals)
FAdmin.Commands.AddCommand(“StopSounds”, StopSounds)
FAdmin.Commands.AddCommand(“CleanUp”, CleanUp)

FAdmin.Access.AddPrivilege("CleanUp", 2)

end[/lua]

You have to find the game.CleanUpMap() function in order to edit what items are to be removed. All this does at the moment is add the command, what function/usermessage to call, and send a message whether you have access or not.

Isn’t it right there?

[lua]local function CleanUp(ply, cmd, args)
if not FAdmin.Access.PlayerHasPrivilege(ply, “CleanUp”) then FAdmin.Messages.SendMessage(ply, 5, “No access!”) return end
game.CleanUpMap()
hook.Call(“InitPostEntity”, GAMEMODE)[/lua]

Can I add some string in the brackets to indicate what I want it to delete? Right now in my understanding it is deleting “()” which means everything So if I did (just another example, i have NO idea what i’m doing) this:

[lua]local function CleanUp(ply, cmd, args)
if not FAdmin.Access.PlayerHasPrivilege(ply, “CleanUp”) then FAdmin.Messages.SendMessage(ply, 5, “No access!”) return end
game.CleanUpMap(PROPS,ROPES)
hook.Call(“InitPostEntity”, GAMEMODE)[/lua]

Would doing something like that tell it to only delete Props and Ropes?

[editline]30th July 2011[/editline]

Also I found this Wiki Page explaining game.CleanUpMap

It says under ADDITIONAL NOTES something about what I was explaining, with adding entities to NOT be cleaned

Oh shoot. I thought CleanUpMap was a function defined by FAdmin. Uhm.

I honestly don’t know the entity names or types off hand but you could do exactly what you were talking about.

Make a table of strings at the top for the entity types/names that you don’t want removed and put that table inside CleanUpMap

Ex:

FilterTable = { “prop_ragdoll”, “npc_zombie” }
game.CleanUpMap( true, FilterTable )

Oh wow, thanks a bunch, that juts may do it… Do you know where I can find the names of the things I want specified? I don’t know what to call some of my things that I don’t want deleted, like normal props, weapons and entities. I see you specified “prop_ragdoll” and “npc_zombie” but how did you know to call them this?

EDIT:

Nevermind, I figured that out. I just added “Spawned_shipment” “spawned_weapon” etc… Would you happen to know how to fix FAdmin cleanup from erasing door groups?

[lua]local function ClearDecals(ply, cmd, args)
if not FAdmin.Access.PlayerHasPrivilege(ply, “CleanUp”) then FAdmin.Messages.SendMessage(ply, 5, “No access!”) return end

for k,v in pairs(player.GetAll()) do
	v:ConCommand("r_cleardecals")
end
FAdmin.Messages.ActionMessage(ply, player.GetAll(), "You have removed all decals", "All decals have been removed", "Removed all decals")

end

local function StopSounds(ply, cmd, args)
if not FAdmin.Access.PlayerHasPrivilege(ply, “CleanUp”) then FAdmin.Messages.SendMessage(ply, 5, “No access!”) return end

umsg.Start("FAdmin_StopSounds")
umsg.End()

FAdmin.Messages.ActionMessage(ply, player.GetAll(), "You have stopped all sounds", "All sounds have been stopped", "Stopped all sounds")

end

local function CleanUp(ply, cmd, args)
if not FAdmin.Access.PlayerHasPrivilege(ply, “CleanUp”) then FAdmin.Messages.SendMessage(ply, 5, “No access!”) return end
local FilterTable = { “spawned_weapon”, “spawned_shipment”, “spawned_drug”, “spawned_money”,
“spawned_food”, “standard_printer”, “prop_door_rotating”, “func_door_rotating”, “func_door”, “prop_door” }
game.CleanUpMap( true, FilterTable )
hook.Call(“InitPostEntity”, GAMEMODE)

FAdmin.Messages.ActionMessage(ply, player.GetAll(), "You have cleaned up the map", "The map has been cleaned up", "Cleaned up the map")

end

FAdmin.StartHooks[“CleanUp”] = function()
FAdmin.Commands.AddCommand(“ClearDecals”, ClearDecals)
FAdmin.Commands.AddCommand(“StopSounds”, StopSounds)
FAdmin.Commands.AddCommand(“CleanUp”, CleanUp)

FAdmin.Access.AddPrivilege("CleanUp", 2)

end[/lua]

I got it :slight_smile: This is the WORKING lua for FAdmin cleanup, it ignore doors, shipments, guns, food, drugs.