Updating a MySQL table every X minutes

Kaz

BooYah
Staff member
Nov 16, 2010
3,064
1,025
I am currently toying around with a little rpg sort of game.

I am wanting to update a users energy every X minutes.
I know this is possible with a cron, however i am wanting this to work in real time.

Basically I am wanting a little timer under the energy stat point counting down, as it reaches 0 the energy is updated via 1, and the timer goes back to X minutes and counts down again.

Any ideas what the best way to accomplish this is?
Can the user spoof the timer in anyway by changing the time on their device?

Thanks
 

RastaLulz

fight teh power
Staff member
May 3, 2010
3,934
3,933
Simply store a record in the database of when the next possible update can occur, and update it every time the energy changes. That way the client can't spoof the timer, and if they do, you'll have a check in place on the server side.
 

Users who are viewing this thread

Top