jds137 Posted September 30, 2009 Posted September 30, 2009 I am not sure where to post it, so ill try here. I was wondering how do I make a count down timer between energy gains: EX { Energy: 2 minutes 02 seconds} and every time the cron runs it would start all over again. I tried figuring it out, but its beyond me. lol And I know someone here is a wiz, and can figure it out. Energy Regain: +5 every 10 minutes. (00:14s) Is how it would look Quote
Agon Posted September 30, 2009 Posted September 30, 2009 Can you create a 10 minute cron file an ad something like this to it: mysql_query="UPDATE users SET energy=energy+5 WHERE energy<maxenergy"; Quote
Agon Posted September 30, 2009 Posted September 30, 2009 Oh... I see what you mean, a countdown timer until next energy refill Quote
Curt Posted September 30, 2009 Posted September 30, 2009 im not sure how you would do this....but i know what you would need to do it..lol if you want it so that each time you refresh the page it will show the time remaining you will need to use timestamps i believe.. but if you want it so it continuously countsdown with out refreshing you would need javascript i believe... im interesting in seeing this get solved because i wanna do something like this with my mug system...so it says how much time is left before they can mug again.. Quote
Kasabian Posted September 30, 2009 Posted September 30, 2009 Yeah, Like curt said i would do it using Timestamps. Add a new row in your settings called something like fivemincron. Then get it to update that record with a timestamp when the cron is run. then on the main page just simply format the time stamp static using php or put it in to a JavaScript function to make it dynamic and count down in real time. This might be helpful for the javascript part: http://www.phpfreaks.com/forums/index.php?topic=228348.0 Quote
seanybob Posted October 1, 2009 Posted October 1, 2009 Two tutorials about this on my blog: http://teachthe.net/?p=38 http://teachthe.net/?p=610 I 'think' that's what you're talking about. It was a little ambiguous though... Quote
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.