Advertisement
LorenKPetrov

Health Display Script

Sep 10th, 2013
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.16 KB | None | 0 0
  1. <?php
  2.  
  3.     /////////////////////////////
  4.     // Health Display Script   //
  5.     // 10/09/2013 - DD/MM/YYYY //
  6.     // By LorenKPetrov         //
  7.     // Skype: LorenKadyPetrov  //
  8.     /////////////////////////////
  9.    
  10.     $PlayerHealth=100 // Changable variable to dev test IF statement working correctly - Remove when intergrating with database
  11.     $PlayerDead="<font color='#FF0000'>Dead</font>";
  12.    
  13.     if($PlayerHealth <= 0) // States the player is dead if their health is 0 or less
  14.         {
  15.            
  16.             echo $PlayerDead;
  17.            
  18.         }
  19.     elseif($PlayerHealth <= 25) // States the player has 25 or less health
  20.         {
  21.            
  22.             echo "<font color='#FF0000'>" . $PlayerHealth . "</font>";
  23.            
  24.         }
  25.     elseif($PlayerHealth <= 50) // States the player has 50 or less health
  26.         {
  27.            
  28.             echo "<font color='#FFB300'>" . $PlayerHealth . "</font>";
  29.            
  30.         }
  31.     elseif($PlayerHealth <= 75) // States the player has 75 or less health
  32.         {
  33.            
  34.             echo "<font color='#F6FF00'>" . $PlayerHealth . "</font>";
  35.            
  36.         }
  37.     elseif($PlayerHealth >= 76) // States the player has 76 or more health - Good for giving players more than 100 health
  38.         {
  39.            
  40.             echo "<font color='#00FF00'>" . $PlayerHealth . "</font>";
  41.            
  42.         }
  43.        
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement