teothoyang Posted October 7, 2006 Share Posted October 7, 2006 Hey guys, Im making an online Game clone !my site is atwww.solarcombat.co.ukit is a clone of the game atwww.kingsofchaos.comi got the files needed but my cron.php file aint working, i did the crontab but it seems like my cron.php file is spoilthere 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"; deleteOldUsers(); $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>"; $users[$i]->StrikeAction=getStrikeAction($users[$i]); $users[$i]->DefenseAction=getDefenseAction($users[$i]); $users[$i]->CovertAction=getCovertAction($users[$i]); $money=getUserIncome($users[$i]); 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>"; } $users1=$users; usort($users1,"atSort"); //echo "--------------users1---<br>"; //print_r ($users1); $users2=$users; usort($users2,"defSort"); //echo "--------------users2---<br>"; //print_r ($users2); $users3=$users; usort($users3,"covSort"); //echo "--------------users3---<br>"; //print_r ($users3); for ($i=0;$i<count($users1);$i++){ $usersA[$users1[$i]->ID]->ID=$users1[$i]->ID; $usersA[$users1[$i]->ID]->StrikeAction=$i+1; } for ($i=0;$i<count($users2);$i++){ $usersA[$users2[$i]->ID]->DefenseAction=$i+1; } for ($i=0;$i<count($users3);$i++){ $usersA[$users3[$i]->ID]->CovertAction=$i+1; $usersA[$users3[$i]->ID]->RankFloat=($usersA[$users3[$i]->ID]->StrikeAction+$usersA[$users3[$i]->ID]->DefenseAction+$usersA[$users3[$i]->ID]->CovertAction)/3; } usort($usersA,"rankFloat"); 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); } setLastTurnTime(time()); updateMercenary(" attackSpecCount=attackSpecCount+'{$conf['mercenaries_per_turn']}', defSpecCount =defSpecCount +'{$conf['mercenaries_per_turn']}', untrainedCount =untrainedCount +'{$conf['mercenaries_per_turn']}' ");?> Quote Link to comment Share on other sites More sharing options...
printf Posted October 7, 2006 Share Posted October 7, 2006 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!me! Quote Link to comment Share on other sites More sharing options...
teothoyang Posted October 8, 2006 Author Share Posted October 8, 2006 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.