Jump to content


Photo

Need some help.


  • Please log in to reply
4 replies to this topic

#1 Dogboys

Dogboys
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 21 May 2006 - 06:58 AM

How would i make it so everyones mana recharged?

So like `$mana` is the stat that i want to reset to full for everyone at the begginging of each day.

Thank you for your time.

#2 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 21 May 2006 - 08:03 AM

You need to set up a Cron Job to run every night at a certain time to reset the stat.

I don't have any experience, but you can always google it.

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]

#3 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 21 May 2006 - 08:43 AM

please take the time to post a more specific question. you are only doing yourself a dis-service, as nobody can help you if they don't know the details.

for instance, i can assume that you have a column called mana in a mysql database, and i can assume that the value for fully recharged mana is 100. so the query string would look like this:

update tablename set mana=100

and i can assume that you know enough php to be able to connect to your database and run that query, and i can assume that if i told you to make a cron job and set it for every 24 hours, you'd know what i was talking about.

but that's a lot of assumptions and this could very easily have been a complete waste of time posting this help, as none of it could apply to you. is it really that hard to be more specific?

i'm sorry. i'm tired. been up for almost 48 hours. but it's true, nonetheless. that just happens to be one of my pet peeves.

Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#4 Barand

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

Posted 21 May 2006 - 08:54 AM

An alternative to a cron job is to store the date that the mana was last recharged.

if that date is not today's date, recharge the mana to 100.
Set the date recharged to today.
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

#5 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 21 May 2006 - 09:10 AM

re: barand's alternative: A person's mana will not actually recharge until they access the script that does that. So you could have some people who access that script everyday, and other people who only login once a week. They will be recharged just the same, but at different, user dependent times. You may or may not need to consider that in how you want your code to behave.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users