Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modules = peripheral.wrap("back")
- local owner = "SkyCrafter0"
- local afk = false
- modules.capture("^s/")
- local function split(inputstr,sep)
- sep = sep or "%s"
- local t = {}
- for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do table.insert(t, str) end
- return t
- end
- local function main()
- while true do
- local _, message, capture, player, uuid = os.pullEvent("chat_capture")
- --print(player .. " said " .. message)
- local cmd = split(message,"/")
- local command = cmd[2]
- if player == owner and command == "afk" then
- if cmd[3] == "on" then
- afk = true
- print("AntiAFK On")
- modules.tell("AntiAFK On")
- elseif cmd[3] == "off" then
- afk = false
- print("AntiAFK Off")
- modules.tell("AntiAFK Off")
- end
- elseif player == owner and command == "scan" then
- print("Scanning for " .. cmd[3])
- local tScan = modules.scan()
- local oX,oY,oZ = 0,0,0
- local pX,pY,pZ = gps.locate()
- for i=1, #tScan do
- if tScan[i].name == cmd[3] then
- oX,oY,oZ = tScan[i].x,tScan[i].y,tScan[i].z
- end
- end
- print("Local offset: ", oX,oY,oZ)
- local rX,rY,rZ = pX+oX,pY+oY,pZ+oZ
- if rX == pX and rY == pY and rZ == pZ then
- modules.tell("Block not found")
- print("Block not found")
- else
- modules.tell("The block is at " .. tostring(rX) .. ", " .. tostring(rY) .. ", " .. tostring(rZ))
- print("Real Location: ", rX,rY,rZ)
- end
- end
- end
- function doJump()
- while true do
- if afk then
- modules.launch(0,-90,4)
- end
- sleep(120)
- end
- end
- parallel.waitForAny(main,doJump)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement