Log in

View Full Version : Time Event Sort Of Thing



M2com
11-22-2011, 05:08 AM
I've been experimenting a lot with trying to find the right "formula" for having the user's character work for a certain amount of time and then the user is done working. If you have any ideas for making a script for this? :confused:

Thanks!

djr33
11-22-2011, 05:34 AM
You'll have to give us more information. You can store time in a database and add time as needed, then change some status information once you reach a certain level. But beyond that, we'll need to know a lot more about your site.

M2com
11-23-2011, 04:00 AM
Well let's say for example the user will work for 8 hours. What would be the best method for getting the time plus the eight hours. When the user logs in, the page would check if the current time is the same or greater than the work time. The work time script would need to take into consideration the changing of years and the time going past midnight.

Hope that gives a better idea of what I need some help with!

Thanks!

djr33
11-23-2011, 06:32 AM
If you work with timestamps, none of that is a problem. Just use basic math (addition and/or subtraction) then convert them to readable dates later.
https://www.google.com/search?q=working+with+dates+in+php

If you want someone to build this for you, you should post in the paid work requests area. You can probably do this yourself if you aren't in a big hurry. Just take it one step at a time, and it should work. It's not especially difficult to work with time once you understand it, and it doesn't take that long to learn.

M2com
11-24-2011, 02:43 AM
Thanks for getting me started! I believe I got a usable script I came up with!

Thanks again, can't believe I just should of thought of searching "working with dates in php".