fixed_pnb.lua

You might also like

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

bID, dPlace, dPunch = 2, 180, 180 -- bID = block id

autoCollect, autoDrop, customTile = true, true, 5


tilesC = {{2, 0}} -- dont change if u don't understand

tilesArr, ex, ye, tilesCC, seedID = {}, math.floor(getLocal().pos.x / 32),


math.floor(getLocal().pos.y / 32), {}, bID + 1

function collect(obj)
sendPacketRaw(
false,
{
type = 11,
value = obj.oid,
x = obj.pos.x,
y = obj.pos.y
}
)
end

function inv(id)
for _, item in pairs(getInventory()) do
if (item.id == id) then
return item.amount
end
end
return 0
end

function drop(id, count)


sendPacket(2, "action|drop\n|itemID|" .. id)
sleep(200)
sendPacket(2, "action|dialog_return\ndialog_name|drop_item\nitemID|" .. id ..
"|\ncount|" .. count)
end

function Collect()
mainpos = getLocal().pos
objects = getWorldObject()
for b = 1, #tilesCC do
for _, v in pairs(objects) do
if
(v.pos.x + 9) // 32 == ((mainpos.x + 10) // 32 + tilesCC[b][1]) and
(v.pos.y + 9) // 32 == ((mainpos.y + 15) // 32 + tilesCC[b][2])
then
collect(v)
sleep(10)
end
end
end
end

function place(id, x, y)
sendPacketRaw(
false,
{
x = getLocal().pos.x,
y = getLocal().pos.y,
punchx = math.floor(getLocal().pos.x / 32 + x),
punchy = math.floor(getLocal().pos.y / 32 + y),
type = 3,
value = id
}
)
end

function punch(x, y)
sendPacketRaw(
false,
{
x = getLocal().pos.x,
y = getLocal().pos.y,
punchx = math.floor(getLocal().pos.x / 32 + x),
punchy = math.floor(getLocal().pos.y / 32 + y),
type = 3,
value = 18
}
)
end

for i = math.floor(customTile / 2), 1, -1 do


i = i * -1
table.insert(tilesArr, i)
table.insert(tilesCC, {i, -1})
end

for i = 0, math.ceil(customTile / 2) - 1 do
table.insert(tilesArr, i)
table.insert(tilesCC, {i, -1})
end

for s = 1, #tilesC do
table.insert(tilesCC, {tilesC[s][1], tilesC[s][2]})
end

function tilesPunch(x, y)
for _, Numm in pairs(tilesArr) do
if checkTile(x + Numm, y - 1).fg ~= 0 or checkTile(x + Numm, y - 1).bg ~= 0
then
return true
end
end
return false
end

function tilesPlace(x, y)
for _, Numm in pairs(tilesArr) do
if checkTile(x + Numm, y - 1).fg == 0 and checkTile(x + Numm, y - 1).bg ==
0 then
return true
end
end
return false
end

while true do
logToConsole("`4PNB Active `p[`2Script Made By `wOhMyMeta`p]")
while tilesPlace(ex, ye) do
for _, i in pairs(tilesArr) do
if checkTile(ex + i, ye - 1).fg == 0 and checkTile(ex + i, ye - 1).bg
== 0 then
place(bID, i, -1)
sleep(dPlace)
end
end
end
while tilesPunch(ex, ye) do
for _, i in pairs(tilesArr) do
if checkTile(ex + i, ye - 1).fg ~= 0 or checkTile(ex + i, ye - 1).bg ~=
0 then
punch(i, -1)
sleep(dPunch)
end
end
end
if autoCollect then
Collect()
end
if autoDrop then
if inv(seedID) >= 100 then
drop(seedID, 100)
sleep(200)
end
end
end

You might also like