webpro 31 Posted February 4, 2017 Report Share Posted February 4, 2017 Any ideas on how to disable the bot for X amount of time?Let's say 24hrs? I will create some free bots but i don't want the users to abuse the system.So i thought that adding a 24hrs break after doing it's job, would be a good idea? That even if he/she fires up the bot again, it's got a timer or something, showing how much time they have to wait before using the bot again. How could i do this? Thanks Quote Link to post Share on other sites
TheBigWeb 40 Posted February 4, 2017 Report Share Posted February 4, 2017 Maybe you could write out to a text file the future date when the bot can continue and read this file / compare everytime the bot is started. If the current time is less than the future date, simply create a function to wait and check the date / time every minute or so. Put the code in a thread so it does not lock up the bot. The code could set a Gobal variable when the bot is #OKTORUN. Sorry, I would give example code but I don't have uBot available now. 1 Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted February 4, 2017 Report Share Posted February 4, 2017 Maybe you could write out to a text file the future date when the bot can continue and read this file / compare everytime the bot is started. If the current time is less than the future date, simply create a function to wait and check the date / time every minute or so. Put the code in a thread so it does not lock up the bot. The code could set a Gobal variable when the bot is #OKTORUN. Sorry, I would give example code but I don't have uBot available now.right idea right to file encrypted date(meters encryption plugin)onloadif file exists read and decrypt date/time if time_now !>= time_later: close bot(Aymens plugin) or taskkill set new time to file encrypt time_now + time_later(86400 = 24 hrs in sconds) and write to file Regards,Nick Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted February 4, 2017 Report Share Posted February 4, 2017 time code comment("seconds from epoch") set(#time now,$python result("","from time import time time()"),"Global") alert(#time now) set(#time later,$add(#time now,86400),"Global") alert("new time to encrpt {#time later}") if($comparison(#time now,"!= Does not equal",#time later)) { then { alert("No go, please wait.") comment("close bot") } } you can also get fancy and display time remaining in some way Regards,Nick Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.