Jump to content

Archived

This topic is now archived and is closed to further replies.

Dogboys

Need some help.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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--]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

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.