Jump to content


This topic is now archived and is closed to further replies.


Im Having Cron.PHP problem

Recommended Posts

Hey guys, Im making an online Game clone !
my site is at
it is a clone of the game at

i got the files needed but my cron.php file aint working, i did the crontab but it seems like my cron.php file is spoilt

here it is

function defSort ($a, $b) {
    if ($a->DefenseAction == $b->DefenseAction) return 0;
    return ($a->DefenseAction > $b->DefenseAction) ? -1 : 1;
function atSort ($a, $b) {
    if ($a->StrikeAction == $b->StrikeAction) return 0;
    return ($a->StrikeAction > $b->StrikeAction) ? -1 : 1;
function covSort ($a, $b) {
    if ($a->CovertAction == $b->CovertAction) return 0;
    return ($a->CovertAction > $b->CovertAction) ? -1 : 1;
function rankFloat ($a, $b) {
    if ($a->RankFloat == $b->RankFloat) return 0;
    return ($a->RankFloat < $b->RankFloat) ? -1 : 1;

include "vsys.php";
$users=getActiveUsers("ID, race, fortificationLevel, siegeLevel, currentSpySkill, trainedAttackSold, trainedAttackMerc, trainedDefSold, trainedDefMerc, untrainedSold, untrainedMerc, spies ");
for ($i=0; $i<count($users);$i++){
//print_r($users[$i]);print "<br>";
updateUser($users[$i]->ID," gold = gold+'$money', attackTurns = attackTurns+2, untrainedSold=untrainedSold+currentUnitProduction ");
//echo getStrikeAction($users[$i])."<br>";
//echo getDefenseAction($users[$i])."<br>";
//echo getCovertAction($users[$i])."<br>";
//echo "--------------users1---<br>";
//print_r ($users1);
//echo "--------------users2---<br>";
//print_r ($users2);
//echo "--------------users3---<br>";
//print_r ($users3);

for ($i=0;$i<count($users1);$i++){
for ($i=0;$i<count($users2);$i++){
for ($i=0;$i<count($users3);$i++){
for ($i=0;$i<count($usersA);$i++){
//echo $usersA[$i]->RankFloat.";;";
setUserRank($usersA[$i]->ID, $i+1, $usersA[$i]->StrikeAction, $usersA[$i]->DefenseAction , $usersA[$i]->CovertAction);
updateMercenary(" attackSpecCount=attackSpecCount+'{$conf['mercenaries_per_turn']}', defSpecCount =defSpecCount +'{$conf['mercenaries_per_turn']}', untrainedCount =untrainedCount +'{$conf['mercenaries_per_turn']}' ");

Share this post

Link to post
Share on other sites
Do you have a error? Is it path error (working directory problem), it's kind of hard to tell you what is wrong without knowing how your calling this or if the script has errors due to permissions, or it may not be changing the directory so the include files don't get included. All of these are guesses, because we can't see what really is happening. So try to post more information, such as your PHP log if your logging errors or your server log that gives information about the cron task associated with this script!


Share this post

Link to post
Share on other sites
Well, the game is based on turns every 15 minutes. So what the cron does is to update the game every 15 minutes.

But the cron doesnt work so it is stuck at 0 minutes to go forever

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.