Jump to content
MakeWebGames

A 5 minute cron for EzRPG


Galahad

Recommended Posts

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*

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

  • 3 months later...
  • 3 months later...

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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