Jump to content
MakeWebGames

Energy/Will/brave doesn't regenerate?


zefiux

Recommended Posts

Uses a cron (or two?) to regenerate the stat bars, have you set it up?

Oh thanks.

I've setup Every 5 min, and every day at 00:00 midnight crons now xD

Btw, is it posibble to change layout on Lite version?

Edit: Still doesn't work :/

 

This is un-edited code of MCCode lite cron_fivemins.php:

<?php
/*
MCCodes Lite
cron_fivemins.php Rev 1.0.1
Copyright (C) 2006 Dabomstew

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
include "mysql.php";
global $c, $mykey;
$path=$_SERVER['HTTP_HOST'].str_replace('cron_fivemins.php','',$_SERVER['SCRIPT_NAME']);
if($_GET['code'] != md5($path.$mykey))
{
 exit;
}
$query="UPDATE users SET energy=energy+(maxenergy/(12.5)) WHERE energy<maxenergy";
$query2="UPDATE users SET energy=maxenergy WHERE energy>maxenergy";
$query3="UPDATE users SET will=will+10 WHERE will<maxwill";
$query4="UPDATE users SET will=maxwill WHERE will>maxwill";
mysql_query($query,$c) or die("\nError Executing Query 1 for updating users $i to $next\n$query\n".mysql_error()."\nError Code:".mysql_errno());
mysql_query($query2,$c) or die("\nError Executing Query 2 for updating users $i to $next\n$query2\n".mysql_error()."\nError Code:".mysql_errno());
mysql_query($query3,$c) or die("\nError Executing Query 3 for updating users $i to $next\n$query3\n".mysql_error()."\nError Code:".mysql_errno());
mysql_query($query4,$c) or die("\nError Executing Query 4 for updating users $i to $next\n$query4\n".mysql_error()."\nError Code:".mysql_errno());
$query="UPDATE users SET brave=brave+((maxbrave/10)+0.5) WHERE brave<maxbrave ";
$query2="UPDATE users SET brave=maxbrave WHERE brave>maxbrave";
$query3="UPDATE users SET hp=hp+(maxhp/3) WHERE hp<maxhp";
$query4="UPDATE users SET hp=maxhp WHERE hp>maxhp";
mysql_query($query,$c) or die("\nError Executing Query 1 for updating users $i to $next\n$query\n".mysql_error()."\nError Code:".mysql_errno());
mysql_query($query2,$c) or die("\nError Executing Query 2 for updating users $i to $next\n$query2\n".mysql_error()."\nError Code:".mysql_errno());
mysql_query($query3,$c) or die("\nError Executing Query 3 for updating users $i to $next\n$query3\n".mysql_error()."\nError Code:".mysql_errno());
mysql_query($query4,$c) or die("\nError Executing Query 4 for updating users $i to $next\n$query4\n".mysql_error()."\nError Code:".mysql_errno());
?>  

 

I'm noob at programing, and cna't find anything that would cause problems :/

Edited by zefiux
Link to comment
Share on other sites

I dont know much about lite but ill give it a shot.

Maybe try something like replacing this:

$query="UPDATE users SET energy=energy+(maxenergy/(12.5)) WHERE energy<maxenergy";

With this:

mysql_query="UPDATE users SET energy=energy+(maxenergy/(12.5)) WHERE energy<maxenergy";

Or if you do what I did and remove the maxenergy from incrementing every level try this:

mysql_query="UPDATE users SET energy=energy+##";

Replace ## with whatever number you want and put that in the minute cron

Or maybe what you can do is like what I do since im real new to this is just run the code in the sql and if you dont get an error then its not the code its something else

Edited by KyleMassacre
Link to comment
Share on other sites

  • 2 weeks later...
I dont know much about lite but ill give it a shot.

Maybe try something like replacing this:

$query="UPDATE users SET energy=energy+(maxenergy/(12.5)) WHERE energy<maxenergy";

With this:

mysql_query="UPDATE users SET energy=energy+(maxenergy/(12.5)) WHERE energy<maxenergy";

Or if you do what I did and remove the maxenergy from incrementing every level try this:

mysql_query="UPDATE users SET energy=energy+##";

Replace ## with whatever number you want and put that in the minute cron

Or maybe what you can do is like what I do since im real new to this is just run the code in the sql and if you dont get an error then its not the code its something else

That will just make it worse.

If you look down a little farther you can see that $query is run inside a mysql_query(), so now that will error out when $query is formatted wrong.

I would recommend running the cron manually and seeing if you get any errors. Just visit it in your browser.

If you do post them for us to check out and maybe I can help you further.

 

p.s. kylemassacre what exactly is this?:

mysql_query="UPDATE users SET energy=energy+##";

mysql_query() is a function...and if you are trying to set a variable named mysql_query you would need your trusty $ symbol ;)

Edited by Arson
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...