Auto Clear World - Lua

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

-- //+------------------------------------------------------------------+

-- [ SYNCHHH ]
-- Note
-- Enable
-- Antibounce, ModFly, Anti Lava
-- (Optional)
-- Anti Lag , Anti Check Point, Anti Portal/Door, Anti Punch, Cant Pickup Item
-- //+------------------------------------------------------------------+
-- //+-----------------------------SETUP--------------------------------+
-- //+------------------------------------------------------------------+
-- [ SYNCHHH ] --
worldname = "" -- leave this blank if u clear for only current world
worlds = 95
worlde = 99
maxPlayerCount = 1
enableoptional = true
-- //+------------------------------------------------------------------+
-- //+------------------------------------------------------------------+
-- //+------------------------------------------------------------------+
-- //+------------------------------------------------------------------+
-- //+------------------------------------------------------------------+
-- //+------------------------------------------------------------------+
-- //+------------------------------------------------------------------+
-- //+------------------------------------------------------------------+
-- //+------------------------------------------------------------------+
-- //+------------------------------------------------------------------+
bedrockID = FindItemID("Bedrock") -- Bedrock = 8
blankID = FindItemID("Blank") -- Blank = 0
EditToggle("Antibounce", true)
EditToggle("Anti Lava", true)
if enableoptional then
EditToggle("ModFly", true)
EditToggle("Anti Lag", true)
EditToggle("Anti Check Point", true)
EditToggle("Anti Portal/Door", true)
EditToggle("Anti Punch", true)
EditToggle("Cant Pickup Item", true)
end
-- //+------------------------------------------------------------------+
function punch(x, y)
pkt = {}
pkt.px = x;
pkt.py = y;
pkt.type = 3;
pkt.value = 18;
pkt.x = GetLocal().posX;
pkt.y = GetLocal().posY;
SendPacketRaw(false, pkt);
Sleep(180);
end
-- //+------------------------------------------------------------------+
function getPlayerCount()
count = 0
for _, player in pairs(GetPlayerList()) do count = count + 1 end
return count
end
-- //+------------------------------------------------------------------+
function clearWorld(PlayerRangeX, PlayerRangeY)
botPosX = math.floor(GetLocal().posX / 32)
botPosY = math.floor(GetLocal().posY / 32)
for _, tile in pairs(GetTiles()) do
if (tile.y < 54 and tile.y > 23) then
if math.abs(tile.x - botPosX) <= PlayerRangeX and
math.abs(tile.y - botPosY) <= PlayerRangeY then
if tile.flag == 1 and tile.fg ~= bedrockID then
punch(tile.x, tile.y) -- punch solid block
return true
elseif tile.bg ~= blankID and tile.fg ~= bedrockID then
punch(tile.x, tile.y) -- punch bg
return true
elseif tile.fg == bedrockID and GetTiles(tile.x, tile.y + 1).bg ~=
blankID then
punch(tile.x, tile.y + 1) -- punch bg
return true
end
elseif tile.bg ~= blankID and tile.fg ~= bedrockID then
if GetTiles((math.floor(tile.x / 5) * 5) + 2, tile.y - 1).fg ~=
bedrockID then
FindPath((math.floor(tile.x / 5) * 5) + 2, tile.y - 1)
else
FindPath((math.floor(tile.x / 5) * 5) + 2, tile.y - 2)
end
Sleep(100)
return true
end
end
end
return false
end
-- //+------------------------------------------------------------------+
function oneWorld()
runWorldClear = true
while runWorldClear == true do
if getPlayerCount() <= maxPlayerCount then
if clearWorld(2, 2) == false then runWorldClear = false end
else
SendPacket(2, "action|respawn")
Sleep(5000)
while getPlayerCount() > maxPlayerCount do Sleep(10000) end
end
end
end
-- //+------------------------------------------------------------------+
-- MAIN FUNCTION START HERE
-- //+------------------------------------------------------------------+
if worldname ~= "" then
for i = worlds, worlde, 1 do
SendPacket(3, "action|join_request\nname|" .. worldname .. i)
Sleep(10000)
LogToConsole("World Clearing")
::avoidloop::
if pcall(oneWorld) == false then goto avoidloop end
LogToConsole("World Clearing Ended")
end
else
LogToConsole("World Clearing")
::avoid::
if pcall(oneWorld) == false then goto avoid end
LogToConsole("World Clearing Ended")
end
-- //+------------------------------------------------------------------+

You might also like