Advertisement
Guest User

startup.lua

a guest
Mar 24th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.84 KB | None | 0 0
  1. function playback(tf)
  2.     f=fs.open("playback","w")
  3.     f.write(tf)
  4.     f.close()
  5. end
  6. function check(uuid)
  7.     box=peripheral.wrap("right")
  8.     list=box.sense()
  9.     for i=1,#list do
  10.         if list[i].id==uuid then
  11.             if list[i].x>-1.5 and list[i].x<0.5 or list[i].y>2.5 and list[i].y<6 and list[i].z>1 and list[i].z<-0.5 then
  12.                 return true
  13.                 else return false
  14.             end
  15.             elseif i==#list then
  16.             return false
  17.         end
  18.     end
  19. end
  20.  
  21. mon=peripheral.find("monitor")
  22. box=peripheral.wrap("right")
  23.  
  24. mon.clear()
  25. mon.setTextScale(1)
  26.  
  27. afker=false
  28.  
  29. while afker==false do
  30.     _,player,message,uuid=os.pullEvent("chat_message")
  31.     if message=="test" then
  32.         if check(uuid) then
  33.             afker=true
  34.             playback("t")
  35.             shell.openTab("ducktales")
  36.             while check(uuid) do
  37.                 pfr=fs.open("employees/"..uuid,"r")
  38.                 if pfr then
  39.                     playername=pfr.readLine()
  40.                     pbalance=pfr.readLine()
  41.                     totalafktime=pfr.readLine()
  42.                     pfr.close()
  43.                     else
  44.                     pbalance=0
  45.                     totalafktime=0
  46.                 end
  47.                 sleep(3.6)
  48.                 pbalance=tonumber(pbalance)+0.01
  49.                 totalafktime=tonumber(totalafktime)+3.6
  50.                 pfw=fs.open("employees/"..uuid,"w")
  51.                 pfw.writeLine(player)
  52.                 pfw.writeLine(pbalance)
  53.                 pfw.writeLine(totalafktime)
  54.                 pfw.close()
  55.                 mon.clear()
  56.                 mon.setCursorPos(1,1)
  57.                 mon.write("Logged in as")
  58.                 mon.setCursorPos(1,2)
  59.                 mon.write(player..".")
  60.                 mon.setCursorPos(1,4)
  61.                 mon.write("Your balance:")
  62.                 mon.setCursorPos(1,5)
  63.                 mon.write(string.format("%.2f",pbalance).." kst")
  64.             end
  65.             playback("f")
  66.             for i=0,15 do
  67.                 mon.clear()
  68.                 mon.setCursorPos(1,1)
  69.                 mon.write(player)
  70.                 mon.setCursorPos(1,2)
  71.                 mon.write("left the area,")
  72.                 mon.setCursorPos(1,3)
  73.                 mon.write("AFK session over.")
  74.                 mon.setCursorPos(1,4)
  75.                 mon.write(player.."'s")
  76.                 mon.setCursorPos(1,5)
  77.                 mon.write("balance is:")
  78.                 mon.setCursorPos(1,6)
  79.                 mon.write(pbalance.." kst")
  80.                 mon.setCursorPos(1,8)
  81.                 mon.write("Payout in:")
  82.                 mon.setCursorPos(3,10)
  83.                 mon.write("Gold   Krist")
  84.                 mon.setCursorPos(1,12)
  85.                 mon.write("Closing in "..15-i)
  86.                 sleep(1)
  87.             end
  88.         end
  89.     end
  90. end
  91. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement