Advertisement
tjone270

Example of threaded minqlx loop

Jul 13th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. import minqlx, time
  2.  
  3. class ExamplePlugin(minqlx.Plugin):
  4.     def __init__(self):
  5.         self.add_hook("unload", self.handle_unload)
  6.         self.running = True
  7.         self.run_loop()
  8.  
  9.     @minqlx.thread
  10.     def run_loop(self):
  11.         if (not self.running): break
  12.         #put your loop code here
  13.         time.sleep(1)
  14.  
  15.     def handle_unload(self, plugin):
  16.         if (plugin == self.__class__.__name__):
  17.             self.running = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement