Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > General > PHP Games

PHP Games Like Games?, Like PHP?...

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2006-04-12, 05:53 AM
Junior Member
 
Join Date: Apr 2006
Location: Turn left at Mars, and you're on the right planet
Posts: 1
Scarum is on a distinguished road
Default Need PHP help

I've been fiddling with programming for a long time. Now I think I'm ready to put everything I know into practice. Basically, I've designed a chunk of the first test of my new game (What I call the 'Alpha Core'), including the installation, the connecting script to the database, the incomplete index page,two shops, and a place where you can kill the monsters. But, this being a turn-based game, I've encountered my first of two problems. Crons. I would like someone to please post a reply containing a cron that runs these lines every day around midnight:
Quote:
$getturns="Update user index set turns=turns+50";
$getturns2=mysql_query($getturns) or die("Could not get turns")
Oh, and I also have another problem. The inventory. Could someone please post an example of an inventory script as well, please? I realise I'll probably have to change the installation file to do that, and if so, could whoever posts the inventory script also post the changes that need to be made to other files, please?
Thanks,

Scarum.
__________________
Hmmm. Stay fuzzy, save the world... Choices. Oh alright fine! We'll save the world! But do it quickly before I change my mind! ~Daxter

You know, my momma used to read me bedtime stories about Mar when she'd tuck me in. She'd give me a nice glass of warm yakow milk... and my little Poopsy bear. ~Sig
Reply With Quote
  #2 (permalink)  
Old 2006-06-16, 12:07 AM
Junior Member
 
Join Date: Sep 2005
Posts: 2
albinomonkey
Default sure

Ok as for your update at midnight script, basically you'll just add a table to your database for timed scripts. You'll first need a field for the time when to run EX: midnight, then you'll need a date last updated (which will be reupdated everynight at midnight). Basically all you do is place this code in your index page, when the first user stumbles across your site after midnight it will update, so... You determine wether the script has been run after midnight when a user accesses. You must take the current date and current time in PHP then use your database to compare to it your fields for the time to update, the last date updated. Now you must see wether your current date is 1 day greater than your last updated date (stored in the database), and you may need to know wether the time is after your update time (midnight).
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.5 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.5 (a popular PHP IDE) and NuCoder 2.0 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 02:08 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.