Advertisement
XxDLCENERGYxX

afk my restaurant

Mar 27th, 2023
1,325
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.32 KB | None | 1 0
  1. import win32api, win32con, time, sys, os
  2.  
  3. def wait(t):
  4.     fin = time.time()+t
  5.     while time.time() < fin:
  6.         if win32api.GetAsyncKeyState(win32con.VK_ESCAPE): end(); sys.exit()
  7.         keyPress(VK_E); time.sleep(0.5)
  8.  
  9. VK_E = win32api.VkKeyScan('e')
  10. def keyPress(vk): win32api.keybd_event(vk,0); win32api.keybd_event(vk,0,win32con.KEYEVENTF_KEYUP)
  11.  
  12. ad = [win32api.VkKeyScan(k) for k in "ad"]
  13. def walk(ix):
  14.     dx = ad[ix]; win32api.keybd_event(dx,0); wait(0.3);
  15.     win32api.keybd_event(dx,0,win32con.KEYEVENTF_KEYUP)
  16.  
  17. def moveMouse(dx,dy): win32api.mouse_event(win32con.MOUSEEVENTF_MOVE,dx,dy) # update roblox cursor
  18. def setMouse(pos): win32api.SetCursorPos(pos); moveMouse(10,0); time.sleep(0.1); moveMouse(-8,0)
  19. def click(): win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0); win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
  20. def clickAt(pos):
  21.     for i in range(2): setMouse(pos); time.sleep(0.1)
  22.     click()
  23.  
  24. customers = 1185,345
  25. slotYes = 980,420
  26. slotOK = 1060,420
  27.  
  28. t = input("m,s\n").split(",")
  29. if t[0]=="": t = ["0","0"] # enter
  30. elif t[0]==" ": t = ["10","0"] # space enter
  31. elif len(t)==1: t+=["0"] # minute enter
  32. print("%sm %ss"%tuple(t))
  33. s = int(t[0])*60 + int(t[1])
  34. nextSlot = time.time()+s
  35.  
  36. print("Press CTRL to start")
  37. while not win32api.GetAsyncKeyState(win32con.VK_CONTROL): time.sleep(0.5)
  38. if time.time() > nextSlot: nextSlot = time.time()+2
  39.  
  40. os.system("cls")
  41.  
  42. start = time.time()
  43. def end():
  44.     d = int(time.time()-start)
  45.     m,s = divmod(d,60)
  46.     h,m = divmod(m,60)
  47.     input("%ih %im %is"%(h,m,s))
  48.  
  49. while not win32api.GetAsyncKeyState(win32con.VK_ESCAPE):
  50.     if time.time() > nextSlot:
  51.         walk(0); walk(0)           # 1. walk to slot machine
  52.         wait(1)                    # 2. open slot machine (clicks customers away)
  53.         clickAt(slotYes)           # 3. click yes
  54.         nextSlot = time.time()+600 # (timer reset)
  55.         walk(1); walk(1)           # 4. walk to customers
  56.  
  57.         wait(10)                   # (wait for rewards popup)
  58.         clickAt(slotOK)            # 5. click ok
  59.  
  60.         wait(5)                    # (incase popup lags)
  61.         clickAt(slotOK)            # 5. click ok
  62.  
  63.         wait(5)                    # (incase popup lags)
  64.         clickAt(slotOK)            # 5. click ok
  65.  
  66.     keyPress(VK_E)
  67.     time.sleep(0.5)
  68.  
  69. end()
  70.  
  71.  
  72.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement