Need Coding Help With Web-based Rpg Game!

Hello coders!

I have a slight problem coding the last php script of the game (RPG war system game) similar as Kings of chaos!

Actually I can’t let the (turns) and the time move on every 10, 20 or whatever time I want!!

I need your help guys!

Which php file I should edit? What’s wrong with the script?

this is my email

[email protected]

Thanx

  1. We don’t know what script you’re talking about
  2. We don’t know what the underlying database looks like
  3. We don’t know what errors you’re getting
  4. You’re not providing a decent problem description
  5. We don’t know what you’ve tried to solve the problem
  6. We don’t know what you’ve researched on the matter

And on a netiquette note:

  1. You didn’t read the Posting Guidelines
  2. We won’t be sending you emails

So yea, we can’t really help you.

Well…

Its a web-based online game…such as king of chaos

Its based in (turns), so each time the player should get (turns) to go on in the game and buy things… But! The (turns) in the game never move! its just stop and its should move every 1 or 10 or 20 Min or whatever the time I command the script.

However, I got a hint about the (cron) from unix may caused such a problem, and I should edit and give some command to the (cron) file

But still the problem is there, and the (turns) never move!

So, is it clear now mate, or you want me to clear more for you

Thanx in advance!

Hmmz, well, I don’t know jack shit about cron jobs. I’d do this by having a separate database table keeping track of the turns and their timestamps. You could use a header file to check this timestamp against the current machine time, to see if the next ‘turn’ has already come. If so, up the turns in the table and do whatever else you want to do each turn.

Thanx again, but should I update the file (time.php) only?

I will give you a hint

This is what the current (time.php) file:

<? echo time(); ?>

well and the (vsys.php) got these codes:

[code]function getNextTurn($user){
global $conf;
$info=getCommonInfo();
$lastTurnTime=$info->lastTurnTime;
$thisTime=time();
$dif=$thisTime-$lastTurnTime;
//$nextTurn=$dif;
$nextTurnMin=$dif/60;
/*if ($nextTurnMin>$conf[“minutes_per_turn”]){
//echo “--------”;
$addTurnsF=$dif/($conf[“minutes_per_turn”]60);
$addTurns=floor($addTurnsF);
//$nextTurn1=($addTurnsF-$addTurns)
$conf[“minutes_per_turn”];
$nextTurn1=$dif-(($conf[“minutes_per_turn”]60)$addTurns);
//echo $addTurns."##".$nextTurn1."##".($thisTime-$nextTurn1)."
";
$nextTurn=round($nextTurn1/60);
$addTurns+=$user->attackTurns;
addTurns($user->ID,$addTurns,$thisTime-$nextTurn1);

}else*/
{
	$nextTurn=round($nextTurnMin);
}
//echo $dif."<br>";
$nextTurn=$conf["minutes_per_turn"]-$nextTurn;
if ($nextTurn<0)$nextTurn=0;
return $nextTurn;//($conf["minutes_per_turn"]-$nextTurn);

}

function getCommonInfo(){
$str=“select * from Mercenaries“;
//echo $str;
$q = @mysql_query($str);
if (!$q) {
print ('Query failed: '.mysql_error());
return;
}
if (!@mysql_num_rows($q)) {
return 0;
}
else{
$st=””;
$st = mysql_fetch_object($q);
return $st;
}
}

//----------------------------Messages-----------------------------------------------
function getMessagesCount($userID){
$str = “SELECT COUNT(*) FROM Messages where userID=’$userID’ “;
$q = @mysql_query($str);
if ($q){
$st = mysql_fetch_array($q);
return $st[0];
}else{return 0;}
}
function getAllMessages($userID ){
$str=“SELECT * FROM Messages WHERE userID=’$userID’”;
//print $str;
$q = @mysql_query($str);
if (!$q) {print ('Query failed: '.mysql_error()); return; }
if (!@mysql_num_rows($q)) {return;}
else{
$st=””;
$i=0;
while ($row = mysql_fetch_object($q)){
$st[$i]=$row;
$st[$i]->subject =urldecode ($st[$i]->subject);
$st[$i]->text =urldecode ($st[$i]->text);
$i++;
}
return $st;
}
}
function getMessage($messID){
$str=“select * from Messages where ID=’$messID’ “;
//echo $str;
$q = @mysql_query($str);
if (!$q) {
print ('Query failed: '.mysql_error());
return;
}
if (!@mysql_num_rows($q)) {
return 0;
}
else{
$st=””;
$st = mysql_fetch_object($q);
$st->subject =urldecode ($st->subject);
$st->text =urldecode ($st->text);
return $st;
}
}[/code]

No, we don’t do script requests.

Sponsor our Newsletter | Privacy Policy | Terms of Service