This script was originally created by Mock. I converted it into a Mod. So all credits goes to the original scripter.
Make a new file in the Mods folder called broom.xml and add this.
And your done.
Note:
This can only be used by Community Managers and higher. Also please note that this broom can clean npcs as well, so take caution when using it.
Original Script
This mod was tested using TFS 0.3.6!
Make a new file in the Mods folder called broom.xml and add this.
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Cleaning Broom" version="1.0" author="collz" contact="none" enabled="yes">
<action itemid="2324" allowfaruse="1" event="script"><![CDATA[
local removeCreature = true
local maxStackpos = 255
local minStackpos = 1
function cleanSqm(Itempos) --- By mock the bear
doSendMagicEffect(Itempos,36)
Itempos.stackpos = 255
local Item = getThingfromPos(Itempos,false)
if (removeCreature and isCreature(Item.uid)) then
doSendAnimatedText(Itempos,"Creature", TEXTCOLOR_DARKRED)
if Item.uid ~= cid and not isPlayer(Item.uid) or getPlayerGroupId(Item.uid) == 1 then
doRemoveCreature(Item.uid)
end
end
for stack=-maxStackpos,minStackpos do
Itempos.stackpos = stack*-1
if Itempos.stackpos == 0 then break end
local id = getThingfromPos(Itempos)
if id.itemid > 0 and id.uid > 0 and not isCreature(id.uid) then
if isMoveable(id.uid) then
doRemoveItem(id.uid,-1)
end
end
end
end
function executeInArea(pos, area,cmd,...)--by Nord and Mock
local center = {}
center.y = math.floor(#area/2)+1
for y = 1, #area do
for x = 1, #area[y] do
local number = area[y][x]
if number > 0 then
center.x = math.floor(table.getn(area[y])/2)+1
local pos = {x = pos.x + x - center.x, y = pos.y + y - center.y, z = pos.z}
if type(cmd) == 'string' then
local b = _G
b.pos = pos
local f = assert(loadstring(cmd))
setfenv(f, b)
f(pos,...)
elseif type(cmd) == 'function' then
cmd(pos,...)
end
end
end
end
end
function onUse(cid, item, frompos, item2, topos) --- By mock the bear
if getPlayerAccess(cid) >= 4 then
executeInArea({x=topos.x,y=topos.y,z=topos.z}, {
{0,0,0,1,0,0,0},
{0,0,1,1,1,0,0},
{0,1,1,1,1,1,0},
{1,1,1,1,1,1,1},
{0,1,1,1,1,1,0},
{0,0,1,1,1,1,0},
{0,0,0,1,0,0,0},
},cleanSqm)
return true
end
return false
end
]]></action>
</mod>
Note:
This can only be used by Community Managers and higher. Also please note that this broom can clean npcs as well, so take caution when using it.
Original Script
This mod was tested using TFS 0.3.6!