Galahad Posted April 14, 2011 Posted April 14, 2011 This is a 5 minute cron i quickly made to allow the game to regenerate hp and energy. Add this to the root of your game and call it cron5min.php <?php define('IN_EZRPG', true); require_once('init.php'); $code = 45645382734; //CHANGE THIS TO YOUR OWN RANDOM SET OF NUMBERS if($_GET['code'] != $code) { die("Code is invalid!"); } // Updates the player HP +5 $db->execute('UPDATE `<ezrpg>players` SET `hp`=`hp`+5 WHERE `hp` < `max_hp` '); // Updates the player energy +1 $db->execute('UPDATE `<ezrpg>players` SET `energy`=`energy`+1 WHERE `energy` < `max_energy` '); ?> and add the cron by doing this */5 * * * * http://*YouwebsiteURL*/cron5min.php?code=*YOUR CODE HERE* Quote
Dave Posted April 14, 2011 Posted April 14, 2011 Surely you'd be better of using a time stamp system? Quote
Galahad Posted April 14, 2011 Author Posted April 14, 2011 Surely you'd be better of using a time stamp system? I used a timestamp system but it was very buggy so i thought it would be easier to make a cron. Quote
rulerofzu Posted April 14, 2011 Posted April 14, 2011 Both have their good and bad points. Running crons isnt too bad but you will find those on free hosts or cheap hosts cannot run them that often as per the hundreds of my crons dont work posts. Quote
Dominion Posted May 8, 2011 Posted May 8, 2011 this doesnt work for me :/ More information? Is your code variable set correctly? Try running it manually, and see if you get any errors. Quote
begood Posted October 19, 2011 Posted October 19, 2011 To use cronjobs in free hosts or cheap hosts like rulerofzo says, you've to do that: 1. Create a html file called whatever you want. 2. Copy & Paste that simple code: <meta HTTP-EQUIV="REFRESH" content="0; url=LINK_CRONJOB"> 3. Change the LINK_CRONJOB to the entire cronjob url. 4. Save it... 5. Now in your host cp add this: */5 * * * * http://*YouwebsiteURL*/cron5min.php?code=*YOUR CODE HERE* Like 21LockDown says... :) Quote
zefiux Posted February 7, 2012 Posted February 7, 2012 (edited) What can I do if I can't use ?= in path? :/ What if I use redirect to cron5min.php?code=*code* and in cronjob path put link of "redirecter" Edited February 7, 2012 by zefiux Quote
Newbie Posted February 7, 2012 Posted February 7, 2012 if anyone looking for free host which supports cron jobs i would reccommend x10hosting.com Quote
Arson Posted May 13, 2012 Posted May 13, 2012 If you're serious about running a game you shouldn't be on a free host...as soon as it starts getting players and using bandwidth your host is going to suspend your account. As for Crons 9 times out of 10 you are best off going with Pseudo-crons (timestamp system). The only reason it would be buggy is if you don't know what you're doing. Quote
Arson Posted May 13, 2012 Posted May 13, 2012 To use cronjobs in free hosts or cheap hosts like rulerofzo says, you've to do that: 1. Create a html file called whatever you want. 2. Copy & Paste that simple code: <meta HTTP-EQUIV="REFRESH" content="0; url=LINK_CRONJOB"> 3. Change the LINK_CRONJOB to the entire cronjob url. 4. Save it... 5. Now in your host cp add this: */5 * * * * http://*YouwebsiteURL*/cron5min.php?code=*YOUR CODE HERE* Like 21LockDown says... :) What exactly is the point of this? Quote
rulerofzu Posted May 14, 2012 Posted May 14, 2012 I believe what the person is referring too is if your host does not allow running of crons then make it a http refresh Obviously they typed it without thinking it through. Quote
Arson Posted May 16, 2012 Posted May 16, 2012 Ignoring his utterly horrible, and incorrect instructions on the process...can someone please explain to me how using a meta refresh is a viable alternative to cron jobs? Quote
rulerofzu Posted May 16, 2012 Posted May 16, 2012 He is gonna sit there 24/7 waiting for it to refresh....or hitting f5 lmao Quote
Arson Posted May 16, 2012 Posted May 16, 2012 He is gonna sit there 24/7 waiting for it to refresh....or hitting f5 lmao Hoorah for the 1min cron xD Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.