Advertisement
CaptainLepidus

battle.php

May 2nd, 2012
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. <?php include("game.php");
  2.  
  3. $id = $_GET['id'];
  4. $attack = $_GET['attack'];
  5.  
  6. $sql="SELECT * FROM an_enemies WHERE id=$id";
  7. $result=mysql_query($sql);
  8. while($row=mysql_fetch_array($result))
  9. {
  10. $ename = $row["name"];
  11. $ehp = $row["hp"];
  12. $etype = $row["type"];
  13. }
  14.  
  15. $sql="SELECT * FROM an_enemy WHERE id=$etype";
  16. $result=mysql_query($sql);
  17. while($row=mysql_fetch_array($result))
  18. {
  19. $emaxhp = $row["maxhp"];
  20. }
  21.  
  22. $hp = get_stat("hp");
  23. $maxhp = 100+10*get_stat("end");
  24.  
  25. if($attack = 0)
  26. {
  27. $ehp = $ehp - rand(1,20);
  28. $hp = $hp - rand(1,20);
  29. }
  30. $sql="UPDATE an_enemies SET hp=$ehp WHERE id=$id";
  31. $result=mysql_query($sql);
  32. set_stat("hp",$hp);
  33. header('Location: index.php');
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement