MadTechie Posted August 13, 2007 Share Posted August 13, 2007 that should run so theirs only one winner (isn't possible to tie) Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322468 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 GOD VS. CatNCobra User Start HP:100 Enemy Start HP:100attack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GODattack User HP:100 Enemy HP:100GOD has done 268 damage against CatNCobraattack User HP:100 Â OK, this shows up, i think dmg isnt fixed? im confused now, lol Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322471 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 *bump* boss problems? =D Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322475 Share on other sites More sharing options...
MadTechie Posted August 13, 2007 Share Posted August 13, 2007 OK, last one (i hope) this is less stress on the server and should display clearly  else { echo' Welcome to the Battle Arena.'; echo "User Start HP:".$user->hp; echo "<br>Enemy Start HP:".$enemy->hp; $attacker = ($user->agility > $enemy->agility); while ($user->hp > 0 && $enemy->hp > 0) { echo "User HP:".$user->hp; echo "<br>Enemy HP:".$enemy->hp; if($attacker) { $dmg = (int)($user->attack - $enemy->defense); $enemy->hp = (int)($enemy->hp - dmg); echo $user->display_name." has done $dmg damage against ".$enemy->display_name."<br>"; }else{ $dmg = (int)($enemy->attack - $user->defense); $user->hp = (int)($user->hp - dmg); echo $enemy->display_name." has done $dmg damage against ".$user->display_name."<br>"; } $attacker = !$attacker; flush(); //add } if( $user->hp == 0) { echo $enemy->display_name." Wins"; }else{ echo $user->display_name." Wins"; } mysql_query("UPDATE `users` SET hp =({$enemy->hp}) WHERE ID = $enemy->ID"); mysql_query("UPDATE `users` SET hp =({$user->hp}) WHERE ID = $user->ID"); } include('inc/footer.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322476 Share on other sites More sharing options...
MadTechie Posted August 13, 2007 Share Posted August 13, 2007 my boss has a walk around the departments and bugs everyone, i can't be seen on a forum when his around Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322478 Share on other sites More sharing options...
sasa Posted August 13, 2007 Share Posted August 13, 2007 what is type of your column hp? Â Â Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322479 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 hmmm, problem, (sorry!!!!)  u forgot a } i think  Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.  Please contact the server administrator, webmaster@donkeygame.1gig.biz and inform them of the time the error occurred, and anything you might have done that may have caused the error.  More information about this error may be available in the server error log.  Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.  i dunno where, its a 500 internal again Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322481 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 float, unsigned, not null, default 100 Â y? Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322482 Share on other sites More sharing options...
MadTechie Posted August 13, 2007 Share Posted August 13, 2007 can't see the problem  try full code <?php include('inc/header.php'); $eID = $enemy->ID; $uID = (int)$_GET['ID']; if ($uID > 0) { #if called from header! $enemysql = @mysql_query("SELECT * FROM users WHERE ID = '$eID'"); $enemy = @mysql_fetch_object($enemysql); $usersql = @mysql_query("SELECT * FROM users WHERE ID = '$uID'"); $user = @mysql_fetch_object($usersql); echo "$user->display_name"; echo ' VS. ';echo "$enemy->display_name<br>"; }else{ die("error"); } if ($enemy->ID == $user->ID) { echo' You cant attack yourself!'; } elseif ($user->hp <= 0) { echo ' You are in NO condition to do battle'; } elseif ($enemy->hp == 0) { echo ' Your Enemy Is Already Dead!'; } elseif ($user->energy <= 4) { echo ' Not enough energy!'; } elseif ($user->attack < $enemy->defense) { echo ' You look at your opponent, and wet your pants at his/her strength. You lose the battle.<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$user->ID'"); } elseif ($user->defense > $enemy->attack) { echo' Your opponent takes one look at you, and dies in fear<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$enemy->ID'"); } else { echo' Welcome to the Battle Arena.'; echo "User Start HP:".$user->hp; echo "<br>Enemy Start HP:".$enemy->hp; $attacker = ($user->agility > $enemy->agility); while ($user->hp > 0 && $enemy->hp > 0) { echo "User HP:".$user->hp; echo "<br>Enemy HP:".$enemy->hp; if($attacker) { $dmg = (int)($user->attack - $enemy->defense); $enemy->hp = (int)($enemy->hp - dmg); echo $user->display_name." has done $dmg damage against ".$enemy->display_name."<br>"; }else{ $dmg = (int)($enemy->attack - $user->defense); $user->hp = (int)($user->hp - dmg); echo $enemy->display_name." has done $dmg damage against ".$user->display_name."<br>"; } $attacker = !$attacker; flush(); //add } if( $user->hp == 0) { echo $enemy->display_name." Wins"; }else{ echo $user->display_name." Wins"; } mysql_query("UPDATE `users` SET hp =({$enemy->hp}) WHERE ID = $enemy->ID"); mysql_query("UPDATE `users` SET hp =({$user->hp}) WHERE ID = $user->ID"); } include('inc/footer.php'); ?>  Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322483 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 lol ur code, everytime! Â Â $eID = $enemy->ID; $uID = (int)$_GET['ID']; Â its supposed to be uID = $user->id and eID = $_get[iD] Â enemy's in the url lol Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322484 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 i keep getting a 500 internal server error Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322485 Share on other sites More sharing options...
MadTechie Posted August 13, 2007 Share Posted August 13, 2007 total guess but i think i cant set the object so i revised it.. <?php include('inc/header.php'); $eID = $enemy->ID; $uID = (int)$_GET['ID']; if ($uID > 0) { #if called from header! $enemysql = @mysql_query("SELECT * FROM users WHERE ID = '$eID'"); $enemy = @mysql_fetch_object($enemysql); $usersql = @mysql_query("SELECT * FROM users WHERE ID = '$uID'"); $user = @mysql_fetch_object($usersql); echo "$user->display_name"; echo ' VS. ';echo "$enemy->display_name<br>"; }else{ die("error"); } if ($enemy->ID == $user->ID) { echo' You cant attack yourself!'; } elseif ($user->hp <= 0) { echo ' You are in NO condition to do battle'; } elseif ($enemy->hp == 0) { echo ' Your Enemy Is Already Dead!'; } elseif ($user->energy <= 4) { echo ' Not enough energy!'; } elseif ($user->attack < $enemy->defense) { echo ' You look at your opponent, and wet your pants at his/her strength. You lose the battle.<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$user->ID'"); } elseif ($user->defense > $enemy->attack) { echo' Your opponent takes one look at you, and dies in fear<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$enemy->ID'"); } else { echo' Welcome to the Battle Arena.'; echo "User Start HP:".$user->hp; echo "<br>Enemy Start HP:".$enemy->hp; $attacker = ($user->agility > $enemy->agility); $uHP = $user->hp; $eHP = $enemy->hp; while ($uHP > 0 && $eHP > 0) { echo "User HP:".$uHP; echo "<br>Enemy HP:".$eHP; if($attacker) { $dmg = (int)($user->attack - $enemy->defense); $eHP = (int)($eHP - dmg); echo $user->display_name." has done $dmg damage against ".$enemy->display_name."<br>"; }else{ $dmg = (int)($enemy->attack - $user->defense); $uHP = (int)($uHP - dmg); echo $enemy->display_name." has done $dmg damage against ".$user->display_name."<br>"; } $attacker = !$attacker; flush(); //add } if( $uHP == 0) { echo $enemy->display_name." Wins"; }else{ echo $user->display_name." Wins"; } mysql_query("UPDATE `users` SET hp =($eHP) WHERE ID = $enemy->ID"); mysql_query("UPDATE `users` SET hp =($uHP) WHERE ID = $user->ID"); } include('inc/footer.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322489 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 nope, 500 internal server error.. SIGH Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322491 Share on other sites More sharing options...
MadTechie Posted August 13, 2007 Share Posted August 13, 2007 quick test  while ($uHP > 0 && $eHP > 0) { die("END");  if that works move die("END"); to die("END"); flush(); //add } Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322493 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 CatNCobra VS. Your Enemy Is Already Dead!  thats what happens when i put what u told me,uID and eID need to be switched  where do i put that test Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322498 Share on other sites More sharing options...
sasa Posted August 13, 2007 Share Posted August 13, 2007 you can't insert value lees then 0 in it and you try this Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322501 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 im losing both of u  MAD, where do i put the test  and SASA what u talkin about Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322504 Share on other sites More sharing options...
MadTechie Posted August 13, 2007 Share Posted August 13, 2007 <?php include('inc/header.php'); $eID = $enemy->ID; $uID = (int)$_GET['ID']; if ($uID > 0) { #if called from header! $enemysql = @mysql_query("SELECT * FROM users WHERE ID = '$eID'"); $enemy = @mysql_fetch_object($enemysql); $usersql = @mysql_query("SELECT * FROM users WHERE ID = '$uID'"); $user = @mysql_fetch_object($usersql); echo "$user->display_name"; echo ' VS. ';echo "$enemy->display_name<br>"; }else{ die("error"); } if ($enemy->ID == $user->ID) { echo' You cant attack yourself!'; } elseif ($user->hp <= 0) { echo ' You are in NO condition to do battle'; } elseif ($enemy->hp == 0) { echo ' Your Enemy Is Already Dead!'; } elseif ($user->energy <= 4) { echo ' Not enough energy!'; } elseif ($user->attack < $enemy->defense) { echo ' You look at your opponent, and wet your pants at his/her strength. You lose the battle.<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$user->ID'"); } elseif ($user->defense > $enemy->attack) { echo' Your opponent takes one look at you, and dies in fear<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$enemy->ID'"); } else { echo' Welcome to the Battle Arena.'; echo "User Start HP:".$user->hp; echo "<br>Enemy Start HP:".$enemy->hp; $attacker = ($user->agility > $enemy->agility); $uHP = $user->hp; $eHP = $enemy->hp; while ($uHP > 0 && $eHP > 0) { echo "User HP:".$uHP; echo "<br>Enemy HP:".$eHP; if($attacker) { $dmg = (int)($user->attack - $enemy->defense); $eHP = (int)($eHP - dmg); echo $user->display_name." has done $dmg damage against ".$enemy->display_name."<br>"; }else{ $dmg = (int)($enemy->attack - $user->defense); $uHP = (int)($uHP - dmg); echo $enemy->display_name." has done $dmg damage against ".$user->display_name."<br>"; } $attacker = !$attacker; die("end test"); //***************************<---their flush(); //add } if( $uHP == 0) { echo $enemy->display_name." Wins"; }else{ echo $user->display_name." Wins"; } mysql_query("UPDATE `users` SET hp =({$eHP}) WHERE ID = $enemy->ID"); mysql_query("UPDATE `users` SET hp =({$uHP}) WHERE ID = $user->ID"); } include('inc/footer.php'); ?>  UPDATED Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322508 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 GOD VS. CatNCobra Welcome to the Battle Arena.User Start HP:100 Enemy Start HP:100User HP:100 Enemy HP:100CatNCobra has done 1890 damage against GOD end test     and i changed the hp to bigint(sasa) .   and techie, can u please! read this  this----> eID and uID need to be changed, the get[id] gets enemies id Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322511 Share on other sites More sharing options...
MadTechie Posted August 13, 2007 Share Posted August 13, 2007 can you comment out #die("end test"); //***************************<---their  also make sure the last lines are mysql_query("UPDATE `users` SET hp =({$eHP}) WHERE ID = $enemy->ID"); mysql_query("UPDATE `users` SET hp =({$uHP}) WHERE ID = $user->ID"); Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322512 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Â Please contact the server administrator, webmaster@donkeygame.1gig.biz and inform them of the time the error occurred, and anything you might have done that may have caused the error. Â More information about this error may be available in the server error log. Â Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Â Â server error Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322516 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 any idea? Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322518 Share on other sites More sharing options...
MadTechie Posted August 13, 2007 Share Posted August 13, 2007 OK well we know its the while...  ok i am running out of idea.. edited for null damage  <?php include('inc/header.php'); $eID = $enemy->ID; $uID = (int)$_GET['ID']; if ($uID > 0) { #if called from header! $enemysql = @mysql_query("SELECT * FROM users WHERE ID = '$eID'"); $enemy = @mysql_fetch_object($enemysql); $usersql = @mysql_query("SELECT * FROM users WHERE ID = '$uID'"); $user = @mysql_fetch_object($usersql); echo "$user->display_name"; echo ' VS. ';echo "$enemy->display_name<br>"; }else{ die("error"); } if ($enemy->ID == $user->ID) { echo' You cant attack yourself!'; } elseif ($user->hp <= 0) { echo ' You are in NO condition to do battle'; } elseif ($enemy->hp == 0) { echo ' Your Enemy Is Already Dead!'; } elseif ($user->energy <= 4) { echo ' Not enough energy!'; } elseif ($user->attack < $enemy->defense) { echo ' You look at your opponent, and wet your pants at his/her strength. You lose the battle.<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$user->ID'"); } elseif ($user->defense > $enemy->attack) { echo' Your opponent takes one look at you, and dies in fear<br><br><br><br><br><br><br><br><br>'; mysql_query("UPDATE `users` SET hp = 0 WHERE ID = '$enemy->ID'"); } else { echo' Welcome to the Battle Arena.'; echo "User Start HP:".$user->hp; echo "<br>Enemy Start HP:".$enemy->hp; $attacker = ($user->agility > $enemy->agility); $uHP = $user->hp; $eHP = $enemy->hp; //temp values $edmg = 1; $udmg = 1; while ( $uHP > 0 && $eHP > 0 && ($edmg > 0 || $udmg > 0) ) { echo "User HP:".$uHP; echo "<br>Enemy HP:".$eHP; $edmg = 0; $udmg = 0; if($attacker) { $edmg = (int)($user->attack - $enemy->defense); $eHP = (int)($eHP - edmg); echo $user->display_name." has done $edmg damage against ".$enemy->display_name."<br>"; }else{ $udmg = (int)($enemy->attack - $user->defense); $uHP = (int)($uHP - udmg); echo $enemy->display_name." has done $udmg damage against ".$user->display_name."<br>"; } $attacker = !$attacker; flush(); //add } if( $uHP == 0) { echo $enemy->display_name." Wins"; }else{ echo $user->display_name." Wins"; } mysql_query("UPDATE `users` SET hp =($eHP) WHERE ID = $enemy->ID"); mysql_query("UPDATE `users` SET hp =($uHP) WHERE ID = $user->ID"); } include('inc/footer.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322519 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 error, once again :/ Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322520 Share on other sites More sharing options...
uwannadonkey Posted August 13, 2007 Author Share Posted August 13, 2007 sry this is so much trouble.. Quote Link to comment https://forums.phpfreaks.com/topic/64649-solved-weird-while-problem/page/3/#findComment-322522 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.