Jump to content


Im Having Cron.PHP problem

  • Please log in to reply
2 replies to this topic

#1 teothoyang

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 07 October 2006 - 03:46 PM

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']}' ");

#2 printf

  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 07 October 2006 - 06:17 PM

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!


#3 teothoyang

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 08 October 2006 - 12:09 AM

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

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users