If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Countdown

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-07-05, 06:37
jwman jwman is offline
Registered User
 
Join Date: Aug 2004
Posts: 82
Exclamation Countdown

I am currently creating an Online RPG. My next module that I would like to add is a \"crimes\" section. Whereby you commit crimes in order to gain more money and experience. The majority of this I can handle, but I would like a timer interval between the times you can commit crimes. (So you commit a crime and then have to wait two minutes before you can commit another one). Is there anyway to write a countdown timer in a MySQL database which I can call and it will display the amount of time left until you can commit another crime.

Hopefully, this is possible. If not maybe a workaround which will have the same effect. NOTE: I would not like to use the Sleep() code.


Thanks for any help you can provide,

~Jordan
Reply With Quote
  #2 (permalink)  
Old 11-07-05, 12:04
jfulton jfulton is offline
Registered User
 
Join Date: Apr 2005
Location: Baltimore, MD
Posts: 297
I'm not totally sure, but I believe there is a date/time function that will return the difference between two times. I'm not at my workstation, so can't test/double check syntax but something along the lines of this should be a good start.

Code:
SELECT DATETIMEDIFF( (SELECT time FROM crimes WHERE ....), NOW());
Assuming you store each crime (and date) in the database. I'm probably wrong on the function name, but check the date and time functions in the docs for better info.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On