Jump to content
MakeWebGames

Recommended Posts

Posted

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*

Posted

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.

  • 4 weeks later...
  • 5 months later...
Posted

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... :)

  • 3 months later...
Posted (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 by zefiux
  • 3 months later...
Posted

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.

Posted
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?

Posted

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?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...