• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

GlobalEvent Automatic Cleaning Spefic Area!

Printer

if Printer then print("LUA") end
Senator
Premium User
Joined
Dec 27, 2009
Messages
5,782
Solutions
31
Reaction score
2,286
Location
Sweden?
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:
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
 
Thank you gus, im glad you guys like it :)
 
Good job otswe, very nice script. Im already using to to clean my otservers temple :)
 
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:
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


Can you make this clean Monsters? i have been having some problems with my raid spawns, that if i want the raid monster to spawn each 3h and because the spawn area dont clean so do i end up with 99999 ferumbras in the same room.

Btw awsome script :D
 
^up
I think its alrdy released.

bump
 
Back
Top