Guest User

Untitled

a guest
May 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <?php
  2.  
  3. $result = mysql_query("SELECT * FROM Heroes WHERE UserID='$fb_id'");
  4.  
  5. if (!$result) { die( mysql_error());}
  6. else
  7. {
  8. while($row = mysql_fetch_array($result))
  9. {
  10. $nTime=$row['Healthstamp'];
  11. $health=$row['Health'];
  12. $maxhealth=$row['MaxHealth'];
  13. $sTime=time();
  14.  
  15. if($health==$maxhealth||$health>$maxhealth)
  16. {
  17. $nHealth=$maxhealth;
  18. $xTime=$sTime;
  19. }
  20. else
  21. {
  22. $time=$nTime-$sTime;
  23.  
  24. if($time>60)
  25. {
  26. $qTime=$time/60;
  27. $multi=floor($qTime);
  28. $nHealth=$health+$multi;
  29.  
  30. if($nhealth==$maxhealth||$nhealth>$maxhealth)
  31. {
  32. $nHealth=$maxhealth;
  33. }
  34. else
  35. {
  36. $nHealth=$health+$multi;
  37. }
  38.  
  39. $xTime=$sTime;
  40. }
  41. else
  42. {
  43. $nHealth=$health;
  44. $xTime=$nTime;
  45. }
  46. }
  47.  
  48. mysql_query("UPDATE Heroes SET Health='$nHealth', Healthstamp='$xTime' WHERE UserID='$fb_id'");
  49.  
  50. }
  51. }
  52.  
  53. ?>
Add Comment
Please, Sign In to add comment