daily pastebin goal
8%
SHARE
TWEET

afk.lua

a guest Jun 8th, 2018 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local gpu = require("component").gpu
  2. local redstone = require("component").redstone
  3. local radar = require("component").radar
  4. local computer = require("computer")
  5.  
  6. local distance = 2
  7. local timeout = 30
  8. -----------------------------------------------------
  9.  
  10. gpu.setResolution(2, 1)
  11. gpu.set(1, 1, "  ")
  12.  
  13. local function wait(time)
  14.   time = math.floor(time)
  15.   for i = time, 1, -1 do
  16.     local out = tostring(i)
  17.     if string.len(out) == 1 then out = "0"..out end
  18.     gpu.set(1, 1, out)
  19.    
  20.     os.sleep(1)
  21.     players = radar.getPlayers(distance)
  22.     if #players == 0 then
  23.       gpu.set(1, 1, "  ")
  24.       return false
  25.     end
  26.   end
  27.  
  28.   return true
  29. end
  30.  
  31. while true do
  32.   local players = radar.getPlayers(distance)
  33.   if #players > 0 then
  34.     local result = true
  35.     while result do
  36.       result = wait(timeout)    
  37.       if result then
  38.         gpu.set(1, 1, "$$")
  39.         redstone.setOutput(require("sides").up, 15)
  40.         os.sleep(0.2)
  41.         redstone.setOutput(require("sides").up, 0)
  42.         os.sleep(0.3)
  43.       end
  44.     end
  45.   end
  46. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top