Image

Imagegrich108 wrote in Imagephp

Two questions

Hello! I am making an online MMORPG using PHP and MySQL. I have two questions.

First off, how would I make a turn system? As in, for example, I can have up to 100 turns at a time. When I use a turn, stuff happens; I get one turn every 10 seconds or so.

For example...
I have 100 turns.
I use 5. (The stuff the turns do happens.)
I now have 95 turns.
20 seconds pass.
I now have 97 turns.
40 seconds pass.
I now have 100 turns. (Not 101, because 100 is max.)

How could I do something like that using PHP and MySQL?

Secondly, is there a way using PHP (or MySQL) to automatically empty out a certain table at a certain time, even if a page isn't accessed? Like an auto-refresh if you will. I'm thinking that would be on the server, not in a particular script however...because scripts are only run when they're opened.

*Shrugs*

Insight would be helpful. Thank you!