Jump to content

Using time...


xyn

Recommended Posts

Hey Guys,
I have a small project, but my knowlege on MKTime(); and time(); is
pretty 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. but
I don't know what to do. My guess is...

To time stamp during the logged in time, and everytime the user views a page
the time stamp is updated, and then using mktime() (somehow)
take the time stamp, and check the current time if the current time is
5 - 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.
Link to comment
Share on other sites

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.php
http://us2.php.net/date
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.