Author Topic: Time managment  (Read 1144 times)

Offline Dr3amz

  • Level 2
  • *
  • Posts: 4
  • Reputation: +0/-0
    • View Profile
Time managment
« on: January 04, 2008, 03:12:51 AM »
Ohh gods of browser-based games here my prayers  -|-

i am trying to make a job system where you can buy a upgrade and depending on that upgrade work like 3 or 4 or 5... hours and you will have to wait that time to get the money, problem is i have no idear how to go about this...    T_T

Tks to all response.   

Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Re: Time managment
« Reply #1 on: January 04, 2008, 03:35:47 AM »
You could use cron jobs if the time to work is regular and in whole hours :)

Or, use timestamps. Save the timestamps of when the job begins and the time it takes to the database. Then, in a header file or in a cron job, check the timestamp and update all the jobs that have completed.

Offline Equinox

  • Game Owner
  • Level 10
  • *
  • Posts: 58
  • Reputation: +2/-0
    • View Profile
    • Equinox Gaming Solutions
Re: Time managment
« Reply #2 on: January 04, 2008, 03:36:34 AM »
Add a field into the DB where when they upgrade it inputs a timestamp, and then when it reaches x hours after, it can then do what the upgrade is meant to do, or show as the upgrade is complete when looking.

EDIT: and Zeggy thought the same and posted same time as me :D lol
Equinox Gaming Solutions Manager
http://www.equinoxgaming.co.uk

Offline Dr3amz

  • Level 2
  • *
  • Posts: 4
  • Reputation: +0/-0
    • View Profile
Re: Time managment
« Reply #3 on: January 04, 2008, 03:56:23 AM »
whats the code to make a time live like you can see it count down iv tested it just now but time is not counting down...    -_-


this is what i put as code :



Code: [Select]
echo "$left Seconds Left";

Offline dNs

  • Level 4
  • *
  • Posts: 10
  • Reputation: +0/-0
    • View Profile

Offline JGadrow

  • Level 35
  • **
  • Posts: 1,133
  • Reputation: +23/-2
    • View Profile
Re: Time managment
« Reply #5 on: January 18, 2008, 09:45:05 AM »
To do the 'count-down' you will need to use a client-side technology (such as JavaScript) or set a meta tag telling the browser to refresh itself, but that would get annoying real fast :)
Idiocy - Never underestimate the power of stupid people in large groups.


 


SimplePortal 2.3.3 © 2008-2010, SimplePortal