Hello,
I decide to make a script which may come handy!
This script is a cleaning script, you decide which area of the map should be cleaned and which time it will executed!
WARNING = EVERYTHING YOU MAKE WITH THE GAMEMASTER AND THROW IT ON THE CLEANING AREA IT WILL BE REMOVED INCLUDING WALLS, STREET LAMPS, BENCHS EVERYTHING -- GROUNDS IDK NEVER TESTED XD!
This script is good because it wont clean the things you added with mapeditor, so it will just clean everything the players throws!
Enjoy!
Give me some feedback
Go to globalevent/globalevent.xml and add this line below:
Now go to globalevent/scripts and create new lua and name it "cleanarea" and paste this script below:
I decide to make a script which may come handy!
This script is a cleaning script, you decide which area of the map should be cleaned and which time it will executed!
WARNING = EVERYTHING YOU MAKE WITH THE GAMEMASTER AND THROW IT ON THE CLEANING AREA IT WILL BE REMOVED INCLUDING WALLS, STREET LAMPS, BENCHS EVERYTHING -- GROUNDS IDK NEVER TESTED XD!
This script is good because it wont clean the things you added with mapeditor, so it will just clean everything the players throws!
Enjoy!
Give me some feedback
Go to globalevent/globalevent.xml and add this line below:
Code:
<globalevent name="cleanarea" interval="1200" event="script" value="cleanarea.lua"/>
Now go to globalevent/scripts and create new lua and name it "cleanarea" and paste this script below:
Lua:
local created_by_otswe = true -- Do not edit, if you touch this line the script will not work propely
local otswe = {
Clean_Time = 20, -- When the warning text has been broadcast, for how many seconds should it take to execute the clean
Warning_Text_Before_Clean = "A area will be cleaned in 20 seconds, so pick up your trash or see it vanish", -- Here can you edit the warning text
Done_Text = "Next area clean will be excuted in 20min" -- Here you can edit the done text
}
local OtsweCleaningAreaPositions = {
from = {x=994,y=1008,z=7}, -- From top left -- Top left of the cleaning area
to = {x=999,y=1012,z=7} -- to bottom right -- Bottom left of the cleaning area
}
function isCleanAbleArea(pos)
pos.stackpos = 0
local tile = getThingfromPos(pos, false)
if tile ~= 0 and not hasProperty(tile.uid, CONST_PROP_BLOCKSOLID) and not isCreature(getTopCreature(pos).uid) then
return true
end
end
function executeOtsweAreaClean()
doBroadcastMessage(otswe.Done_Text)
for x = OtsweCleaningAreaPositions.from.x, OtsweCleaningAreaPositions.to.x do
for y = OtsweCleaningAreaPositions.from.y, OtsweCleaningAreaPositions.to.y do
local p = {x=x,y=y,z=OtsweCleaningAreaPositions.from.z}
if isCleanAbleArea(p) or created_by_otswe == true then
doCleanTile(p,false)
end
end
end
end
function onThink(cid, interval, lastExecution)
addEvent(executeOtsweAreaClean, otswe.Clean_Time*1000)
doBroadcastMessage(otswe.Warning_Text_Before_Clean)
return true
end