Action after time passed / countdown reaching zero.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Lee Strong
Forum Newbie
Posts: 1
Joined: Sun Dec 20, 2009 4:31 pm

Action after time passed / countdown reaching zero.

Post by Lee Strong »

Greetings everyone, I'm fairly new in the web development industry and I need your help with a little problem of mine.
My creation uses data from MySQL, and is a game.

I wish to implement a system of which will add up x resources on a certain interval.

I'll explain it of how I understand it in terms of my script,
for example;

If a user has 0 resources to start, and given the users statistics should be collecting '520' of a resource (Titanium for example.) every hour. I've no idea where to start with this, it's rather important that the current resources variable is stored as a string/in the database.

Can anyone give me a heads up?

Kind Regards,
Lee.
Griven
Forum Contributor
Posts: 165
Joined: Sat May 09, 2009 8:23 pm

Re: Action after time passed / countdown reaching zero.

Post by Griven »

If you're hosting on a Linux server, you could try creating a CRON job that activates a PHP script which adds 520 resources to each active player.
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: Action after time passed / countdown reaching zero.

Post by oscardog »

Griven wrote:If you're hosting on a Linux server, you could try creating a CRON job that activates a PHP script which adds 520 resources to each active player.
This would be the easiest way, although you'll need some sort of onscreen timer to let the play know how long until the next update is.

If you use cPanel this is a good tutorial to look at:

http://www.siteground.com/tutorials/cpa ... n_jobs.htm :)
Post Reply