Jump to content


Photo

Every hour increase by 10 min...


  • Please log in to reply
5 replies to this topic

#1 Dogboys

Dogboys
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 21 May 2006 - 05:26 PM

Ok so i want the $manamin to increase its minium by 10 every single hour.

So

(If $manamin >= is lower than $manamax increase $manamin by 10

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 21 May 2006 - 06:14 PM

Sounds reasonable. Care to share any code you have? Where/how are these variables stored? Where/how are these variables used?
Legend has it that reading the manual never killed anyone.
My site

#3 Dogboys

Dogboys
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 21 May 2006 - 07:14 PM

[!--quoteo(post=375831:date=May 21 2006, 01:14 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 21 2006, 01:14 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Sounds reasonable. Care to share any code you have? Where/how are these variables stored? Where/how are these variables used?
[/quote]

Well i was wondering if you could just convert it to a proper php code instead of my phony version of it.


Well variables are stored into a database.

Well my part of a script for the part the variable is used...


if ($usepoints==true) {
if ($userrow["$manamin"] < $townrow["$manacost"]) {
display("You dont have enough mana..", "Travel To"); die();

Im sorry if they script is wrong im no good at php.

#4 Dogboys

Dogboys
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 22 May 2006 - 02:52 AM

bump

#5 eves

eves
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 22 May 2006 - 12:24 PM

too general, but here's some algo you can use:
1. keep track of starting time, store it on DB
2. convert to timestamp and check difference of current time and starting time
3. if less than 1 hour, skip update
4. if more than or equal to 1 hour, increase value by 10, set starting time to current time, then update the fields on the database



#6 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 24 May 2006 - 06:44 AM

As you can see, it's exactly the same problem and solution as the previous one that you posted.

[a href=\"http://www.phpfreaks.com/forums/index.php?s=&showtopic=93883&view=findpost&p=375705\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?...ndpost&p=375705[/a]
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users