xyn Posted September 1, 2006 Share Posted September 1, 2006 Hey Guys,I have a small project, but my knowlege on MKTime(); and time(); ispretty crap, could someone help me brush my skills on this.Basically I am designing a small online text based game (un-original i know)And for every 5 minutes i wanted a character to lose 1% hunger. butI don't know what to do. My guess is...To time stamp during the logged in time, and everytime the user views a pagethe time stamp is updated, and then using mktime() (somehow)take the time stamp, and check the current time if the current time is5 - 10 mins longer than the last time stamp then take 1% hunger.otherwise do nothing...I might be barking up the wrong tree, any advice guys?I apreciate it. Quote Link to comment Share on other sites More sharing options...
Caesar Posted September 1, 2006 Share Posted September 1, 2006 Using PHP's time(); function would be fine. Store it like that in the db or session and then format later for display or comparison purposes. Quote Link to comment Share on other sites More sharing options...
xyn Posted September 1, 2006 Author Share Posted September 1, 2006 :/ Lol. how would i do this?like...time() + 10; or what ever? :/To check every 10 minutes to last time updated. Quote Link to comment Share on other sites More sharing options...
Caesar Posted September 1, 2006 Share Posted September 1, 2006 That wouldn't be the way to check it, no. I can't write the code for you...especially if you are going to charge or make money in any way off of this. If you plan on making this a business venture or a site that will generate income...you need to seriously invest some time into learning PHP.Myabe this will point you in the right direction:If you're storing the time in a database, you will need to use conditional statements and define the actions taken depending on the difference in time. You should store them as timestamps and then format them before doing the comparisons.Take a look at :http://us2.php.net/manual/en/function.time.phphttp://us2.php.net/date Quote Link to comment Share on other sites More sharing options...
xyn Posted September 1, 2006 Author Share Posted September 1, 2006 yeh, this isn't a company and It is 100% free :/Just something i'm doing for fun... Quote Link to comment Share on other sites More sharing options...
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.